类 UnbufferedTokenStream
- java.lang.Object
-
- org.antlr.runtime.misc.FastQueue<T>
-
- org.antlr.runtime.misc.LookaheadStream<Token>
-
- org.antlr.runtime.UnbufferedTokenStream
-
- 所有已实现的接口:
IntStream,TokenStream
public class UnbufferedTokenStream extends LookaheadStream<Token> implements TokenStream
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.
-
-
字段概要
字段 修饰符和类型 字段 说明 protected intchannelSkip tokens on any channel but this one; this is how we skip whitespace...protected inttokenIndexprotected TokenSourcetokenSource-
从类继承的字段 org.antlr.runtime.misc.LookaheadStream
currentElementIndex, eof, lastMarker, markDepth, prevElement, UNINITIALIZED_EOF_ELEMENT_INDEX
-
-
构造器概要
构造器 构造器 说明 UnbufferedTokenStream(TokenSource tokenSource)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Tokenget(int i)Get a token at an absolute index i; 0..n-1.java.lang.StringgetSourceName()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.TokenSourcegetTokenSource()Where is this stream pulling tokens from? This is not the name, but the object that provides Token objects.booleanisEOF(Token o)intLA(int i)Get int at current input pointer + i ahead where i=1 is next int.TokennextElement()Implement nextElement to supply a stream of elements to this lookahead buffer.java.lang.StringtoString(int start, int stop)Return the text of all tokens from start to stop, inclusive.java.lang.StringtoString(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.-
从类继承的方法 org.antlr.runtime.misc.LookaheadStream
consume, fill, index, LB, LT, mark, release, remove, reset, rewind, rewind, seek, size, syncAhead
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
从接口继承的方法 org.antlr.runtime.TokenStream
LT, range
-
-
-
-
字段详细资料
-
tokenSource
protected TokenSource tokenSource
-
tokenIndex
protected int tokenIndex
-
channel
protected int channel
Skip tokens on any channel but this one; this is how we skip whitespace...
-
-
构造器详细资料
-
UnbufferedTokenStream
public UnbufferedTokenStream(TokenSource tokenSource)
-
-
方法详细资料
-
nextElement
public Token nextElement()
从类复制的说明:LookaheadStreamImplement nextElement to supply a stream of elements to this lookahead buffer. Return EOF upon end of the stream we're pulling from.- 指定者:
nextElement在类中LookaheadStream<Token>- 另请参阅:
LookaheadStream.isEOF(T)
-
isEOF
public boolean isEOF(Token o)
- 指定者:
isEOF在类中LookaheadStream<Token>
-
getTokenSource
public TokenSource getTokenSource()
从接口复制的说明:TokenStreamWhere is this stream pulling tokens from? This is not the name, but the object that provides Token objects.- 指定者:
getTokenSource在接口中TokenStream
-
toString
public java.lang.String toString(int start, int stop)从接口复制的说明:TokenStreamReturn the text of all tokens from start to stop, inclusive. If the stream does not buffer all the tokens then it can just return "" or null; Users should not access $ruleLabel.text in an action of course in that case.- 指定者:
toString在接口中TokenStream
-
toString
public java.lang.String toString(Token start, Token stop)
从接口复制的说明:TokenStreamBecause 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. Most often this will just delegate to the other toString(int,int). This is also parallel with the TreeNodeStream.toString(Object,Object).- 指定者:
toString在接口中TokenStream
-
LA
public int LA(int i)
从接口复制的说明:IntStreamGet int at current input pointer + i ahead where i=1 is next int. Negative indexes are allowed. LA(-1) is previous token (token just matched). LA(-i) where i is before first token should yield -1, invalid char / EOF.
-
get
public Token get(int i)
从接口复制的说明:TokenStreamGet a token at an absolute index i; 0..n-1. This is really only needed for profiling and debugging and token stream rewriting. If you don't want to buffer up tokens, then this method makes no sense for you. Naturally you can't use the rewrite stream feature. I believe DebugTokenStream can easily be altered to not use this method, removing the dependency.- 指定者:
get在接口中TokenStream
-
getSourceName
public java.lang.String getSourceName()
从接口复制的说明:IntStreamWhere 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.- 指定者:
getSourceName在接口中IntStream
-
-