public abstract class BaseRepairingTokenBuffer extends Object implements IRepairingTokenBuffer
Modifier and Type | Field and Description |
---|---|
protected ASToken |
eofToken |
protected List<SyntaxProblem> |
errors |
protected boolean |
insertSemis |
protected boolean |
nextIsSemicolon |
protected int |
position |
protected static ASToken |
SEMICOLON |
Constructor and Description |
---|
BaseRepairingTokenBuffer(String sourcePath) |
Modifier and Type | Method and Description |
---|---|
void |
addError(SyntaxProblem error)
Adds a syntax error that we encountered during parsing
|
int |
LA(int i)
Looks ahead an arbitrary distance and returns back the token type.
|
ASToken |
lookAheadSkipInsertedSemicolon()
Get the first non-fix-up-semicolon from the look-ahead.
|
ASToken |
LT(int i)
Looks ahead an arbitrary distance and returns back the token.
|
int |
mark()
Marks the position in the underlying token buffer.
|
protected void |
onSemicolonInserted()
This method is called when an optional semicolon is inserted and is going
to be returned as the next token.
|
void |
setEnableSemicolonInsertion(boolean enable)
Enables or disables the insertion of semicolons
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
consume, insertSemicolon, matchOptionalSemicolon, previous, rewind
protected int position
protected ASToken eofToken
protected final List<SyntaxProblem> errors
protected boolean nextIsSemicolon
protected boolean insertSemis
protected static final ASToken SEMICOLON
public BaseRepairingTokenBuffer(String sourcePath)
public void setEnableSemicolonInsertion(boolean enable)
IRepairingTokenBuffer
setEnableSemicolonInsertion
in interface IRepairingTokenBuffer
enable
- true if we should insert semicolons into the token streamprotected final void onSemicolonInserted()
IRepairingTokenBuffer.insertSemicolon(boolean)
.public void addError(SyntaxProblem error)
IRepairingTokenBuffer
addError
in interface IRepairingTokenBuffer
error
- the SyntaxProblem
to addpublic final int mark()
IRepairingTokenBuffer
mark
in interface IRepairingTokenBuffer
public ASToken LT(int i)
IRepairingTokenBuffer
LT
in interface IRepairingTokenBuffer
i
- the offset to look aheadpublic ASToken lookAheadSkipInsertedSemicolon()
IRepairingTokenBuffer
lookAheadSkipInsertedSemicolon
in interface IRepairingTokenBuffer
public final int LA(int i)
IRepairingTokenBuffer
LA
in interface IRepairingTokenBuffer
i
- the offset to look aheadCopyright © 2016 The Apache Software Foundation. All rights reserved.