![]() |
AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
|
Breaks input string into pieces ("tokens"). More...
Public Member Functions | |
Tokenizer (String input) | |
create new tokenizer for input More... | |
![]() | |
LexicalScanner (Rule[] rules, String input) | |
create new scanner processing input @endiliteral More... | |
void | setInput (String input) |
set input (resets scanner state) More... | |
String | matchedText () |
get text of last match or call to next More... | |
int | matchedTokenId () |
get result of last call to next() More... | |
String | remainder () |
get remaining text More... | |
boolean | endOfInput () |
reached end of input? More... | |
int | next () |
match remainder to rules provided to constructor More... | |
Static Public Member Functions | |
static void | main (String[] args) |
testing and example for usage More... | |
static void | main (String[] args) |
testing and example for usage More... | |
Static Public Attributes | |
static final int | PLUS ='+' |
static final int | MINUS ='-' |
static final int | TIMES ='*' |
static final int | DIVIDE ='/' |
static final int | POWER ='^' |
static final int | LEFT_PAREN ='(' |
static final int | RIGHT_PAREN =')' |
static final int | IDENTIFIER =0x100 |
static final int | NUMBER =0x101 |
![]() | |
static final int | END_OF_INPUT = -1 |
no more input More... | |
static final int | NO_MATCH = -2 |
no match (usually implies a syntax error) More... | |
static final Pattern | P_WHITESPACE = Pattern.compile("\\s+") |
white space More... | |
static final Pattern | P_IDENTIFIER |
identifiers More... | |
static final Pattern | P_FLOAT |
floating point number More... | |
Static Protected Attributes | |
static final Pattern | P_PLUS = Pattern.compile("\\+") |
static final Pattern | P_MINUS = Pattern.compile("-") |
static final Pattern | P_TIMES = Pattern.compile("\\*") |
static final Pattern | P_DIVIDE = Pattern.compile("/") |
static final Pattern | P_POWER = Pattern.compile("(\\*\\*)|\\^") |
static final Pattern | P_LEFTPAREN = Pattern.compile("\\(") |
static final Pattern | P_RIGHTPAREN = Pattern.compile("\\)") |
static final LexicalScanner.Rule[] | RULES |
Additional Inherited Members | |
![]() | |
void | eatWhiteSpace () |
ignore white space (called by match More... | |
boolean | match (Pattern p) |
Match remainder against pattern p . More... | |
int | next (Rule[] rules) |
match remainder to table of rules @endiliteral More... | |
Breaks input string into pieces ("tokens").
Definition at line 9 of file Tokenizer.java.
aud.example.expr.Tokenizer.Tokenizer | ( | String | input | ) |
create new tokenizer for input
Definition at line 44 of file Tokenizer.java.
References aud.example.expr.Tokenizer.RULES.
|
static |
testing and example for usage
Reimplemented from aud.util.LexicalScanner.
Definition at line 49 of file Tokenizer.java.
References aud.util.LexicalScanner.END_OF_INPUT, aud.util.LexicalScanner.matchedText(), aud.util.LexicalScanner.matchedTokenId(), aud.util.LexicalScanner.next(), aud.util.LexicalScanner.NO_MATCH, aud.example.expr.Tokenizer.NUMBER, and aud.util.LexicalScanner.remainder().
|
static |
Definition at line 22 of file Tokenizer.java.
Referenced by aud.example.expr.ExpressionParser.product().
|
static |
Definition at line 27 of file Tokenizer.java.
Referenced by aud.example.expr.ExpressionParser.factor().
|
static |
Definition at line 24 of file Tokenizer.java.
Referenced by aud.example.expr.ExpressionParser.factor().
|
static |
Definition at line 20 of file Tokenizer.java.
Referenced by aud.example.expr.ExpressionParser.factor(), and aud.example.expr.ExpressionParser.sum().
|
static |
Definition at line 28 of file Tokenizer.java.
Referenced by aud.example.expr.ExpressionParser.factor(), and aud.example.expr.Tokenizer.main().
|
staticprotected |
Definition at line 14 of file Tokenizer.java.
|
staticprotected |
Definition at line 16 of file Tokenizer.java.
|
staticprotected |
Definition at line 12 of file Tokenizer.java.
|
staticprotected |
Definition at line 11 of file Tokenizer.java.
|
staticprotected |
Definition at line 15 of file Tokenizer.java.
|
staticprotected |
Definition at line 17 of file Tokenizer.java.
|
staticprotected |
Definition at line 13 of file Tokenizer.java.
|
static |
Definition at line 19 of file Tokenizer.java.
Referenced by aud.example.expr.ExpressionParser.factor(), and aud.example.expr.ExpressionParser.sum().
|
static |
Definition at line 23 of file Tokenizer.java.
|
static |
Definition at line 25 of file Tokenizer.java.
Referenced by aud.example.expr.ExpressionParser.factor().
|
staticprotected |
Definition at line 30 of file Tokenizer.java.
Referenced by aud.example.expr.Tokenizer.Tokenizer().
|
static |
Definition at line 21 of file Tokenizer.java.
Referenced by aud.example.expr.ExpressionParser.product().