Allow optionsSpec at the beginning of a lexer block

This commit is contained in:
Sam Harwell 2012-10-14 11:57:34 -05:00
parent c68c058280
commit b3b1a3750d
2 changed files with 12 additions and 3 deletions

View File

@ -595,8 +595,17 @@ labeledLexerElement
;
lexerBlock
: LPAREN lexerAltList RPAREN
-> ^(BLOCK<BlockAST>[$LPAREN,"BLOCK"] lexerAltList )
@after {
GrammarAST options = (GrammarAST)$tree.getFirstChildWithType(ANTLRParser.OPTIONS);
if ( options!=null ) {
Grammar.setNodeOptions($tree, options);
}
}
: LPAREN
( optionsSpec COLON )?
lexerAltList
RPAREN
-> ^(BLOCK<BlockAST>[$LPAREN,"BLOCK"] optionsSpec? lexerAltList )
;
// channel=HIDDEN, skip, more, mode(INSIDE), push(INSIDE), pop

View File

@ -381,7 +381,7 @@ labeledLexerElement
;
lexerBlock
: ^(BLOCK lexerAlternative+)
: ^(BLOCK optionsSpec? lexerAlternative+)
;
lexerAtom