public class RepairingTokenBuffer extends BaseRepairingTokenBuffer implements IRepairingTokenBuffer
eofToken, errors, insertSemis, nextIsSemicolon, position, SEMICOLON
Constructor and Description |
---|
RepairingTokenBuffer(ASToken[] tokens)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
consume()
Consumes the current token in the buffer
|
IASToken[] |
getTokens(boolean includeInserted)
Get all the tokens in this buffer.
|
boolean |
insertSemicolon(boolean isNextToken)
Inserts a semicolon into the token stream
|
protected ASToken |
lookAheadSkipInsertedSemicolon(int i)
Look-ahead "i" tokens and ignore
BaseRepairingTokenBuffer.insertSemis flag. |
boolean |
matchOptionalSemicolon()
If we don't have the optional semicolon, always insert it.
|
ASToken |
previous()
Returns the previous token the buffer was looking at
|
void |
rewind(int position)
Rewinds the token buffer to the given position.
|
addError, LA, lookAheadSkipInsertedSemicolon, LT, mark, onSemicolonInserted, setEnableSemicolonInsertion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addError, LA, lookAheadSkipInsertedSemicolon, LT, mark, setEnableSemicolonInsertion
public RepairingTokenBuffer(ASToken[] tokens)
tokens
- list of ASTokens (or any subclass of antlr.Token)public final boolean insertSemicolon(boolean isNextToken)
IRepairingTokenBuffer
insertSemicolon
in interface IRepairingTokenBuffer
isNextToken
- true if the semicolon should be the next tokenpublic final void rewind(int position)
IRepairingTokenBuffer
rewind
in interface IRepairingTokenBuffer
position
- the non-negative positionpublic final void consume()
IRepairingTokenBuffer
consume
in interface IRepairingTokenBuffer
protected final ASToken lookAheadSkipInsertedSemicolon(int i)
BaseRepairingTokenBuffer
BaseRepairingTokenBuffer.insertSemis
flag. Subclasses
provide implementations specific to how they access the token buffer.public IASToken[] getTokens(boolean includeInserted)
includeInserted
- True if automatically inserted semicolons are
included in the result.public ASToken previous()
IRepairingTokenBuffer
previous
in interface IRepairingTokenBuffer
public boolean matchOptionalSemicolon()
StreamingTokenBuffer.matchOptionalSemicolon()
in order to appease
code model.matchOptionalSemicolon
in interface IRepairingTokenBuffer
Copyright © 2016 The Apache Software Foundation. All rights reserved.