|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface LexicalAnalyzer<T extends Enum<T> & HasPattern>
A general interface for a very basic, regular expression-driven lexical
analyzer (lexer). This is a generic type that accepts, as a type parameter,
an enum type defining the tokens. That is, the type T for this
interface allows the client code to specify its own set of tokens, as an
enum. That enum type has to meet the HasPattern interface, which
says that each token will provide a string regex pattern that defines the
category of strings that it will match.
Concrete types implementing this interface MUST provide a constructor
that allows clients to specify the identity of the "end of file" token (EOF).
This is the token that will be returned by nextTok() when it
reaches the end of file.
Note: This type does not currently support pushback of tokens, though subclasses may provide that functionality if they wish.
| Method Summary | |
|---|---|
Token<T> |
nextTok()
Return the next token available from the input sequence. |
| Method Detail |
|---|
Token<T> nextTok()
throws ParseException
ParseException - If there is a lexical failure (such as if no token
type matches the next sequence of characters.)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||