final class Line
    implements Declaration, RhsItem
Public API: explicitly declared with @visibility public.

A #line directive: from here on, Bison counts lines from the number given, in the file named.

Bison reads #line at the start of a line anywhere in the file and changes the locations it reports and, through them, the order it numbers symbols in. The directive is kept where it stands: among the declarations, among the rules, or inside a rule.

Reading a line directive between two rulesdoctest
$file = (new \BisonParser\Parser())->parse("%%\na: ;\n#line 10 \"other.y\"\nb: ;\n");
    $line = $file->grammar[1];
    [$line->line, $line->file, (string) $line->location()] // => [10, 'other.y', '3:1']

Properties§

public int $line
public string|null $file
public Location $location

Methods§

public function __construct(
    public int $line,
    public string|null $file,
    public Location $location,
)

Parameters

$lineintThe line number the next line gets
$filestring|nullThe file name given, or null when the directive names none
$locationLocationWhere the directive is written
public function location(): Location

{@inheritDoc}

Returns

Test cases 1

Test cases 9§

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 8

Relations§

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