classSyntaxException
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.
$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 // => 14Properties§
public Token $tokenpublic list<string> $expectedMethods§
public function __construct(public Token $token, public list<string> $expected, string $source)Parameters
$token | Token | The token that was rejected |
$expected | list<string> | Terminal names the parser would have accepted |
$source | string | The SQL text |
Calls 5
- static-call SourcePosition::at() line 34
- function-call
implodeline 38 - function-call
array_sliceline 38 - function-call
countline 38 - static-call SourceException::__construct() line 40
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
SchemaAnalyzerTest::testReadPreservesCompatibilitySyntaxErrorscallsDialectParserTest::testParseScriptRejectsAnInvalidTrailingCommandcallsBinderTest::testBindPropagatesSyntaxErrorscallsSchemaBuilderTest::testBuildPropagatesInvalidDdlSyntaxcallsFormatterTest::testFormatRejectsInvalidInputcallsMySqlParserTest::testParseRejectsAStatementThatEndsEarlycallsMySqlParserTest::testParseRejectsSyntaxTheReleaseLackscallsLrParserTest::testParseRejectsAnUnexpectedTokencallsPostgreSqlParserTest::testParseRejectsAChainedComparisoncallsSqliteParserTest::testParseRejectsAStatementThatEndsEarlycalls