Package org.nineml.coffeegrinder.parser
Class State
java.lang.Object
org.nineml.coffeegrinder.parser.State
States (or Earley items) in the chart.
FIXME: this API is in flux.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Statefinal intfinal RightHandSidefinal Rulefinal NonterminalSymbol -
Method Summary
Modifier and TypeMethodDescriptionadvance()Get a new state with the position advanced by onebooleanAre we finished with this symbol?booleangetDescriptor(int k, int i) getFirst(ParserGrammar grammar) intGet the current position in this stategetRhs()Get the list of symbols that define this state's nonterminal symbol.getRule()Get the rule that originated this state.Get the nonterminal associated with this stateinthashCode()Get the next symboltoString()
-
Field Details
-
L0
-
rule
-
symbol
-
position
public final int position -
rhs
-
-
Method Details
-
nextSymbol
Get the next symbolIf the state has more symbols, return the symbol that occurs after the current position.
- Returns:
- the next symbol, or null if position is last
-
prevSymbol
-
getDescriptor
-
getSymbol
Get the nonterminal associated with this state- Returns:
- the symbol
-
getRule
Get the rule that originated this state.- Returns:
- the rule
-
getRhs
Get the list of symbols that define this state's nonterminal symbol.- Returns:
- the list of symbols on the "right hand side"
-
getPosition
public int getPosition()Get the current position in this state- Returns:
- the position
-
advance
Get a new state with the position advanced by one- Returns:
- a new state with the position advanced
- Throws:
ParseException- if an attempt is made to advance a completed state
-
completed
public boolean completed()Are we finished with this symbol?- Returns:
- true if the position indicates that we've seen all of the symbols on the "right hand side"
-
getFirst
-
equals
-
hashCode
public int hashCode() -
toString
-