public class ParserStringStream extends Object implements org.antlr.runtime.CharStream
ANTLRStringStream, but uses a String as a storage
for input.
ANTLRStringStream uses a char array, motivation was to not hold a
reference to the whole input (substring method). As we hold the full source
in parsed expressions anyway, it is more effective to use this class and not
ANTLRStringStream.
| Constructor and Description |
|---|
ParserStringStream(String input) |
| Modifier and Type | Method and Description |
|---|---|
void |
consume() |
int |
getCharPositionInLine() |
int |
getLine() |
String |
getSourceName() |
int |
index()
Return the current input symbol index 0..n where n indicates the last
symbol has been read.
|
int |
LA(int i) |
int |
LT(int i) |
int |
mark() |
void |
release(int marker) |
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.
|
void |
rewind() |
void |
rewind(int m) |
void |
seek(int index)
consume() ahead until p==index; can't just set p=index as we must update
line and charPositionInLine.
|
void |
setCharPositionInLine(int pos) |
void |
setLine(int line) |
int |
size() |
String |
substring(int start,
int stop) |
public ParserStringStream(String input)
input - public void reset()
public void consume()
consume in interface org.antlr.runtime.IntStreampublic int LA(int i)
LA in interface org.antlr.runtime.IntStreampublic int LT(int i)
LT in interface org.antlr.runtime.CharStreampublic int index()
index in interface org.antlr.runtime.IntStreampublic int size()
size in interface org.antlr.runtime.IntStreampublic int mark()
mark in interface org.antlr.runtime.IntStreampublic void rewind(int m)
rewind in interface org.antlr.runtime.IntStreampublic void rewind()
rewind in interface org.antlr.runtime.IntStreampublic void release(int marker)
release in interface org.antlr.runtime.IntStreampublic void seek(int index)
seek in interface org.antlr.runtime.IntStreampublic String substring(int start, int stop)
substring in interface org.antlr.runtime.CharStreampublic int getLine()
getLine in interface org.antlr.runtime.CharStreampublic int getCharPositionInLine()
getCharPositionInLine in interface org.antlr.runtime.CharStreampublic void setLine(int line)
setLine in interface org.antlr.runtime.CharStreampublic void setCharPositionInLine(int pos)
setCharPositionInLine in interface org.antlr.runtime.CharStreampublic String getSourceName()
getSourceName in interface org.antlr.runtime.IntStreamCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.