|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.antlr.runtime.misc.FastQueue<T>
org.antlr.runtime.misc.LookaheadStream<Token>
org.antlr.runtime.UnbufferedTokenStream
public class UnbufferedTokenStream
A token stream that pulls tokens from the code source on-demand and without tracking a complete buffer of the tokens. This stream buffers the minimum number of tokens possible. It's the same as OnDemandTokenStream except that OnDemandTokenStream buffers all tokens. You can't use this stream if you pass whitespace or other off-channel tokens to the parser. The stream can't ignore off-channel tokens. You can only look backwards 1 token: LT(-1). Use this when you need to read from a socket or other infinite stream.
BufferedTokenStream
,
CommonTokenStream
Field Summary | |
---|---|
protected int |
channel
Skip tokens on any channel but this one; this is how we skip whitespace... |
protected int |
tokenIndex
|
protected TokenSource |
tokenSource
|
Fields inherited from class org.antlr.runtime.misc.LookaheadStream |
---|
currentElementIndex, eof, lastMarker, markDepth, prevElement, UNINITIALIZED_EOF_ELEMENT_INDEX |
Fields inherited from class org.antlr.runtime.misc.FastQueue |
---|
data, p, range |
Constructor Summary | |
---|---|
UnbufferedTokenStream(TokenSource tokenSource)
|
Method Summary | |
---|---|
Token |
get(int i)
Get a token at an absolute index i; 0..n-1. |
String |
getSourceName()
Where are you getting symbols from? Normally, implementations will pass the buck all the way to the lexer who can ask its input stream for the file name or whatever. |
TokenSource |
getTokenSource()
Where is this stream pulling tokens from? This is not the name, but the object that provides Token objects. |
boolean |
isEOF(Token o)
|
int |
LA(int i)
Get int at current input pointer + i ahead where i=1 is next int. |
Token |
nextElement()
Implement nextElement to supply a stream of elements to this lookahead buffer. |
String |
toString(int start,
int stop)
Return the text of all tokens from start to stop, inclusive. |
String |
toString(Token start,
Token stop)
Because the user is not required to use a token with an index stored in it, we must provide a means for two token objects themselves to indicate the start/end location. |
Methods inherited from class org.antlr.runtime.misc.LookaheadStream |
---|
consume, fill, index, LB, LT, mark, release, remove, reset, rewind, rewind, seek, size, syncAhead |
Methods inherited from class org.antlr.runtime.misc.FastQueue |
---|
add, clear, elementAt, head, range, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.antlr.runtime.TokenStream |
---|
LT, range |
Methods inherited from interface org.antlr.runtime.IntStream |
---|
consume, index, mark, release, rewind, rewind, seek, size |
Field Detail |
---|
protected TokenSource tokenSource
protected int tokenIndex
protected int channel
Constructor Detail |
---|
public UnbufferedTokenStream(TokenSource tokenSource)
Method Detail |
---|
public Token nextElement()
LookaheadStream
nextElement
in class LookaheadStream<Token>
public boolean isEOF(Token o)
isEOF
in class LookaheadStream<Token>
public TokenSource getTokenSource()
TokenStream
getTokenSource
in interface TokenStream
public String toString(int start, int stop)
TokenStream
toString
in interface TokenStream
public String toString(Token start, Token stop)
TokenStream
toString
in interface TokenStream
public int LA(int i)
IntStream
LA
in interface IntStream
public Token get(int i)
TokenStream
get
in interface TokenStream
public String getSourceName()
IntStream
getSourceName
in interface IntStream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |