arclanguage / anarki

Community-managed fork of the Arc dialect of Lisp; for commit privileges submit a pull request.
http://arclanguage.github.io
Other
1.17k stars 160 forks source link

Some escape sequences cause the repl to enter in a broken state #92

Open hjek opened 6 years ago

hjek commented 6 years ago

Evaluating an expression with an "unkown escape sequence" can cause the interpreter to enter a broken state where subsequently entered expressions are evaluated wrong,

arc> (pr "\^foo")
UNKNOWN::4: read: unknown escape sequence \^ in string
  context...:
   /home/pelle/anarki/ac.scm:1276:4

arc> _foo: undefined;
 cannot reference an identifier before its definition
  in module: "/home/pelle/anarki/ac.scm"
  context...:
   /home/pelle/anarki/ac.scm:1276:4

arc> (pr "bar")
")\n(pr "
arc> _bar: undefined;
 cannot reference an identifier before its definition
  in module: "/home/pelle/anarki/ac.scm"
  context...:
   /home/pelle/anarki/ac.scm:1276:4
akkartik commented 6 years ago

Yes I've seen this as well. Thanks for capturing the bug.

hjek commented 6 years ago

It's also an issue in the Racket repl.

akkartik commented 6 years ago

Ah, yes I think I did figure that out at some point.

rocketnia commented 6 years ago

Hmm, would it be a better idea to discard the rest of the available input if there's a read error? Or maybe just the rest of the line?