Class TokenStream
java.lang.Object
com.oracle.js.parser.TokenStream
Handles streaming of tokens between lexer and parser.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit(int k) Advances the base of the stream.longget(int k) Get the kth token descriptor from the stream.voidgrow()Grow the buffer to accommodate more token descriptors.booleanisEmpty()Test to see if stream is empty.booleanisFull()Test to see if stream is full.intlast()Get the index of the last token in the stream.voidput(long token) Put a token descriptor to the stream.
-
Constructor Details
-
TokenStream
public TokenStream()Constructor.
-
-
Method Details
-
isEmpty
public boolean isEmpty()Test to see if stream is empty.- Returns:
- True if stream is empty.
-
isFull
public boolean isFull()Test to see if stream is full.- Returns:
- True if stream is full.
-
last
public int last()Get the index of the last token in the stream.- Returns:
- Index of last buffered token in the stream.
-
put
public void put(long token) Put a token descriptor to the stream.- Parameters:
token- Token descriptor to add.
-
get
public long get(int k) Get the kth token descriptor from the stream.- Parameters:
k- index- Returns:
- Token descriptor.
-
commit
public void commit(int k) Advances the base of the stream.- Parameters:
k- Position of token to be the new base.
-
grow
public void grow()Grow the buffer to accommodate more token descriptors.
-