You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
40 lines
1.3 KiB
package com.fr.third.antlr; |
|
|
|
/* ANTLR Translator Generator |
|
* Project led by Terence Parr at http://www.cs.usfca.edu |
|
* Software rights: http://www.antlr.org/license.html |
|
* |
|
* $Id: //depot/code/org.antlr/release/antlr-2.7.7/antlr/TokenRefElement.java#2 $ |
|
*/ |
|
|
|
class TokenRefElement extends GrammarAtom { |
|
|
|
public TokenRefElement(Grammar g, |
|
Token t, |
|
boolean inverted, |
|
int autoGenType) { |
|
super(g, t, autoGenType); |
|
not = inverted; |
|
TokenSymbol ts = grammar.tokenManager.getTokenSymbol(atomText); |
|
if (ts == null) { |
|
g.antlrTool.error("Undefined token symbol: " + |
|
atomText, grammar.getFilename(), t.getLine(), t.getColumn()); |
|
} |
|
else { |
|
tokenType = ts.getTokenType(); |
|
// set the AST node type to whatever was set in tokens {...} |
|
// section (if anything); |
|
// Lafter, after this is created, the element option can set this. |
|
setASTNodeType(ts.getASTNodeType()); |
|
} |
|
line = t.getLine(); |
|
} |
|
|
|
public void generate() { |
|
grammar.generator.gen(this); |
|
} |
|
|
|
public Lookahead look(int k) { |
|
return grammar.theLLkAnalyzer.look(k, this); |
|
} |
|
}
|
|
|