interface SqlParser
Public API: explicitly declared with @visibility public.

A lossless SQL parser configured for a grammar release and lexical settings.

Consumers depend on this contract instead of enumerating concrete parsers.

Declare a consumer of the parsing contractdoctest
$roundTrip = static fn (\SqlParser\Parser\SqlParser $parser, string $sql): string => $parser->parse($sql)->toString();
    $roundTrip instanceof \Closure // => true

Methods§

public function version(): string

Returns the configured grammar release tag.

Returns

string
Test cases 1
public function tokenize(string $sql): list<Token>

Reads terminals, including their leading trivia and the end marker.

Parameters

$sqlstring

Returns

list<Token>

Throws

SourceException When the text cannot be tokenized
Test cases 1
Called from 10
public function parse(string $sql): Node

Reads a concrete syntax tree that preserves every byte of the input.

Parameters

$sqlstring

Returns

Throws

SourceException When the text is not accepted by the grammar
Test cases 1
Called from 19

Test cases 7§

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 4

Relations§

Implemented by 3
Method calls 29
Type declarations 17