classLine
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.
$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 $linepublic string|null $filepublic Location $locationMethods§
public function __construct(
public int $line,
public string|null $file,
public Location $location,
)Parameters
$line | int | The line number the next line gets |
$file | string|null | The file name given, or null when the directive names none |
$location | Location | Where the directive is written |
public function location(): LocationTest cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
LineTest::testLocationcalls
Other tests reaching this symbol 8
TreeDumper::declarationLinecallsTreeDumper::itemcallsDeclarationPrinterTest::testLinecallsPrinterTest::testPrintcallsRhsPrinterTest::testPrintcallsDeclarationParserTest::testParseReadsALineDirectivecallsGrammarParserTest::testParseKeepsLineDirectivesAmongTheRulescallsRuleParserTest::testItemKeepsALineDirectivecalls