-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Odd parsing/annotation problem #27
Comments
What branch are you talking about? In "heapless" there is just tests/liquid/pos/objects/obj-02.js and tests/liquid/pos/objects/obj-02.js And I'm not getting the behavior you mentioned. There is a bug in the parser (as described in the Issues section of the pull request #23) |
whoops, just added the test (heapless) On Fri, Jan 3, 2014 at 6:04 PM, Panagiotis Vekris
|
Problem: It turns out that our type annotations are valid JS regular expressions as far as the parser is concerned (ignoring the fact that they are comments), so what you're seeing is actually a RegExp. A very short fix just for this example (to keep the ball running) is to add a semicolon right after the object literal to separate it from the next statement (line 8). However, this is part of a bigger bug in the parser (also menitoned in my latest pull request). The problem is with parsing an annotation right after an object literal. In particular, parsing:
Before parsing comments along with the JS, the parser used these expression tables to parse some expressions including division. So in the above example:
would be parsed as the beginning of a division expression. (I believe) Expression tables do not do backtacking (which is the right thing to do in the first place since no other expression can start with This might be a little more involved than we thought. |
See: tests/liquid/pos/objects/obj-02-00.js
somehow the type annotation is getting parsed in as part of the JS and getting rejected by
the
isNanoExprStatement
(which basically checks that the expression is something we handle.) I cannot tell (easily) what data-constructor is being used to represent the AST corresponding to the parsed annotation.Should take just a few minutes for @panagosg7 ...
The text was updated successfully, but these errors were encountered: