new State(grammar, marks, core, messages)
Creates a new state of the automaton;
see factory method grammar.state().
Parameters:
| Name | Type | Description |
|---|---|---|
grammar |
module:BNF~Grammar | owner of this state. |
marks |
Array.<module:BNF~Mark> | core and closure defining this state. |
core |
number | number of marked rules in the core. |
messages |
Object.<number, module:BNF~Message> | maps possible next symbols to |
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
grammar |
module:BNF~Grammar | owner of this state. |
marks |
Array.<module:BNF~Mark> | core and closure defining this state. |
core |
number | number of marked rules in the core. |
messages |
Object.<number, module:BNF~Message> | maps possible next symbols to messages. |
errors |
Array.<string> | errors detected in this state, if any. |
Methods
-
advance(stateNumber)
-
Populates the
.messagestable. Fills inreducefor complete rules,shiftfor terminals,acceptfor the end of input terminal, andgotofor non-terminals.Parameters:
Name Type Description stateNumbernumber this state's number for error messages.
-
dump(core)
-
Displays all marked rules and messages.
Parameters:
Name Type Description coreboolean if true, only displays core configurations.
Returns:
- Type
- string
-
equals(core)
-
Compares a core of marked rules to this state's core.
Parameters:
Name Type Description coreArray.<module:BNF~Mark> to compare to
this.Returns:
true if this state has the same core (in any order).
-
toString()
-
Displays core configurations and messages.
Returns:
- Type
- string