|
Object-oriented Parser System v3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectParser
public class Parser
represents literals, patterns, and rules of a grammar.
The parser will be loaded using an ObjectInputStream.
| Nested Class Summary | |
|---|---|
class |
Parser.And
represents a complete, unordered selection among two or more Nodes. |
class |
Parser.AndList
represents a complete, unordered, delimited selection among two or more Nodes. |
class |
Parser.Binding<V>
represents a binding (type and generic value) for a name. |
class |
Parser.Delimit
represents an iterated collection of Nodes with delimiters. |
class |
Parser.Group
base class for collections of Nodes. |
class |
Parser.Literal
represents a literal input, not to be collected. |
class |
Parser.Node
basic behavior for the grammar tree: an immutable List with lookahead. |
class |
Parser.Nonterminal
represents a reference to a Rule. |
class |
Parser.Or
represents an inclusive selection among two or more Nodes. |
class |
Parser.OrList
represents an inclusive selection among two or more Nodes. |
class |
Parser.Pattern
represents a binding (type and pattern string) for a Token name. |
class |
Parser.Permute
base class for unordered selections among two or more Nodes. |
class |
Parser.PermutedList
base class for unordered, delimited selections among two or more Nodes. |
class |
Parser.Repeat
represents an iterated collection of Nodes. |
class |
Parser.Rule
represents a binding (type and right-hand side node) for a Nonterminal name. |
class |
Parser.Sequence
represents a sequence of Nodes. |
class |
Parser.Terminal
base class for input symbols, i.e., Literal and Token. |
class |
Parser.Token
represents a reference to a Pattern. |
class |
Parser.Type
represents type information. |
class |
Parser.Xor
represents an exclusive selection among two or more Nodes. |
| Field Summary | |
|---|---|
protected String |
epilog
prolog and epilog code. |
protected Map<String,Parser.Literal> |
literals
collects Literal strings. |
protected BitSet[] |
lookaheads
lookahead sets: Each list element denotes a set of symbols which is the lookahead for a Node. |
protected Parser.Pattern[] |
patterns
one Pattern per Token name in order of definition. |
protected String |
prolog
prolog and epilog code. |
protected Parser.Rule[] |
rules
one Rule per Nonterminal name in order of definition. |
protected int |
start
index of start symbol in rules. |
| Constructor Summary | |
|---|---|
protected |
Parser()
should only be created by ParserFactory and set up using package access. |
| Method Summary | |
|---|---|
int |
getSymbol(String literal)
lookup symbol value of Literal. |
int |
getToken(String token)
lookup symbol value of Pattern. |
protected static boolean |
noType(Parser.Type type)
true if there is a null or [vV]oid type. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String prolog
protected String epilog
protected Map<String,Parser.Literal> literals
Literal strings.
These strings are unique and should take precedence over patterns in the scanner.
protected Parser.Pattern[] patterns
Pattern per Token name in order of definition.
There might be more for macros (untyped) and skips (void).
protected Parser.Rule[] rules
Rule per Nonterminal name in order of definition.
The first one is the start symbol of the grammar.
protected int start
rules.
protected BitSet[] lookaheads
Node.
Pattern contains a symbol value which the scanner must generate for a matching token.
Literal contains a symbol value which the scanner must generate for the literal.
Each Node contains an index into this list; the index also identifies the
follow set in Follow. The list can be computed by Lookahead
or read as a resource.
| Constructor Detail |
|---|
protected Parser()
ParserFactory and set up using package access.
| Method Detail |
|---|
public int getSymbol(String literal)
Literal.
getSymbol in interface Scanner.Lookuppublic int getToken(String token)
Pattern.
Inefficient -- linear search.
getToken in interface Scanner.Lookupprotected static boolean noType(Parser.Type type)
|
(c) 2008 Axel T. Schreiner |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||