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

One production of a grammar, numbered in the order it was declared.

Rule zero is always the augmented start rule. A hidden rule is one the reader synthesised for a mid-rule action; it derives the empty string and is left out of the syntax tree.

Properties§

public int $index
public int $lhs
public list<int> $rhs
public int $ordinal
public bool $hidden = false
public int|null $precedenceSymbol = null

Methods§

public function __construct(
    public int $index,
    public int $lhs,
    public list<int> $rhs,
    public int $ordinal,
    public bool $hidden = false,
    public int|null $precedenceSymbol = null,
)

Parameters

$indexintPosition among all rules, zero for the start rule
$lhsintNonterminal the rule derives
$rhslist<int>Symbols the rule expands to, in order
$ordinalintPosition among the alternatives of the same nonterminal
$hiddenboolWhether the rule was synthesised for a mid-rule action
$precedenceSymbolint|nullTerminal named to lend its precedence, if any
public function length(): int

Answers how many symbols the rule expands to.

Returns

int Length of the right-hand side
Test cases 1
Calls 1

Test cases 28§

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 26

Relations§

Instantiated in 2
Type declarations 1