-
-
Save martin12333/976f45ecd8ffd619161d729b14810f9c to your computer and use it in GitHub Desktop.
Revisions
-
nexpr created this gist
May 26, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ C:\Users\user\Desktop>cscript //E:{1b7cd997-e5ff-4932-a7a6-2a9e636da385} repl.js Microsoft (R) Windows Script Host Version 5.812 Copyright (C) Microsoft Corporation. All rights reserved. > if(true){\ > 1\ > } 1 > var a = 10 undefined > a 10 > exit This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ let acc = "" while(true){ WScript.StdOut.Write("> ") const input = WScript.StdIn.ReadLine() if(input === "exit"){ break } if(input.endsWith("\\")){ acc += input.slice(0, -1) + "\n" continue } const source = acc + input acc = "" try{ const [result = "undefined" ] = [eval(source)] WScript.Echo(result) }catch(err){ WScript.Echo(err.message) WScript.Echo(err.stack) } }