| Modifier and Type | Field and Description |
|---|---|
| protected int | currentTokenIndex
Absolute token index. |
| protected Token | lastToken
This is the |
| protected Token | lastTokenBufferStart
When |
| protected int | |
| protected int | |
| protected int | |
| protected Token[] | tokens
A moving window buffer of the data being scanned. |
| protected TokenSource |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public void | consume()
Implements org. |
| protected int | |
| public Token | get(int i)
Implements org. Token at the specified index in the stream.
|
| protected final int | |
| public String | getSourceName()
Implements org. |
| public String | getText()
Implements org. |
| public String | getText(RuleContext
The context providing the source interval of tokens to get
text for. ctx)Implements org. |
| public String | getText(Token
The first token in the interval to get text for. start, Token The last token in the interval to get text for (inclusive). stop)Implements org. start and
stop (inclusive).
|
| public String | getText(Interval
The interval of tokens within this stream to get text
for. interval)Implements org. interval.
|
| public TokenSource | getTokenSource()
Implements org. TokenSource which provides tokens for this
stream.
|
| public int | index()
Implements org. LA(1).
|
| public int | LA(int i)
Implements org. i from the current
position.
|
| public Token | LT(int i)
Implements org. Token instance associated with the value returned by
LA(k).
|
| public int | |
| public void | release(int
A marker returned by a call to marker)mark().Implements org. mark().
|
| public void | seek(int
The absolute index to seek to. index)Implements org. index.
|
| public int | size()
Implements org. |
| protected void |
| currentTokenIndex | back to summary |
|---|---|
| protected int currentTokenIndex Absolute token index. It's the index of the token about to be read via
This value is used to set the token indexes if the stream provides tokens
that implement | |
| lastToken | back to summary |
|---|---|
| protected Token lastToken This is the | |
| lastTokenBufferStart | back to summary |
|---|---|
| protected Token lastTokenBufferStart When | |
| n | back to summary |
|---|---|
| protected int n The number of tokens currently in This is not the buffer capacity, that's | |
| numMarkers | back to summary |
|---|---|
| protected int numMarkers Count up with | |
| p | back to summary |
|---|---|
| protected int p 0..n-1 index into The | |
| tokens | back to summary |
|---|---|
| protected Token[] tokens A moving window buffer of the data being scanned. While there's a marker,
we keep adding to buffer. Otherwise, | |
| tokenSource | back to summary |
|---|---|
| protected TokenSource tokenSource | |
| UnbufferedTokenStream | back to summary |
|---|---|
| public UnbufferedTokenStream(TokenSource tokenSource) | |
| UnbufferedTokenStream | back to summary |
|---|---|
| public UnbufferedTokenStream(TokenSource tokenSource, int bufferSize) | |
| add | back to summary |
|---|---|
| protected void add(Token t) | |
| consume | back to summary |
|---|---|
| public void consume() Implements org. Doc from org. Consumes the current symbol in the stream. This method has the following effects:
index() is
incremented by exactly 1, as that would preclude the ability to implement
filtering streams (e.g. CommonTokenStream which distinguishes
between "on-channel" and "off-channel" tokens).
| |
| fill | back to summary |
|---|---|
| protected int fill(int n) Add | |
| get | back to summary |
|---|---|
| public Token get(int i) Implements org. Doc from org. Gets the The preconditions for this method are the same as the preconditions of
The symbol referred to by
| |
| getBufferStartIndex | back to summary |
|---|---|
| protected final int getBufferStartIndex() | |
| getSourceName | back to summary |
|---|---|
| public String getSourceName() Implements org. Doc from org. Gets the name of the underlying symbol source. This method returns a
non-null, non-empty string. If such a name is not known, this method
returns
| |
| getText | back to summary |
|---|---|
| public String getText() Implements org. Doc from org. Return the text of all tokens in the stream. This method behaves like the
following code, including potential exceptions from the calls to
TokenStream stream = ...; String text = stream.getText(new Interval(0, stream.size())); | |
| getText | back to summary |
|---|---|
| public String getText(RuleContext ctx) Implements org. Doc from org. Return the text of all tokens in the source interval of the specified
context. This method behaves like the following code, including potential
exceptions from the call to If TokenStream stream = ...; String text = stream.getText(ctx.getSourceInterval());
| |
| getText | back to summary |
|---|---|
| public String getText(Token start, Token stop) Implements org. Doc from org. Return the text of all tokens in this stream between If the specified For streams which ensure that the
TokenStream stream = ...;
String text = "";
for (int i = start.getTokenIndex(); i <= stop.getTokenIndex(); i++) {
text += stream.get(i).getText();
}
| |
| getText | back to summary |
|---|---|
| public String getText(Interval interval) Implements org. Doc from org. Return the text of all tokens within the specified
TokenStream stream = ...;
String text = "";
for (int i = interval.a; i <= interval.b; i++) {
text += stream.get(i).getText();
}
| |
| getTokenSource | back to summary |
|---|---|
| public TokenSource getTokenSource() Implements org. Doc from org. Gets the underlying
| |
| index | back to summary |
|---|---|
| public int index() Implements org. Doc from org. Return the index into the stream of the input symbol referred to by
The behavior of this method is unspecified if no call to an
| |
| LA | back to summary |
|---|---|
| public int LA(int i) Implements org. Doc from org. Gets the value of the symbol at offset This method is guaranteed to succeed if any of the following are true:
If The return value is unspecified if
| |
| LT | back to summary |
|---|---|
| public Token LT(int i) Implements org. Doc from org. Get the
| |
| mark | back to summary |
|---|---|
| public int mark() Implements org. Return a marker that we can release later. The specific marker value used for this class allows for some level of
protection against misuse where
| |
| release | back to summary |
|---|---|
| public void release(int marker) Implements org. Doc from org. This method releases a marked range created by a call to
For more information and an example, see
| |
| seek | back to summary |
|---|---|
| public void seek(int index) Implements org. Doc from org. Set the input cursor to the position indicated by
index
lies within a marked region. For more information on marked regions, see
mark. The behavior of this method is unspecified if no call to
an initializing method has occurred after this stream
was constructed.
| |
| size | back to summary |
|---|---|
| public int size() Implements org. Doc from org. Returns the total number of symbols in the stream, including a single EOF symbol.
| |
| sync | back to summary |
|---|---|
| protected void sync(int want) Make sure we have 'need' elements from current position | |