classDialectParser
final class DialectParser
Restricted visibility: declared "@visibility SqlSemantics". Code outside that scope must not name this declaration.
Selects and reuses the syntax parser for the semantic phase's language context.
Methods§
public function __construct(Dialect $dialect, string|null $version = null)Parameters
$dialect | Dialect | |
$version | string|null | A release tag shipped by sql-parser |
Calls 1
- method-call Dialect::platform() line 25
public function parse(string $sql): NodeParses SQL without discarding source trivia or locations.
Parameters
$sql | string |
Returns
NodeThrows
LexicalException When SQL contains invalid tokensSyntaxException When SQL does not match the grammarTest cases 1
Called from 5
- method-call SqlSemantics\Core\Analysis\Analyzer::analyze() packages/sql-semantics/src/Core/Analysis/Analyzer.php:40
- method-call SqlSemantics\Core\Ast\DialectParser::parseScript() packages/sql-semantics/src/Core/Ast/DialectParser.php:49
- method-call SqlSemantics\Core\Ast\DialectParser::parseScript() packages/sql-semantics/src/Core/Ast/DialectParser.php:58
- method-call SqlSemantics\Core\Ast\DialectParser::parseScript() packages/sql-semantics/src/Core/Ast/DialectParser.php:71
- method-call SqlSemantics\Core\Binder::bind() packages/sql-semantics/src/Core/Binder.php:47
Calls 1
- method-call SqlParser::parse() line 36
public function parseScript(string $sql): list<Node>Reads a script using lexer boundaries and complete grammar acceptance. Compound statements keep their internal semicolons because incomplete prefixes cannot be parsed as complete commands.
Parameters
$sql | string |
Returns
list<Node>Throws
SourceException When any command is invalidTest cases 2
Called from 1
Calls 4
- method-call DialectParser::parse() line 49
- method-call SqlParser::tokenize() line 53
- function-call
substrline 58 - function-call
array_filterline 70
public function version(): stringReturns the resolved grammar release so binding can reuse the declaration language.
Returns
stringTest cases 2
Called from 6
- method-call SqlSemantics\Core\Analysis\Analyzer::__construct() packages/sql-semantics/src/Core/Analysis/Analyzer.php:29
- method-call SqlSemantics\Core\Analysis\SchemaAnalyzer::read() packages/sql-semantics/src/Core/Analysis/SchemaAnalyzer.php:58
- method-call SqlSemantics\Core\Analysis\SchemaAnalyzer::read() packages/sql-semantics/src/Core/Analysis/SchemaAnalyzer.php:61
- method-call SqlSemantics\Core\Ast\ColumnReader::__construct() packages/sql-semantics/src/Core/Ast/ColumnReader.php:26
- method-call SqlSemantics\Core\Ast\ConstraintReader::__construct() packages/sql-semantics/src/Core/Ast/ConstraintReader.php:25
- method-call SqlSemantics\Core\Ast\SchemaReader::__construct() packages/sql-semantics/src/Core/Ast/SchemaReader.php:29
Calls 1
- method-call SqlParser::version() line 82
Private surface 1§
Implementation details, listed for orientation only.
private SqlParser $parserTest cases 72§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
DialectParserTest::testParseScriptPreservesStringAndRoutineSemicolonscallsDialectParserTest::testParseScriptRejectsAnInvalidTrailingCommandcallsDialectParserTest::testParseUsesTheRequestedGrammarAndRetainsSqlcallsDialectParserTest::testRejectsAnUnavailableGrammarReleasecallsDialectParserTest::testVersionReturnsTheResolvedReleasecalls
Other tests reaching this symbol 67
AnalyzerTestcallsSchemaAnalyzerTestcallsValueReaderTestcallsAnalysisExceptionTestcallsColumnPropertiesTestcallsColumnReaderTestcallsConstraintReaderTestcallsIdentifiersTestcallsSchemaChangesTestcallsSchemaReaderTestcallsStatementListTestcallsTokenGroupsTestcallsTreeTestcallsTypeReaderTestcallsBinderTestcallsBoundRelationTestcallsExpressionBinderTestcallsExpressionRulesTestcallsFromBinderTestcallsIdentitySequenceTestcallsLiteralBinderTestcallsNullFactsTestcallsProjectionBinderTestcallsScopeTestcallsSelectBinderTestcallsSelectModifiersBinderTestcallsSyntaxGuardTestcallsTableResolverTestcallsTypeResolutionTestcallsDialectTestcallsBoundSelectTestcallsColumnBindingTestcallsExpressionKindTestcallsExpressionTestcallsJoinKindTestcallsJoinTestcallsOrderingTestcallsOutputColumnTestcallsTableUseTestcallsPlatformTest::testParserAcceptsAnApplicationImplementationcallsNameRulesTestcallsQueryRulesTestcallsSchemaRulesTestcallsSyntaxRulesTestcallsTypeRulesTestcallsColumnDefinitionTestcallsColumnGenerationTestcallsConstraintKindTestcallsGenerationKindTestcallsInvariantTestcallsTableConstraintTestcallsTableDefinitionTestcallsSchemaBuilderTestcallsSchemaTestcallsSemanticExceptionTestcallsNullabilityTestcallsTypeDescriptorTestcallsSchemaTestcallsSemanticsTestcallsNameRulesTestcallsPlatformTestcallsQueryRulesTestcallsSchemaRulesTestcallsElementTestcallsStatementTestcallsWriterTestcallsTypeRulesTestcalls
Relations§
Instantiated in 6
- new SqlSemantics\Core\Analysis\Analyzer::__construct() packages/sql-semantics/src/Core/Analysis/Analyzer.php:28
- new SqlSemantics\Core\Analysis\SchemaAnalyzer::__construct() packages/sql-semantics/src/Core/Analysis/SchemaAnalyzer.php:30
- new SqlSemantics\Core\Ast\ColumnReader::__construct() packages/sql-semantics/src/Core/Ast/ColumnReader.php:26
- new SqlSemantics\Core\Ast\ConstraintReader::__construct() packages/sql-semantics/src/Core/Ast/ConstraintReader.php:25
- new SqlSemantics\Core\Ast\SchemaReader::__construct() packages/sql-semantics/src/Core/Ast/SchemaReader.php:29
- new SqlSemantics\Core\Binder::__construct() packages/sql-semantics/src/Core/Binder.php:31
Method calls 9
- method-call SqlSemantics\Core\Analysis\Analyzer::__construct() packages/sql-semantics/src/Core/Analysis/Analyzer.php:29
- method-call SqlSemantics\Core\Analysis\Analyzer::analyze() packages/sql-semantics/src/Core/Analysis/Analyzer.php:40
- method-call SqlSemantics\Core\Analysis\SchemaAnalyzer::read() packages/sql-semantics/src/Core/Analysis/SchemaAnalyzer.php:56
- method-call SqlSemantics\Core\Analysis\SchemaAnalyzer::read() packages/sql-semantics/src/Core/Analysis/SchemaAnalyzer.php:58
- method-call SqlSemantics\Core\Analysis\SchemaAnalyzer::read() packages/sql-semantics/src/Core/Analysis/SchemaAnalyzer.php:61
- method-call SqlSemantics\Core\Ast\ColumnReader::__construct() packages/sql-semantics/src/Core/Ast/ColumnReader.php:26
- method-call SqlSemantics\Core\Ast\ConstraintReader::__construct() packages/sql-semantics/src/Core/Ast/ConstraintReader.php:25
- method-call SqlSemantics\Core\Ast\SchemaReader::__construct() packages/sql-semantics/src/Core/Ast/SchemaReader.php:29
- method-call SqlSemantics\Core\Binder::bind() packages/sql-semantics/src/Core/Binder.php:47