![]() |
AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
|
Parse text to build graph. More...
Collaboration diagram for aud.example.graph.GraphParser:Public Member Functions | |
| GraphParser (AbstractGraph< AbstractNode, AbstractEdge > g) | |
create new parser for graph g More... | |
| void | parse (String input) |
| parse input More... | |
| void | parse (File file) |
parse(String) contents of file More... | |
| void | setVerbose (boolean b) |
set verbose mode (report state to System.err) More... | |
Static Public Member Functions | |
| static void | main (String[] args) |
| test and example for usage More... | |
Protected Member Functions | |
| String | errorNear () |
| helper: generate a simple error message More... | |
| int | lookahead () |
| helper: "lookahead" is the usual phrasing More... | |
| void | nextToken () |
| helper: consume current token and advance to next token More... | |
| void | expect (int tokenid, String text) |
helper: check token (without calling nextToken!) More... | |
| void | verbose (int level, String message) |
| helper: print out information More... | |
| void | graph (int level) |
| parse list of nodes/edges More... | |
| AbstractEdge | edge (int level) |
| parse edge More... | |
| AbstractNode | node (int level) |
| parse node More... | |
| double[] | pos (int level) |
| parse position More... | |
| Double | weight (int level) |
| parse weight More... | |
Parse text to build graph.
graph ::= edges
edges ::= edge | edges edge
edge ::= ( node | node ( '--' | '->' ) weight node )
node ::= IDENTIFIER | IDENTIFIER pos
pos ::= '@' '(' NUMBER ',' NUMBER ')'
weight ::= NIL | '(' NUMBER ')'
Definition at line 23 of file GraphParser.java.
create new parser for graph g
Definition at line 31 of file GraphParser.java.
|
protected |
parse edge
Definition at line 107 of file GraphParser.java.
References aud.example.graph.Tokenizer.DEDGE, aud.example.graph.Tokenizer.EDGE, aud.example.graph.GraphParser.lookahead(), aud.example.graph.GraphParser.node(), and aud.example.graph.GraphParser.verbose().
Referenced by aud.example.graph.GraphParser.graph().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
helper: generate a simple error message
Definition at line 58 of file GraphParser.java.
|
protected |
helper: check token (without calling nextToken!)
| RuntimeException | if token does not match (syntax error) |
Definition at line 78 of file GraphParser.java.
References aud.example.graph.GraphParser.lookahead().
Referenced by aud.example.graph.GraphParser.node(), aud.example.graph.GraphParser.pos(), and aud.example.graph.GraphParser.weight().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
parse list of nodes/edges
Definition at line 99 of file GraphParser.java.
References aud.example.graph.GraphParser.edge(), aud.util.LexicalScanner.END_OF_INPUT, aud.example.graph.GraphParser.lookahead(), and aud.example.graph.GraphParser.verbose().
Here is the call graph for this function:
|
protected |
helper: "lookahead" is the usual phrasing
Definition at line 64 of file GraphParser.java.
Referenced by aud.example.graph.GraphParser.edge(), aud.example.graph.GraphParser.expect(), aud.example.graph.GraphParser.graph(), aud.example.graph.GraphParser.node(), and aud.example.graph.GraphParser.weight().
Here is the caller graph for this function:
|
static |
test and example for usage
Definition at line 205 of file GraphParser.java.
References aud.util.DotViewer.displayWindow(), aud.example.graph.GraphParser.parse(), aud.util.Sys.readFile(), aud.util.DotViewer.setExitOnClose(), aud.example.graph.GraphParser.setVerbose(), and aud.graph.AbstractGraph< Node extends AbstractNode, Edge extends AbstractEdge >.toDot().
Here is the call graph for this function:
|
protected |
helper: consume current token and advance to next token
Definition at line 69 of file GraphParser.java.
Referenced by aud.example.graph.GraphParser.pos(), and aud.example.graph.GraphParser.weight().
Here is the caller graph for this function:
|
protected |
parse node
Definition at line 133 of file GraphParser.java.
References aud.example.graph.GraphParser.expect(), aud.example.graph.Tokenizer.IDENTIFIER, aud.example.graph.GraphParser.lookahead(), aud.example.graph.Tokenizer.NUMBER, and aud.example.graph.GraphParser.verbose().
Referenced by aud.example.graph.GraphParser.edge().
Here is the call graph for this function:
Here is the caller graph for this function:| void aud.example.graph.GraphParser.parse | ( | File | file | ) |
parse(String) contents of file
Definition at line 48 of file GraphParser.java.
References aud.example.graph.GraphParser.parse(), and aud.util.Sys.readFile().
Here is the call graph for this function:| void aud.example.graph.GraphParser.parse | ( | String | input | ) |
parse input
| input | text representation of parser |
| RuntimeException | on syntax error or invalid operation |
Definition at line 39 of file GraphParser.java.
Referenced by aud.example.graph.GraphParser.main(), aud.example.graph.RetroMaze.main(), aud.example.graph.TraversalExample.main(), aud.example.graph.MyGraph.MyGraph(), and aud.example.graph.GraphParser.parse().
Here is the caller graph for this function:
|
protected |
parse position
Definition at line 158 of file GraphParser.java.
References aud.example.graph.Tokenizer.AT, aud.example.graph.GraphParser.expect(), aud.example.graph.Tokenizer.LEFT_PAREN, aud.example.graph.GraphParser.nextToken(), aud.example.graph.Tokenizer.NUMBER, and aud.example.graph.GraphParser.verbose().
Here is the call graph for this function:| void aud.example.graph.GraphParser.setVerbose | ( | boolean | b | ) |
set verbose mode (report state to System.err)
Definition at line 53 of file GraphParser.java.
Referenced by aud.example.graph.GraphParser.main().
Here is the caller graph for this function:
|
protected |
helper: print out information
Definition at line 86 of file GraphParser.java.
Referenced by aud.example.graph.GraphParser.edge(), aud.example.graph.GraphParser.graph(), aud.example.graph.GraphParser.node(), aud.example.graph.GraphParser.pos(), and aud.example.graph.GraphParser.weight().
Here is the caller graph for this function:
|
protected |
parse weight
Definition at line 184 of file GraphParser.java.
References aud.example.graph.GraphParser.expect(), aud.example.graph.Tokenizer.LEFT_BRACE, aud.example.graph.GraphParser.lookahead(), aud.example.graph.GraphParser.nextToken(), aud.example.graph.Tokenizer.NUMBER, and aud.example.graph.GraphParser.verbose().
Here is the call graph for this function: