jcartledge / sublime-worksheet

An inline REPL for JavaScript, PHP, Ruby & more in Sublime Text 2 and 3
MIT License
332 stars 18 forks source link

support special keywods #29

Open zwetan opened 11 years ago

zwetan commented 11 years ago

for ex: the avmshell repl gives

$ avmshell -repl
avmplus interactive shell
Type '?' for help

> ?
Text entered at the prompt is compiled and evaluated unless
it is one of these commands:

  ?             print help
  .input        collect lines until a line that reads '.end',
                then eval the collected lines
  .load file    load the file (source or compiled)
  .quit         leave the repl
  .time expr    evaluate expr and report the time it took.

the ".input" to ".end" could be quite useful to support multiline scripts

jcartledge commented 11 years ago

I don't think we need to do anyhting special to support these - they should just work. Am I missing something?

zwetan commented 11 years ago

OK so maybe I don't understand how the repl parser is working ?

in AS3 you would write

.input
//line 1 of code
//line 2 of code
//etc..
//line 10 of code
.end

how to configure so it ignore the line starting with ".input" take all the lines in between and then ignore the line starting by ".end" and then interpret the whole lines from before ?

just asking in case of it is something obvious I didn't see ;) otherwise I gonna do some tests see if it's possible to support

jcartledge commented 11 years ago

OK, I see the problem - there's no prompt when you're in multiline mode. I'm not sure how we'll deal with that.