JavaScript example: Remove reserved word detection
Reserved word detection as it was implemented in the JavaScript example grammar had two big downsides: 1. It required changes in ordering of choices in some rules in order not to trigger the detection prematurely. One of the changes was already implemented (in the |Statement| rule, see the diff), but apparently more were needed (the grammar didn't parse inputs like |true| or |function f() {}|). And I'm not 100% sure that would be the end of it (maybe deeper structural changes would be needed). 2. It made error messages confusing. Consider the following example: var a = @; Instead of reporting: Expected ... but "@" found. the generated parser reported: Reserved word "var" can't be used as an identifier. This was because the parser parsed the statement first as |VariableStatement| and when this failed, it tried to parse it as |ExpressionStatement|, triggering the reserved word detection. Because of these, I decided to remove reserved word detection from the JavaScript example grammar.redux
parent
b271d66442
commit
c13cc88262
Loading…
Reference in New Issue