This will solve a lot of the issues with the current parser, like bad error messages and also uneven support for statements not terminated with semi-colons.
Another thing broken in the current parser: "use strict"; at the top of the file. It results in this confusing compilation error message:
var lst = $$[$0-1].concat ($$[$0]);
TypeError: Object #<Node> has no method 'concat'
at Object.anonymous (tamejs/lib/parser.js:133:22)
at Object.parse (tamejs/lib/parser.js:428:40)
at Engine.parse (tamejs/lib/engine.js:362:19)
at [object Object].<anonymous> (fs.js:107:5)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)
Thanks for the note --- atop which file?
I just tried to compile a .tjs file with "use strict"; at the top. Example:
setTimeout(defer(var e, a), 100);
+1 on using the uglify.JS parser, or equivalent-- having random semicolon-related compiler issues and it's driving me batty! :)
Really sorry about that, are there certain cases in particular that come up a lot that I can try to engineer around?
There are also issues with semi colons inside regular expressions.. i.e.
var img_data = req.body.data.match(/^data:image\/png;base64,(.+)/);
had to become
var img_data = req.body.data.match('^data:image\/png;base64,(.+)');
to compile and I haven't yet worked around the issue where when using the optimist option parser library, calls to .default cause a parse error.. https://gist.github.com/1270412
Hacked my way around the immediate problem https://gist.github.com/1270453 which was not being able to do obj.default();