possible interpreter bug

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

possible interpreter bug

Alexey Zinger
I recently came across what might be considered a bug in the interpreter.  When interpreting line comments (//), the parser blows up when the last line of source contains a line comment and is not terminated with a new-line character:

bsh % eval("print(\"hello world\")");
hello world
bsh % eval("print(\"hello world\") //this will blow up");
// Error: // Uncaught Exception: Method Invocation this.interpreter.eval : at Line: 73 : in file: /bsh/commands/eval.bsh : this .interpreter .eval ( expression , this .caller .namespace )

Called from method: eval : at Line: 2 : in file: <unknown file> : eval ( "print(\"hello world\") //this will blow up" )
Target exception: Parse error at line 1, column 41.  Encountered: <EOF>

bsh % eval("print(\"hello world\") //but this will work\n");
hello world

2001 Honda CBR600F4i (CCS)
1992 Kawasaki EX500

Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
Beanshell-users mailing list
[hidden email]