forked from jasder/antlr
fix so tokens { A, B } Actually defines them.
This commit is contained in:
parent
670b20a5cb
commit
4e84ae28a2
|
@ -151,7 +151,10 @@ public class SemanticPipeline {
|
||||||
void assignLexerTokenTypes(Grammar g, List<GrammarAST> tokensDefs) {
|
void assignLexerTokenTypes(Grammar g, List<GrammarAST> tokensDefs) {
|
||||||
Grammar G = g.getOutermostGrammar(); // put in root, even if imported
|
Grammar G = g.getOutermostGrammar(); // put in root, even if imported
|
||||||
for (GrammarAST def : tokensDefs) {
|
for (GrammarAST def : tokensDefs) {
|
||||||
if ( def.getType()== ANTLRParser.TOKEN_REF ) G.defineTokenName(def.getText());
|
// tokens { id (',' id)* } so must check IDs not TOKEN_REF
|
||||||
|
if ( Grammar.isTokenName(def.getText()) ) {
|
||||||
|
G.defineTokenName(def.getText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define token types for nonfragment rules which do not include a 'type(...)'
|
/* Define token types for nonfragment rules which do not include a 'type(...)'
|
||||||
|
|
Loading…
Reference in New Issue