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

The parser met a token the grammar does not allow at that point.

Reading what the parser expecteddoctest
$end = new \SqlParser\Lexer\Token(0, '$end', '', 13);
    $e = new \SqlParser\Parser\SyntaxException($end, ['IDENT'], 'SELECT 1 FROM');
    $e->getMessage() // => 'Unexpected end of input at line 1, column 14, expected IDENT'
    $e->position->column // => 14

Properties§

public Token $token
public list<string> $expected

Methods§

public function __construct(public Token $token, public list<string> $expected, string $source)

Parameters

$tokenTokenThe token that was rejected
$expectedlist<string>Terminal names the parser would have accepted
$sourcestringThe SQL text
Calls 5

Test cases 13§

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

Dedicated tests 3
Other tests reaching this symbol 10

Relations§

Instantiated in 1