Merge commit '86671d3'

This commit is contained in:
Terence Parr 2012-03-12 13:19:35 -07:00
commit 754408da27
1 changed files with 10 additions and 8 deletions

View File

@ -31,19 +31,21 @@ package org.antlr.v4.runtime;
/** A stream of either tokens or tree nodes */
public interface SymbolStream<T> extends IntStream {
/** Get an object at absolute index i; 0..n-1.
/** Get the symbol at absolute index i; 0..n-1.
* This is only valid if the underlying stream implementation buffers
* all of the incoming objects.
*
* @throws UnsupportedOperationException if the index {@code i} is outside
* the marked region and the stream does not support accessing symbols by
* index outside of marked regions.
*/
public T get(int i);
/** Get Object at current input pointer + i ahead where i=1 is next Object.
* i<0 indicates Objects in the past. So -1 is previous Object and -2 is
* two Objects ago. LT(0) is undefined. For i>=n, return an
* object representing EOF. Return null for LT(0) and any index that
* results in an absolute index that is negative.
*
* TODO (Sam): throw exception for invalid k?
/** Get symbol at current input pointer + {@code k} ahead where {@code k=1}
* is next symbol. k&lt;0 indicates objects in the past. So -1 is previous
* Object and -2 is two Objects ago. {@code LT(0)} is undefined. For i>=n,
* return an object representing EOF. Return {@code null} for {@code LT(0)}
* and any index that results in an absolute index that is negative.
*/
T LT(int k);
}