Frage

I am using a node REPL in emacs on an ubuntu ec2 instance and I've noticed that whenever I type an unknown character, for example, "#" into the REPL the REPL will stop working and instead of having each line starting with '>' where I would enter my code I am getting '... ^[[5G'. If I hit C-c C-c then the REPL will return to normal. What is going on here?

I think that this might have something to do with comments. If so, how would I bring all of my code over to the REPL using C-c C-r if the first line is a comment?

War es hilfreich?

Lösung

In JavaScript # is an illegal token, not a comment (try inputting this in a browser JavaScript console). This generates a syntax error when evaluated, however the node REPL is trying to be helpful by buffering the command and prompting you for more input (...) in an attempt to recover from the error.

This would be the same behaviour here (as documented in the REPL source):

> {          // syntax error!
... x : 1    // syntax error!
... }        // recovered ...
{ x: 1 }

However, in your case I don't believe you can ever recover from the bad syntax.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top