final class TerminalOccurrence

A terminal occurrence, including the productions that introduced it.

Properties§

public string $name
public int $id
public list<int> $ancestors = []
public list<string> $rules = []
public ?string $rewrite = null

Methods§

public function __construct(
    public string $name,
    public int $id,
    public list<int> $ancestors = [],
    public list<string> $rules = [],
    public ?string $rewrite = null,
)

Parameters

$namestring
$idint
$ancestorslist<int>Derivation occurrence IDs, outermost first
$ruleslist<string>Grammar rules, outermost first
$rewrite?string
Test cases 3
public function within(string $rule): bool

Reports whether a grammar rule encloses this occurrence.

Parameters

$rulestring

Returns

bool
Test cases 1
Calls 1
public function ancestor(string $rule): ?int

Identifies the nearest enclosing occurrence of a grammar rule, including recursive scopes.

Parameters

$rulestring

Returns

?int
Test cases 1
Calls 1
public function replaced(string $name, string $rewrite): self

Returns a renamed occurrence while preserving its original identity and enclosing productions.

Parameters

$namestring
$rewritestring

Returns

self
Test cases 3
Calls 1

Test cases 203§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3
Other tests reaching this symbol 200

Relations§

Instantiated in 14
Type declarations 11