org.eclipse.xtext.parser.antlr
Class TokenTool
java.lang.Object
org.eclipse.xtext.parser.antlr.TokenTool
public class TokenTool
- extends java.lang.Object
- Author:
- Sven Efftinge - Initial contribution and API
Method Summary |
static int |
getLength(org.antlr.runtime.Token t)
|
static java.lang.String |
getLexerRuleName(java.lang.String antlrTokenDef)
|
static int |
getLine(org.antlr.runtime.Token t)
|
static int |
getOffset(org.antlr.runtime.Token t)
|
static java.lang.String |
getText(org.antlr.runtime.Token t)
|
static boolean |
isLexerRule(java.lang.String antlrTokenDef)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LEXER_RULE_PREFIX
public static final java.lang.String LEXER_RULE_PREFIX
- See Also:
- Constant Field Values
TokenTool
public TokenTool()
getText
public static java.lang.String getText(org.antlr.runtime.Token t)
- Parameters:
t
- the token
- Returns:
- the parsed text or
null
if the Token
t was null
or the token's text was null
.
getLine
public static int getLine(org.antlr.runtime.Token t)
- Parameters:
t
- the token
- Returns:
- the line of the token or
-1
if the Token
t was null
or the token did not provide line information.
getOffset
public static int getOffset(org.antlr.runtime.Token t)
- Parameters:
t
- the token
- Returns:
- the offset of the token or
-1
if the Token
t was null
or the token did not provide offset information.
getLength
public static int getLength(org.antlr.runtime.Token t)
- Parameters:
t
- the token
- Returns:
- the length of the token or
0
if the Token
t was null
or the token did not provide line information.
isLexerRule
public static boolean isLexerRule(java.lang.String antlrTokenDef)
getLexerRuleName
public static java.lang.String getLexerRuleName(java.lang.String antlrTokenDef)