Closed kaby76 closed 1 year ago
This can be closed since the grammar has been updated (and the issue was also resolved along the way): https://github.com/antlr/grammars-v4/pull/3690
This will be fixed with merge of https://github.com/antlr/grammars-v4/pull/3690.
According to this, the priority of
backreference
should be moved to the top in order to parse octal literals correctly.Note, in my opinion, I don't think the suggested fix is correct. The problem is that the grammar is ambiguous. Just because Antlr4 allows you to fix ambiguity by alt reordering does not mean you should.
_There's an extra level of complexity with the rule
atom
with the addition of "shared_literal", "sharedatom", "literal", etc. The result is that ambiguity.I would have kept atom flat with respect to the "shared" rules, i.e., unfold these rules into "atom" then remove the ambiguity--and not by reordering the alts.