final class GrammarParser
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Reads a whole grammar file, following the input rule of parse-gram.y.

Methods§

public function __construct(
    private DeclarationParser $declarations = new \BisonParser\Syntax\DeclarationParser(),
    private RuleParser $rules = new \BisonParser\Syntax\RuleParser(),
)

Parameters

$declarationsDeclarationParserReads declarations
$rulesRuleParserReads rules
Calls 2
public function parse(TokenStream $tokens): GrammarFile

Reads the file.

Parameters

$tokensTokenStreamTokens of the whole file

Returns

GrammarFile The file

Throws

SyntaxException When the file is not written as declarations, `%%`, rules and an optional epilogue
Test cases 8
Called from 1
Calls 18

Private surface 2§

Implementation details, listed for orientation only.

private DeclarationParser $declarations = new \BisonParser\Syntax\DeclarationParser()
private RuleParser $rules = new \BisonParser\Syntax\RuleParser()

Test cases 11§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 8
Other tests reaching this symbol 3

Relations§

Instantiated in 1
Method calls 1
Type declarations 1