antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.22k stars 3.71k forks source link

[java20] Fix for identifiers #4209 #4229

Closed kaby76 closed 2 months ago

kaby76 commented 2 months ago

This PR corrects occurrences of Identifier, which was done incorrectly. As stated in the Spec, Identifier is a "IdentifierChars but not a ReservedKeyword or BooleanLiteral or NullLiteral". But it should include generally ContexualKeyword. Antlr does not have a "not"-operator for parser grammars, so the rule must be refactored as what can be included. A Keyword is a "ReservedKeyword | ContextualKeyword." This PR defines contextualKeyword and subsets, which are used in a couple of places.

teverett commented 2 months ago

@kaby76 thanks