Class: State

BNF~ State

Represents a state of the automaton.


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 null.

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.

Source:

Methods


advance(stateNumber)

Populates the .messages table. Fills in reduce for complete rules, shift for terminals, accept for the end of input terminal, and goto for non-terminals.

Parameters:
Name Type Description
stateNumber number

this state's number for error messages.

Source:

dump(core)

Displays all marked rules and messages.

Parameters:
Name Type Description
core boolean

if true, only displays core configurations.

Source:
Returns:
Type
string

equals(core)

Compares a core of marked rules to this state's core.

Parameters:
Name Type Description
core Array.<module:BNF~Mark>

to compare to this.

Source:
Returns:

true if this state has the same core (in any order).


toString()

Displays core configurations and messages.

Source:
Returns:
Type
string