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

A %union directive, its optional name, and its members.

Reading a uniondoctest
$file = (new \BisonParser\Parser())->parse("%union YYSTYPE { int i; char *s; }\n%%\ns: 'a';\n");
    $file->declarations[0]->name // => 'YYSTYPE'
    $file->declarations[0]->code // => ' int i; char *s; '

Properties§

public string|null $name
public string $code
public Location $location

Methods§

public function __construct(
    public string|null $name,
    public string $code,
    public Location $location,
)

Parameters

$namestring|nullThe union's name, or null when none is given
$codestringThe members without the braces
$locationLocationWhere the directive is written
public function location(): Location

Answers where the declaration begins.

Returns

Location Line and column of the percent sign
Test cases 1

Test cases 7§

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 6

Relations§

Instantiated in 1
Constant reads 1
Type declarations 1