interfaceBisonDirectiveReader
interface BisonDirectiveReader
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Reads the arguments of one kind of Bison declaration.
The eight declaration kinds share a spelling — a percent sign and a name — and nothing else: %expect takes a number, %token takes a list of names with optional codes and aliases, %parse-param takes a block of host code. Each shape is its own reader so that it can be exercised against the tokens it is meant to read, rather than through a whole grammar file.
Methods§
public function handles(string $directive): boolReports whether this reader knows the directive.
Parameters
$directive | string | Directive name including its percent sign, e.g. "%token" |
Returns
bool True when this reader should consume the argumentspublic function read(BisonTokenStream $stream, string $directive): BisonDeclaration|nullConsumes the directive's arguments from the stream.
Parameters
$stream | BisonTokenStream | Stream positioned just after the directive name |
$directive | string | Directive name including its percent sign |
Returns
BisonDeclaration|null The declaration, or null when the arguments were not the expected shapeTest cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Implemented by 8
- DefineDirectiveReader packages/sql-faker/src/Compiler/Bison/Directive/DefineDirectiveReader.php:23
- ExpectDirectiveReader packages/sql-faker/src/Compiler/Bison/Directive/ExpectDirectiveReader.php:18
- ParamDirectiveReader packages/sql-faker/src/Compiler/Bison/Directive/ParamDirectiveReader.php:22
- PrecedenceDirectiveReader packages/sql-faker/src/Compiler/Bison/Directive/PrecedenceDirectiveReader.php:23
- StartDirectiveReader packages/sql-faker/src/Compiler/Bison/Directive/StartDirectiveReader.php:18
- TokenDirectiveReader packages/sql-faker/src/Compiler/Bison/Directive/TokenDirectiveReader.php:23
- TypeDirectiveReader packages/sql-faker/src/Compiler/Bison/Directive/TypeDirectiveReader.php:21
- UnknownDirectiveReader packages/sql-faker/src/Compiler/Bison/Directive/UnknownDirectiveReader.php:21