|
Language Processing v2.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectUtils
Parser
public class Parser
factory to represent a grammar in jay-style BNF.
| Nested Class Summary | |
|---|---|
class |
Parser.Id
references a Pattern, a Rule, or error by name. |
class |
Parser.Left
%left |
class |
Parser.Level
base class for precedence levels. |
class |
Parser.Literal
references a Symbol. |
class |
Parser.Node
basic behavior for the grammar tree: an immutable List. |
class |
Parser.Nonassoc
%nonassoc |
class |
Parser.Pattern
represents an optionally typed token terminal. |
class |
Parser.Right
%right |
class |
Parser.Rule
represents an optionally typed grammar rule. |
class |
Parser.Sequence
one alternative of a rule with optional %prec terminal. |
class |
Parser.Symbol
represents a literal terminal. |
class |
Parser.Type
represents type information. |
| Field Summary | |
|---|---|
protected HashMap<String,Object> |
defined
maps Id name to null, Pattern, or Rule. |
protected String |
epilog
prolog and epilog code. |
protected ArrayList<Parser.Level> |
levels
collects Levels in order of definition. |
protected ArrayList<Parser.Pattern> |
patterns
collects Patterns in order of definition. |
protected String |
prolog
prolog and epilog code. |
protected ArrayList<Parser.Rule> |
rules
collects Rules in order of definition. |
protected int |
start
if >= 0: index of rule for start symbol. |
protected HashMap<String,Parser.Symbol> |
symbols
collects Symbol strings. |
protected ArrayList<String> |
yyNames
maps pattern and symbol numbers to names. |
| Fields inherited from class Utils |
|---|
error |
| Constructor Summary | |
|---|---|
Parser()
|
|
| Method Summary | |
|---|---|
Parser.Id |
id(int position,
String name)
factory method. |
Parser.Level |
level(int position,
String assoc,
Parser.Node... nodes)
factory method. |
Parser.Literal |
literal(int position,
String value)
factory method. |
Parser.Pattern |
pattern(int position,
Parser.Type type,
String name,
String value)
factory method. |
Parser.Rule |
rule(int position,
Parser.Type type,
String name,
Parser.Node... nodes)
factory method. |
Parser.Sequence |
sequence(int position,
Parser.Node prec,
Parser.Node... nodes)
factory method. |
Parser.Sequence |
sequence(int position,
String flags,
Parser.Node prec,
Parser.Node... nodes)
factory method. |
Parser.Type |
type(int position,
String name,
boolean flatten,
String... interfaces)
factory method. |
| Methods inherited from class Utils |
|---|
className, error, error, error, fromString, getError, message, toChars, toString, warning, warning, warning |
| 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 final ArrayList<String> yyNames
protected final HashMap<String,Parser.Symbol> symbols
Symbol strings.
These strings are unique and should take precedence over patterns in the scanner.
protected final ArrayList<Parser.Pattern> patterns
Patterns in order of definition.
There might be more for macros (untyped) and skips (void).
protected final HashMap<String,Object> defined
Id name to null, Pattern, or Rule.
protected final ArrayList<Parser.Level> levels
Levels in order of definition.
protected final ArrayList<Parser.Rule> rules
Rules in order of definition.
protected int start
| Constructor Detail |
|---|
public Parser()
| Method Detail |
|---|
public Parser.Pattern pattern(int position,
Parser.Type type,
String name,
String value)
public Parser.Rule rule(int position,
Parser.Type type,
String name,
Parser.Node... nodes)
public Parser.Type type(int position,
String name,
boolean flatten,
String... interfaces)
public Parser.Sequence sequence(int position,
Parser.Node prec,
Parser.Node... nodes)
public Parser.Sequence sequence(int position,
String flags,
Parser.Node prec,
Parser.Node... nodes)
public Parser.Id id(int position,
String name)
public Parser.Literal literal(int position,
String value)
public Parser.Level level(int position,
String assoc,
Parser.Node... nodes)
|
(c) 2008 Axel T. Schreiner |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||