|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsimple.lexer.Lexer
public class Lexer
This class defines a lexer object that will do a lexical analysis
on a stream of characters, and generates Tokens following the
rule:
| Character | Token |
|---|---|
( |
Token.Type.LPAREN |
) |
Token.Type.RPAREN |
[+-] |
Token.Type.TERMOP |
[*/] |
Token.Type.FACTOP |
[0-9] |
Token.Type.NUMBER |
<EOF> |
Token.Type.EOF |
Token,
Token.Type| Constructor Summary | |
|---|---|
Lexer(java.lang.String src)
Creates a lexer object, passing a source string. |
|
| Method Summary | |
|---|---|
Token |
getNextToken()
|
boolean |
hasMoreTokens()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Lexer(java.lang.String src)
throws ParseException
src - the source string
ParseException - if unrecognized character is found| Method Detail |
|---|
public boolean hasMoreTokens()
true if there is more token(s) to be returnedpublic Token getNextToken()
null if there is no more token.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||