forked from calmjs/calmjs.parse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually correct the ASI generation procedures
- Drop the extraneous auto_semi rule, as it turns out that rule is **never** hit due to it being effectively replicates the unmatched production condition (through auto_semi then error). - However, on the case where the SEMI is produced through the error handler after an error condition that is actually an error, if the production stack is just that freshly generated SEMI, it will be immediately consumed and used by the empty_statement production rule, then the previously erroring token is yielded again, restarting the cycle thus that's the real cause behind the infinite loop as reported in rspivak/slimit#29. - However, if the auto generated SEMI tokens are correctly marked, and update the existing rules to make use of that token, the immediate consumption of the token cannot happen if an empty statement does NOT include the auto generated SEMI token (which has been done by creating a new AUTOSEMI token type), the condition which the immediate consumption of a token to result in the error token can no longer occur. - Removed the seen before token hack. - Moved all the conditions for which AUTOSEMI token is generated to the lexer auto_semi method. - This also completely eliminates the incorrect production of statements that only has SEMIs but not the ASI equivalent, such as the case with ``if`` or ``for`` statements as per 7.9.2 of the ECMA-262 5.1 spec, which is reported in rspivak/slimit#101.
- Loading branch information
1 parent
4110a41
commit 486626d
Showing
3 changed files
with
79 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters