Package org.openzen.zenscript.lexer
Class TokenParser<T extends Token<TT>,TT extends TokenType>
java.lang.Object
org.openzen.zenscript.lexer.TokenParser<T,TT>
- Type Parameters:
T- token classTT- token type class
- All Implemented Interfaces:
TokenStream<TT,T>
public class TokenParser<T extends Token<TT>,TT extends TokenType>
extends Object
implements TokenStream<TT,T>
Represents a token stream. A token stream reads characters from a reader and
presents it as a series of tokens. Can be used to implement LL(*) parsers.
Token classes with a negative class are considered to be whitespace.
-
Constructor Summary
ConstructorsConstructorDescriptionTokenParser(SourceFile file, String data, CompiledDFA<TT> dfa, TT eof, TT invalid, TokenFactory<T, TT> factory) Creates a token stream which reads data from the specified string.TokenParser(SourceFile file, CharReader reader, CompiledDFA<TT> dfa, TT eof, TT invalid, TokenFactory<T, TT> factory) Creates a token stream using the specified reader and DFA. -
Method Summary
-
Constructor Details
-
Method Details
-
getPosition
- Specified by:
getPositionin interfaceTokenStream<T extends Token<TT>,TT extends TokenType>
-
hasNext
public boolean hasNext() -
getEOF
-
next
- Specified by:
nextin interfaceTokenStream<T extends Token<TT>,TT extends TokenType> - Throws:
ParseException
-