|
Object-oriented Parser System v3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectUtils
Visitor
Recognize
Build
public class Build
ParserFactory aspect: build a tree.
The visitor uses package access.
| Field Summary | |
|---|---|
protected boolean |
addNull
true (default) to record null for noInput. |
protected Object |
builder
can modify the result of each Rule. |
protected List[] |
collections
current collections for Permute. |
protected List |
current
current collection. |
| Fields inherited from class Recognize |
|---|
parser, scanner |
| Fields inherited from class Utils |
|---|
error |
| Fields inherited from interface Symbols |
|---|
badInput, endOfFile, firstSymbol, noInput |
| Constructor Summary | |
|---|---|
Build(Parser parser)
|
|
| Method Summary | |
|---|---|
Object |
build(Scanner scanner,
Object builder,
boolean addNull)
delegate to recognize. |
protected void |
noInput()
override processing of noInput:
if addNull, add null to current collection. |
protected void |
permute(Parser.Permute permute,
int a)
override processing of an alternative of Permute:
arrange to collect into collection for alternative. |
protected Boolean |
permutedList(Parser.PermutedList permutedList,
int a,
int done)
override processing of an alternative of PermutedList. |
Object |
visit(Parser.Nonterminal nonterminal)
override processing of a Nonterminal:
visit rule; if result is ArrayList flatten,
else add result to current. |
Object |
visit(Parser.Permute permute)
override processing of a Permute:
collect each alternative separately,
add the collections, flattened, in order of definition. |
Object |
visit(Parser.PermutedList permutedList)
override processing of a PermutedList. |
Object |
visit(Parser.Rule rule)
override processing of a Rule:
push current, visit right hand side, pop current;
silently filter by invoking builder. |
Object |
visit(Parser.Token token)
override processing of a Token:
add value to current, then delegate to base class. |
| Methods inherited from class Recognize |
|---|
advance, recognize, visit, visit, visit, visit, visit |
| Methods inherited from class Visitor |
|---|
visit, visit, visit, visit, visit, visit, visit, visit |
| Methods inherited from class Utils |
|---|
className, error, error, fromString, getError, message, testScanner, toChars, toString, toString, warning, warning |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Object builder
Rule.
protected List current
protected List[] collections
Permute.
protected boolean addNull
noInput.
| Constructor Detail |
|---|
public Build(Parser parser)
| Method Detail |
|---|
public Object build(Scanner scanner,
Object builder,
boolean addNull)
recognize.
error.public Object visit(Parser.Rule rule)
Rule:
push current, visit right hand side, pop current;
silently filter by invoking builder.rulename(int,List)
or builder.rulename(List), if either, with the scanner's position
and the current list;
if filtering is not possible and rule is marked left-associative,
send each element of the current list to its successor using
List.add(E) and return the last element.
visit in class Recognizepublic Object visit(Parser.Nonterminal nonterminal)
Nonterminal:
visit rule; if result is ArrayList flatten,
else add result to current.
visit in class Recognizepublic Object visit(Parser.Token token)
Token:
add value to current, then delegate to base class.
visit in class Visitorprotected void noInput()
noInput:
if addNull, add null to current collection.
noInput in class Recognizepublic Object visit(Parser.Permute permute)
Permute:
collect each alternative separately,
add the collections, flattened, in order of definition.
Delegate to noInput() if an alternative has not been selected.
visit in class Recognize
protected void permute(Parser.Permute permute,
int a)
Permute:
arrange to collect into collection for alternative.
permute in class Recognizepublic Object visit(Parser.PermutedList permutedList)
PermutedList.
Unfortunately, this is identical to permute; however, it needs to
call permutedList.
visit in class Recognize
protected Boolean permutedList(Parser.PermutedList permutedList,
int a,
int done)
PermutedList.
Unfortunately, this is identical to permute; however, it needs to
call permutedList.
If collected, a delimiter is appended to the alternative it follows.
permutedList in class Recognize
|
(c) 2008 Axel T. Schreiner |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||