Class TokenStream

java.lang.Object
com.oracle.js.parser.TokenStream

public class TokenStream extends Object
Handles streaming of tokens between lexer and parser.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    commit(int k)
    Advances the base of the stream.
    long
    get(int k)
    Get the kth token descriptor from the stream.
    void
    Grow the buffer to accommodate more token descriptors.
    boolean
    Test to see if stream is empty.
    boolean
    Test to see if stream is full.
    int
    Get the index of the last token in the stream.
    void
    put(long token)
    Put a token descriptor to the stream.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.