Class TokenStream


  • public class TokenStream
    extends Object
    Class to manage a list of tokens as a stream with accessors to iterate through stream.
    Author:
    nhant01, GeorgeLuo
    • Constructor Summary

      Constructors 
      Constructor Description
      TokenStream​(List<com.steadystate.css.parser.Token> tokens)
      Constructor to initialize stream with underlying token list.
    • Constructor Detail

      • TokenStream

        public TokenStream​(@Nonnull
                           List<com.steadystate.css.parser.Token> tokens)
                    throws CssValidationException
        Constructor to initialize stream with underlying token list.
        Parameters:
        tokens - css content to store in stream
        Throws:
        CssValidationException - Css Validation Exception
    • Method Detail

      • consume

        public void consume()
        Function to advance the stream by a token
      • next

        public com.steadystate.css.parser.Token next()
        Returns the token at the next position in the token stream.
        Returns:
        the token at the position after the current token.
      • tokenAt

        public com.steadystate.css.parser.Token tokenAt​(int num)
        Returns the token at an absolute position in the token stream.
        Parameters:
        num - is the index of the token returned
        Returns:
        the token at num
      • current

        public com.steadystate.css.parser.Token current()
        Returns the token at the current position in the token stream.
        Returns:
        the token currently found at pos
      • reconsume

        public void reconsume()
        Rewinds to the previous position in the input.