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.IntStream
public int LA(int i)
LA
in interface org.antlr.runtime.IntStream
public int LT(int i)
LT
in interface org.antlr.runtime.CharStream
public int index()
index
in interface org.antlr.runtime.IntStream
public int size()
size
in interface org.antlr.runtime.IntStream
public int mark()
mark
in interface org.antlr.runtime.IntStream
public void rewind(int m)
rewind
in interface org.antlr.runtime.IntStream
public void rewind()
rewind
in interface org.antlr.runtime.IntStream
public void release(int marker)
release
in interface org.antlr.runtime.IntStream
public void seek(int index)
seek
in interface org.antlr.runtime.IntStream
public String substring(int start, int stop)
substring
in interface org.antlr.runtime.CharStream
public int getLine()
getLine
in interface org.antlr.runtime.CharStream
public int getCharPositionInLine()
getCharPositionInLine
in interface org.antlr.runtime.CharStream
public void setLine(int line)
setLine
in interface org.antlr.runtime.CharStream
public void setCharPositionInLine(int pos)
setCharPositionInLine
in interface org.antlr.runtime.CharStream
public String getSourceName()
getSourceName
in interface org.antlr.runtime.IntStream
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.