|
Absimpa v196 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
TokenCode - is the type representing the
charactersof the language to be parsed
public interface Lexer<N,TokenCode extends java.lang.Enum<TokenCode>>
defines the interface to a lexical analyzer (lexer) needed by the
Parser. This interface does not define the kind of input the
lexer takes apart. It is only assumed that the lexer, as a result, can
provide objects of an enumeration type.
The Lexer must maintain a current token code which is
repeatedly queried by the parser. Only when next() is called, the
parser should discard the current token, and chop the next token off its
own input.
| Method Summary | |
|---|---|
TokenCode |
current()
provides the current token code. |
N |
next()
returns a node of type N for the current token while advancing the current token internally to the next one. |
ParseException |
parseException(java.util.Set<TokenCode> expectedTokens)
creates a ParseException on request from the parser. |
| Method Detail |
|---|
N next()
throws ParseException
returns a node of type N for the current token while advancing the current token internally to the next one.
ParseExceptionTokenCode current()
provides the current token code. This method must always return the
same token code as long as next() is not called.
ParseException parseException(java.util.Set<TokenCode> expectedTokens)
creates a ParseException on request from the parser. This method
is called by the parser if it finds a token code that does not fit its
grammar. It is up to the Lexer implementation to provide as much
information as possible in the exception about the current position of
the input.
expectedTokens - a set of tokens that the parser would have
expected at the current position.
|
Absimpa v196 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||