Subject: | Two incorrect syntax errors |
Hello,
While trying to use JE as a mean to validate a large set of JavaScript
files, I found two cases where it fails to correctly parse some fairly
simple and valid syntax.
The first case is quite common when creating structures and objects:
var thing = { foo: 123, };
JE incorrectly wants something after the coma, and fails with:
SyntaxError: Expected identifier, or string or number literal but
found '};\n'
(the \n is not literal in the actual message)
The second case occurred while trying to compile the jquery.dynatree.js
from Jquery, and can be reduced to this:
var path = "whatever";
path.search(/.*dynatree[^/]*\.js$/);
Here, JE gets confused by the [^/] class, incorrectly reads the slash as
the regexp terminator, and obviously complains that the class is not
terminated:
SyntaxError: Unterminated character class [^ in regexp
I also saw the parser generate panic errors:
SyntaxError: panic: reg_node overrun trying to emit 46 at
/usr/local/share/perl/5.14.2/JE/Object/RegExp.pm line 620
but that's typically for very big files like Ext JS, which weight a few
megabytes. Probably a bit out of JE's league.
Other than these cases, JE was able to successfully parse a good 700
JavaScript files.
--
Close the world, txEn eht nepO.