转自StackOverflow,原问题 https://stackoverflow.com/questions/6005898/antlr-members-and-lexer
最佳回答:
In a combined grammar file, @members
is a short-hand for @parser::members
.
// combined grammar
grammar Foo;
@members {
// only parser members here, equivalent to: @parser::members { ... }
}
@lexer::members {
// lexer members
}
When you use separate lexer- and/or parser grammars, then @members
is enough:
parser grammar Foo;
@members {
// parser members
}
or
lexer grammar Foo;
@members {
// lexer members
}
Galmi wrote:
Btw. is stackoverflow inline code work‘s for Opera?
I guess so, but questions about SO itself can be asked on SO-Meta.