jswebtools/language-ecmascript

Infix operator parsing inside brackets: parsing "x++&256" inside of "[]"

Closed this issue · 7 comments

This expression fails to parse:

o[x++&256]

whereas this expression succeeds:

o[x++ &256]

This issue is not present outside of "[]", meaning this expression parses successfully:

x++&256

I found this by trying to parse the JSAI benchmark suite from the http://www.cs.ucsb.edu/~benh/research/downloads.html. If you download the project files for "JSAI: A Static Analysis Platform for JavaScript" and locate the benchmarks at error/src/test/resources/FSE_benchmarks, the file that first fails to parse is opn-rsa.js.

Your tools rock by the way! Thanks for sharing them :)

Thanks for the report. Which library version (or branch) have you tested?

language-ecmascript == 0.16.2
parsec == 3.1.7
ghc == 7.8.3

Hope this helps.

Thanks. I'll get to it eventually, but it would be helpful if you could try it on the 'es5' branch: https://github.com/jswebtools/language-ecmascript/tree/es5

There are a few parser bugs in language-ecmascript-0.* codebase that are, unfortunately, hard to fix.

@davdar, I just realized what I asked you was confusing, because there is both the legacy parser (Language.ECMAScript3.Parser) and the new one (Language.ECMAScript5.Parser) in the es5 branch. The new parser in the current state is already much better than the legacy one (in 0.16.2).

Thanks for the tip! I haven't tried the branch yet, and it will be a couple of days before I do. I'll let you know how it goes if/when I do.

Confirmed for 'es5' as well.

This doesn't seem to affect the current tip of 'es5', so I'm closing. Please, reopen if you still can get it to fail.