classLr0Automaton
final class Lr0Automaton
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
The states of an LR(0) automaton, their transitions and their completed rules.
Properties§
public list<list<int>> $kernelspublic list<array<int, int>> $transitionspublic list<list<int>> $reductionsMethods§
public function __construct(
public list<list<int>> $kernels,
public list<array<int, int>> $transitions,
public list<list<int>> $reductions,
)Parameters
$kernels | list<list<int>> | Kernel items of each state, sorted |
$transitions | list<array<int, int>> | Target state by symbol, per state |
$reductions | list<list<int>> | Rules completed in each state, in rule order |
public function stateCount(): intAnswers how many states there are.
Returns
int State countTest cases 1
Calls 1
- function-call
countline 33
public function transition(int $state, int $symbol): int|nullAnswers the state reached on a symbol, if any.
Parameters
$state | int | State to leave |
$symbol | int | Symbol to move on |
Returns
int|null The target state, or null when the state has no such transitionTest cases 1
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 4
LookaheadSetsTestcallsLr0BuilderTestcallsParseTableBuilderTestcallsLrParserTestcalls