Package dev.amp.validator.css
Class TokenStream
- java.lang.Object
-
- dev.amp.validator.css.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsume()Function to advance the stream by a tokencom.steadystate.css.parser.Tokencurrent()Returns the token at the current position in the token stream.com.steadystate.css.parser.Tokennext()Returns the token at the next position in the token stream.voidreconsume()Rewinds to the previous position in the input.com.steadystate.css.parser.TokentokenAt(int num)Returns the token at an absolute position in the token stream.
-
-
-
Constructor Detail
-
TokenStream
public TokenStream(@Nonnull List<com.steadystate.css.parser.Token> tokens) throws CssValidationExceptionConstructor 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.
-
-