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

Reports that grammar source text could not be turned into a grammar.

Bison and Lemon grammars are read from files that ship with the server they describe, so a grammar that declares tokens but no rules, or that ends before its rules section, is a property of the input rather than a defect in the parser. Callers that load grammars at runtime are expected to handle this.

Methods§

public static function noRulesParsed(string $dialect): self

Reports grammar source that yielded no production rules.

Parameters

$dialectstringGrammar flavour that was being read, e.g. "Bison"

Returns

self Exception naming the grammar flavour
Test cases 2
Called from 2
Calls 1
public static function unreadableSource(string $path): self

Reports a grammar file that could not be read from disk.

Parameters

$pathstringPath that was asked for

Returns

self Exception naming the path
Test cases 1
Called from 2
Calls 1
public static function unexpectedCharacter(string $character, int $offset): self

Reports a character that starts no lexeme of the grammar language.

Parameters

$characterstringThe character that was reached
$offsetintWhere in the source it sits

Returns

self Exception naming the character and its position
Test cases 1
Called from 1
Calls 1
public static function danglingSlash(int $offset): self

Reports a slash that opens neither comment form.

Parameters

$offsetintWhere the slash sits

Returns

self Exception naming the position
Test cases 1
Called from 1
Calls 1
public static function namelessDirective(int $offset): self

Reports a percent sign with no directive name after it.

Parameters

$offsetintWhere the percent sign sits

Returns

self Exception naming the position
Test cases 1
Called from 1
Calls 1
public static function unterminatedTypeTag(int $offset): self

Reports a semantic type tag that is never closed.

Parameters

$offsetintWhere the tag opens

Returns

self Exception naming the position the tag opened at
Test cases 1
Called from 1
Calls 1

Test cases 33§

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

Dedicated tests 7
Other tests reaching this symbol 26

Relations§

Static calls 8