New Parser (nightly) parses wrong
test hexadecimal literal with whitespace [[0x 6]] parse fails
Parse failure expected: Decimal(“6”)It parses [[0x 6]] to Decimal(“6”) which is actually just [[6]]. It parses fine with the stable version of Spoofax.
Submitted by Daco Harkes on 15 March 2013 at 09:26
Issue Log
The syntax for Decimal: https://github.com/metaborg/metac/blob/basec/BaseC/syntax/BaseC-Constants.tmpl
Several other ‘parse fails’ tests also accept programs that it should not accept.I’ve seen this behavior in other Spoofax editors in nightly as well. If a small error is made, such as a missing or extra
;
in Stratego, it is shown as a comment in the editor and no error is reported. Maybe the error recovery is too aggressive in the new parser? The Stratego compiler does report the error though, maybe that uses a different parser?
The error recovery (correctly) decides to parse the erroneous character as layout (WATER production). However, for some reason the recover production is not detected when the parsetree is further processed. This only occurs for WATER productions (skip substring by parsing as layout), not for INSERT productions (reduce token from empty string)
Fixed in r26016
Problem seems to be introduced by the changes in: TreeBuilder public Object buildTreeNode(ParseNode node) {…}.
Code is not easy to understand but I added some lines that seems to fix the problem.
Log in to post comments