public abstract class TokenBase extends antlr.Token implements ICMToken, ISourceLocation
badToken, EOF_TYPE, INVALID_TYPE, MIN_USER_TYPE, NULL_TREE_LOOKAHEAD, SKIP, type
UNKNOWN
Constructor and Description |
---|
TokenBase(int tokenType,
int start,
int end,
int line,
int column,
CharSequence text)
Constructor
|
TokenBase(TokenBase o)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
void |
adjustLocation(int offsetAdjustment,
int lineAdjustment,
int columnAdjustment)
Adjust all associated offsets by the adjustment amount
|
void |
adjustOffsets(int offsetAdjustment)
Adjust all associated offsets by the adjustment amount
|
int |
getAbsoluteEnd()
Gets the absolute starting offset.
|
int |
getAbsoluteStart()
Gets the absolute starting offset.
|
CharSequence |
getCharSequence()
Returns the underlying CharSequence that represents the contents of this
token
|
int |
getColumn()
Returns the column of this token.
|
int |
getEnd()
Returns the end offset of this token
|
int |
getEndColumn()
Gets the local column number at the end.
|
int |
getEndLine()
Gets the local line number at the end.
|
int |
getLine()
Returns the line of this token..
|
int |
getLocalEnd() |
int |
getLocalStart() |
String |
getSourcePath()
Get the source file path of the node.
|
int |
getStart()
Returns the start offset of this token
|
String |
getText()
Get the text represented by this token
|
protected abstract String |
getTypeString() |
boolean |
isImplicit()
Determine whether or not this token is bogus (i.e. the start and end
offsets are the same, which implies that it was inserted from an included
file or during token fixup)
|
boolean |
isLocked()
Returns whether this token can be overwritten when it is a member of a
token pool
|
void |
lock()
Locks this token.
|
boolean |
matchesLine(TokenBase other) |
void |
reuse(int tokenType,
int start,
int end,
int line,
int column,
CharSequence text) |
void |
setColumn(int column) |
void |
setEnd(int end) |
void |
setEndColumn(int column) |
void |
setEndLine(int line) |
void |
setLine(int line) |
void |
setLocation(int start,
int end,
int line,
int column) |
void |
setSourcePath(String path) |
void |
setStart(int start) |
void |
setText(CharSequence text)
Set the CharSequence represented by this token
|
void |
setText(String text)
Set the text represented by this token
|
void |
storeLocalOffset()
Capture the current start/end offsets as this token's local offsets.
|
String |
toDumpString()
For debugging only.
|
String |
toString()
For debugging only.
|
void |
truncate(int trimLeft,
int trimRight)
Reduce the span of the token by removing characters from the beginning
and end.
|
boolean |
verify()
Verifies that this token has its type and location information set.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
changeType, getType
public TokenBase(int tokenType, int start, int end, int line, int column, CharSequence text)
tokenType
- type of tokenstart
- location location informationend
- location location informationline
- location location informationcolumn
- location location informationtext
- actual text represented by tokenpublic TokenBase(TokenBase o)
o
- token to copyprotected abstract String getTypeString()
public final int getLocalStart()
public final int getLocalEnd()
public final void reuse(int tokenType, int start, int end, int line, int column, CharSequence text)
public void lock()
public boolean isLocked()
public String getText()
public CharSequence getCharSequence()
CharSequence
or nullpublic void setText(String text)
setText
in class antlr.Token
text
- text represented by this tokenToken.setText(java.lang.String)
public void setText(CharSequence text)
text
- text represented by this tokenpublic void setLocation(int start, int end, int line, int column)
public int getStart()
ICMToken
getStart
in interface ISourceLocation
getStart
in interface ICMToken
public void setStart(int start)
public int getEnd()
ICMToken
getEnd
in interface ISourceLocation
getEnd
in interface ICMToken
public void setEnd(int end)
public int getLine()
ICMToken
getLine
in interface ISourceLocation
getLine
in interface ICMToken
getLine
in class antlr.Token
public void setLine(int line)
setLine
in class antlr.Token
public final boolean matchesLine(TokenBase other)
public int getColumn()
ICMToken
getColumn
in interface ISourceLocation
getColumn
in interface ICMToken
getColumn
in class antlr.Token
public void setColumn(int column)
setColumn
in class antlr.Token
public int getEndLine()
ISourceLocation
getEndLine
in interface ISourceLocation
public void setEndLine(int line)
public int getEndColumn()
ISourceLocation
getEndColumn
in interface ISourceLocation
public void setEndColumn(int column)
public boolean isImplicit()
isImplicit
in interface ICMToken
public String toString()
toString
in class antlr.Token
public String toDumpString()
public void truncate(int trimLeft, int trimRight)
trimLeft
- number of characters to remove from the left of the tokentrimRight
- number of characters to remove from the right of the
tokenpublic void adjustOffsets(int offsetAdjustment)
offsetAdjustment
- amount to add to offsetspublic void adjustLocation(int offsetAdjustment, int lineAdjustment, int columnAdjustment)
offsetAdjustment
- amount to add to offsetslineAdjustment
- amount to add to the line numbercolumnAdjustment
- amount to add to the column numberpublic final void storeLocalOffset()
StreamingASTokenizer#nextTokenFromReader()
after the token is initialized, and before being updated by
IncludeHandler.onNextToken(org.apache.flex.compiler.internal.parsing.as.ASToken)
.public final String getSourcePath()
ICMToken
The source path will be copied to ISourceLocation.getSourcePath()
during
tree construction.
getSourcePath
in interface ISourceLocation
getSourcePath
in interface ICMToken
public final void setSourcePath(String path)
public boolean verify()
This is used only in asserts.
public int getAbsoluteEnd()
ISourceLocation
getAbsoluteEnd
in interface ISourceLocation
public int getAbsoluteStart()
ISourceLocation
getAbsoluteStart
in interface ISourceLocation
Copyright © 2016 The Apache Software Foundation. All rights reserved.