public class RuleItem extends Object
Rules.
Each rule is composed of a list of zero or many RuleItems. This representation
is used throughout the multiple processes to generate the structure of the syntax
including computing first, follow, lookaheads, states, actions, grammar tables, and
finally parsing tables.
This class defines a whole rule.| Constructor and Description |
|---|
RuleItem(Symbol symbol)
Construct a rule item with the given symbol
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static boolean |
equals(RuleItem a,
RuleItem b)
Utility method to compare two items, accounting for nulls
|
Rule |
getRule() |
Symbol |
getSymbol() |
int |
getSymbolId()
Convenience method to get the id of the symbol in the rule item
|
RuleItem |
next()
Move to the next item in the rule
|
void |
setRule(Rule rule) |
void |
setSymbol(Symbol symbol) |
String |
toString()
Returns the symbol string value.
|
public RuleItem(Symbol symbol)
symbol - is the symbol for the rule itempublic int getSymbolId()
public RuleItem next()
public Symbol getSymbol()
public void setSymbol(Symbol symbol)
symbol - the symbol to setpublic Rule getRule()
public void setRule(Rule rule)
rule - the rule to setpublic static boolean equals(RuleItem a, RuleItem b)
a - the first element. Can be null.b - the second element. Can be null.public String toString()
toString in class ObjectObject.toString()Copyright © 2017. All rights reserved.