diff --git a/tool/src/org/antlr/v4/parse/ANTLRParser.g b/tool/src/org/antlr/v4/parse/ANTLRParser.g index 401baba2c..23fa59af5 100644 --- a/tool/src/org/antlr/v4/parse/ANTLRParser.g +++ b/tool/src/org/antlr/v4/parse/ANTLRParser.g @@ -595,8 +595,17 @@ labeledLexerElement ; lexerBlock - : LPAREN lexerAltList RPAREN - -> ^(BLOCK[$LPAREN,"BLOCK"] lexerAltList ) +@after { +GrammarAST options = (GrammarAST)$tree.getFirstChildWithType(ANTLRParser.OPTIONS); +if ( options!=null ) { + Grammar.setNodeOptions($tree, options); +} +} + : LPAREN + ( optionsSpec COLON )? + lexerAltList + RPAREN + -> ^(BLOCK[$LPAREN,"BLOCK"] optionsSpec? lexerAltList ) ; // channel=HIDDEN, skip, more, mode(INSIDE), push(INSIDE), pop diff --git a/tool/src/org/antlr/v4/parse/GrammarTreeVisitor.g b/tool/src/org/antlr/v4/parse/GrammarTreeVisitor.g index ba6f0982e..f41ac29e8 100644 --- a/tool/src/org/antlr/v4/parse/GrammarTreeVisitor.g +++ b/tool/src/org/antlr/v4/parse/GrammarTreeVisitor.g @@ -381,7 +381,7 @@ labeledLexerElement ; lexerBlock - : ^(BLOCK lexerAlternative+) + : ^(BLOCK optionsSpec? lexerAlternative+) ; lexerAtom