final class TokenClass
    implements Declaration
Public API: explicitly declared with @visibility public.

%token_class name TOKEN|TOKEN... .: a nonterminal name standing for any of several terminals.

Reading a token classdoctest
$file = (new \LemonParser\Parser())->parse("%token_class id ID|INDEXED.\n");
    $class = $file->declarations()[0];
    [$class->name->name, array_map(static fn ($symbol) => $symbol->name, $class->tokens)] // => ['id', ['ID', 'INDEXED']]

Properties§

public Symbol $name
public list<Symbol> $tokens
public Location $location

Methods§

public function __construct(
    public Symbol $name,
    public list<Symbol> $tokens,
    public Location $location,
)

Parameters

$nameSymbolThe name of the class
$tokenslist<Symbol>The terminals it stands for, in order
$locationLocationWhere the `%` sign is
public function location(): Location

{@inheritDoc}

Returns

Test 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 1
Other tests reaching this symbol 5

Relations§

Instantiated in 1
Constant reads 1
Type checks 2
Type declarations 1