final class SyntaxException
    extends RuntimeException
Public API: explicitly declared with @visibility public.

The grammar file is not written the way Bison would accept it.

Reporting where a file is wrongdoctest
$exception = \BisonParser\SyntaxException::unexpected("a rule or ';'", "'|'", new \BisonParser\Ast\Location(3, 1));
    $exception->getMessage() // => "Expected a rule or ';' but found '|' at 3:1"
    (string) $exception->location // => "3:1"

Properties§

public Location $location

Methods§

public function __construct(string $message, public Location $location)

Parameters

$messagestringWhat is wrong
$locationLocationWhere it is wrong
Calls 1
  • static-call RuntimeException::__construct() line 28
public static function unexpected(string $expected, string $found, Location $location): self

Describes something other than what the grammar language allows at a position.

Parameters

$expectedstringWhat was expected
$foundstringWhat was met instead
$locationLocationWhere it was met

Returns

self The exception
Test cases 1
Called from 14
Calls 1

Test cases 71§

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

Dedicated tests 4
Other tests reaching this symbol 67

Relations§

Static calls 32