classDirectives
final class Directives
The directives Bison's scanner knows, and the spellings it accepts for them.
Bison accepts an underscore for the hyphen of a few old directives and reads %term, %binary and %defines as %token, %nonassoc and %header. The canonical name is the modern hyphenated one.
Constants§
public const SPELLINGS = ['binary' => 'nonassoc', 'code' => 'code', 'debug' => 'debug', 'default-prec' =…Canonical name by every accepted spelling, without the percent sign.
public const FLAGS = ['debug', 'default-prec', 'error-verbose', 'fixed-output-files', 'glr-parser', …Directives that take no argument.
public const OPTIONS = ['file-prefix' => false, 'header' => true, 'language' => false, 'name-prefix' =…Directives that take a string, and whether the string may be omitted.
public const EQUAL_OPTIONAL = ['file-prefix', 'name-prefix', 'output']Directives after which the scanner swallows an optional = before the argument.
public const DASH_OR_UNDERSCORE = ['default-prec', 'error-verbose', 'expect-rr', 'fixed-output-files', 'name-pref…Directives Bison also reads with underscores in place of any of the dashes, as deprecated spellings.
Methods§
public static function canonical(string $spelling): string|nullAnswers the canonical name of a directive as spelled.
Parameters
$spelling | string | The directive without its percent sign, as written |
Returns
string|null The canonical name, or null when Bison knows no such directiveTest cases 1
Called from 1
Calls 4
- class-const Directives::SPELLINGS() line 100
- function-call
str_replaceline 103 - function-call
in_arrayline 105 - class-const Directives::DASH_OR_UNDERSCORE() line 105
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
BisonGrammarCompilerTestcallsBisonGrammarReaderTestcallsParserTestcallsScannerTestcallsDeclarationParserTestcallsGrammarParserTestcallsRuleParserTestcallsSymbolListParserTestcalls
Relations§
Static calls 1
Constant reads 4
- class-const BisonParser\Scanner\Scanner::percent() packages/bison-parser/src/Scanner/Scanner.php:164
- class-const BisonParser\Syntax\DeclarationParser::directive() packages/bison-parser/src/Syntax/DeclarationParser.php:112
- class-const BisonParser\Syntax\DeclarationParser::directive() packages/bison-parser/src/Syntax/DeclarationParser.php:115
- class-const BisonParser\Syntax\DeclarationParser::directive() packages/bison-parser/src/Syntax/DeclarationParser.php:116