Skip to content

Commit

Permalink
efx-grammar: Remove unneeded alternative in a parser rule (TEDEFO-3718)
Browse files Browse the repository at this point in the history
In the fieldReference parser rule, having a direct reference to
fieldReferenceWithFieldContextOverride is not needed, because
fieldReferenceInOtherNotice can also match it with a chain of rules.

So removing this unneeded reference removes the ambiguity in the
rule, which reduces the parsing time, as the parser does not spend
time looking ahead and then backtracking.

This does not change the result of the translation.
  • Loading branch information
bertrand-lorentz committed Sep 10, 2024
1 parent 9b9e82b commit 6ca5b0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion efx-grammar/Efx.g4
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ contextVariableSpecifier: variable=variableReference ColonColon;
* It looks more "complicated" but it is necessary for parsing (see fieldReferenceWithFieldContextOverride).
*/
attributeReference:fieldReference SlashAt Identifier;
fieldReference: fieldReferenceWithFieldContextOverride | fieldReferenceInOtherNotice | absoluteFieldReference;
fieldReference: fieldReferenceInOtherNotice | absoluteFieldReference;
fieldReferenceInOtherNotice: (noticeReference Slash)? reference=fieldReferenceWithVariableContextOverride;
fieldReferenceWithVariableContextOverride: contextVariableSpecifier? reference=fieldReferenceWithNodeContextOverride;
fieldReferenceWithNodeContextOverride: contextNodeSpecifier? reference=fieldReferenceWithFieldContextOverride;
Expand Down

0 comments on commit 6ca5b0a

Please sign in to comment.