From 5ad4d804ba4b4fd169a1a7ba723be713ebd9c216 Mon Sep 17 00:00:00 2001 From: "Italo A. Casas" Date: Wed, 22 Jun 2016 22:36:46 -0400 Subject: [PATCH] adding exponentiation operator exeption --- lib/repl.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/repl.js b/lib/repl.js index db5754ec041196..4e9a79548b04cc 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -478,6 +478,19 @@ function REPLServer(prompt, evalCmd = evalCmd + '\n'; } + // Exponentiation operator + if (cmd && cmd.split('').indexOf('*') !== -1) { + + const cmdArray = cmd.split(''); + const index = cmdArray.indexOf('*'); + + if (cmdArray[index + 1]) { + self.outputStream.write('SyntaxError: Unexpected token *\n'); + finish(null); + return; + } + } + debug('eval %j', evalCmd); self.eval(evalCmd, self.context, 'repl', finish);