diff --git a/tool/src/org/antlr/v4/parse/BlockSetTransformer.g b/tool/src/org/antlr/v4/parse/BlockSetTransformer.g index b646a4de6..4761ddc2f 100644 --- a/tool/src/org/antlr/v4/parse/BlockSetTransformer.g +++ b/tool/src/org/antlr/v4/parse/BlockSetTransformer.g @@ -23,7 +23,6 @@ import org.antlr.v4.runtime.misc.IntervalSet; @members { public String currentRuleName; public GrammarAST currentAlt; -public Set rewriteElems = new HashSet(); public Grammar g; public BlockSetTransformer(TreeNodeStream input, Grammar g) { this(input, new RecognizerSharedState()); @@ -40,7 +39,7 @@ topdown setAlt : {inContext("RULE BLOCK")}? - ALT {currentAlt = $start; rewriteElems.clear();} + ALT {currentAlt = $start;} ; // (BLOCK (ALT (+ (BLOCK (ALT INT) (ALT ID))))) @@ -74,8 +73,7 @@ setElement[boolean inLexer] @after { GrammarTransformPipeline.setGrammarPtr(g, $tree); } - : {!rewriteElems.contains($start.getText())}? - ( a=STRING_LITERAL {!inLexer || CharSupport.getCharValueFromGrammarCharLiteral($a.getText())!=-1}? + : ( a=STRING_LITERAL {!inLexer || CharSupport.getCharValueFromGrammarCharLiteral($a.getText())!=-1}? | {!inLexer}?=> TOKEN_REF | {inLexer}?=> ^(RANGE a=STRING_LITERAL b=STRING_LITERAL) {CharSupport.getCharValueFromGrammarCharLiteral($a.getText())!=-1 &&