final class NullableSet
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

The nonterminals that can derive the empty string.

Methods§

public function __construct(Grammar $grammar)

Computes the set by iterating over the rules until nothing changes.

Parameters

$grammarGrammarGrammar to inspect
public function isNullable(int $symbol): bool

Reports whether a symbol derives the empty string.

Parameters

$symbolintSymbol number

Returns

bool True for a nullable nonterminal, false for terminals and other nonterminals
Test cases 1
Called from 1
public function tailNullable(list<int> $symbols, int $from): bool

Reports whether every symbol from a position onward derives the empty string.

Parameters

$symbolslist<int>Symbols to inspect
$fromintPosition to start at

Returns

bool True when the tail is empty or all of it is nullable
Test cases 1
Called from 1
Calls 1

Private surface 1§

Implementation details, listed for orientation only.

private array<int, true> $nullable

Test cases 7§

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 5

Relations§

Instantiated in 1
Method calls 2
Type declarations 2