| java.lang.Object org.antlr.runtime.ANTLRStringStream
All known Subclasses: org.antlr.runtime.ANTLRFileStream, org.antlr.runtime.ANTLRReaderStream,
ANTLRStringStream | public class ANTLRStringStream implements CharStream(Code) | | A pretty quick CharStream that pulls all data from an array
directly. Every method call counts in the lexer. Java's
strings aren't very good so I'm avoiding.
|
Field Summary | |
protected int | charPositionInLine | protected char[] | data | protected int | lastMarker Track the last mark() call result value for use in rewind(). | protected int | line | protected int | markDepth | protected List | markers A list of CharStreamState objects that tracks the stream state
values line, charPositionInLine, and p that can change as you
move through the input stream. | protected int | n | protected int | p |
Method Summary | |
public int | LA(int i) | public int | LT(int i) | public void | consume() | public int | getCharPositionInLine() | public int | getLine() | public int | index() Return the current input symbol index 0..n where n indicates the
last symbol has been read. | public int | mark() | public void | release(int marker) | public void | reset() Reset the stream so that it's in the same state it was
when the object was created *except* the data array is not
touched. | public void | rewind(int m) | public void | rewind() | public void | seek(int index) consume() ahead until p==index; can't just set p=index as we must
update line and charPositionInLine. | public void | setCharPositionInLine(int pos) | public void | setLine(int line) | public int | size() | public String | substring(int start, int stop) |
charPositionInLine | protected int charPositionInLine(Code) | | The index of the character relative to the beginning of the line 0..n-1
|
data | protected char[] data(Code) | | The data being scanned
|
lastMarker | protected int lastMarker(Code) | | Track the last mark() call result value for use in rewind().
|
line | protected int line(Code) | | line number 1..n within the input
|
markDepth | protected int markDepth(Code) | | tracks how deep mark() calls are nested
|
markers | protected List markers(Code) | | A list of CharStreamState objects that tracks the stream state
values line, charPositionInLine, and p that can change as you
move through the input stream. Indexed from 1..markDepth.
A null is kept @ index 0. Create upon first call to mark().
|
n | protected int n(Code) | | How many characters are actually in the buffer
|
p | protected int p(Code) | | 0..n-1 index into string of next char
|
ANTLRStringStream | public ANTLRStringStream()(Code) | | |
ANTLRStringStream | public ANTLRStringStream(String input)(Code) | | Copy data in string to a local char array
|
ANTLRStringStream | public ANTLRStringStream(char[] data, int numberOfActualCharsInArray)(Code) | | This is the preferred constructor as no data is copied
|
consume | public void consume()(Code) | | |
getCharPositionInLine | public int getCharPositionInLine()(Code) | | |
getLine | public int getLine()(Code) | | |
index | public int index()(Code) | | Return the current input symbol index 0..n where n indicates the
last symbol has been read. The index is the index of char to
be returned from LA(1).
|
release | public void release(int marker)(Code) | | |
reset | public void reset()(Code) | | Reset the stream so that it's in the same state it was
when the object was created *except* the data array is not
touched.
|
rewind | public void rewind(int m)(Code) | | |
rewind | public void rewind()(Code) | | |
seek | public void seek(int index)(Code) | | consume() ahead until p==index; can't just set p=index as we must
update line and charPositionInLine.
|
setCharPositionInLine | public void setCharPositionInLine(int pos)(Code) | | |
setLine | public void setLine(int line)(Code) | | |
|
|