public final class StreamingTokenBuffer extends BaseRepairingTokenBuffer implements IRepairingTokenBuffer
eofToken, errors, insertSemis, nextIsSemicolon, position, SEMICOLON
Constructor and Description |
---|
StreamingTokenBuffer(StreamingASTokenizer tokens) |
Modifier and Type | Method and Description |
---|---|
void |
consume()
Consumes the current token in the buffer
|
String |
getSourcePath() |
IASToken[] |
getTokens(boolean includeInserted) |
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()
Match optional semicolon.
|
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 StreamingTokenBuffer(StreamingASTokenizer tokens)
public String getSourcePath()
public final boolean insertSemicolon(boolean isNextToken)
IRepairingTokenBuffer
insertSemicolon
in interface IRepairingTokenBuffer
isNextToken
- true if the semicolon should be the next tokenpublic void rewind(int position)
IRepairingTokenBuffer
rewind
in interface IRepairingTokenBuffer
position
- the non-negative positionpublic final void consume()
IRepairingTokenBuffer
consume
in interface IRepairingTokenBuffer
protected ASToken lookAheadSkipInsertedSemicolon(int i)
BaseRepairingTokenBuffer
BaseRepairingTokenBuffer.insertSemis
flag. Subclasses
provide implementations specific to how they access the token buffer.public IASToken[] getTokens(boolean includeInserted)
public ASToken previous()
IRepairingTokenBuffer
previous
in interface IRepairingTokenBuffer
public boolean matchOptionalSemicolon()
This function implements the first 2 optional semicolon insertion rules in the ECMA specification.
matchOptionalSemicolon
in interface IRepairingTokenBuffer
Copyright © 2016 The Apache Software Foundation. All rights reserved.