final class ValueReader
    uses Assertion
Restricted visibility: declared "@visibility SqlSemantics". Code outside that scope must not name this declaration.

Lowers transient parser nodes into typed SQL arguments and finite options.

A comment is kept by the outermost value whose symbol begins with the token the comment was written before. Comments before the first token and after the last one belong to the statement.

Type Aliases§

Recipe = array{forward: int}|array{constant: string}|array{class: class-string<Element>, fields: list<int>}

Methods§

public function __construct(
    private array<string, array<int, Recipe>> $recipes,
    private TriviaReader $trivia = new \SqlSemantics\Core\Analysis\TriviaReader(),
)

Parameters

$recipesarray<string, array<int, Recipe>>Complete construction vocabulary
$triviaTriviaReaderReads the comments of the language
Calls 2
public static function fromFile(string $path, TriviaReader|null $trivia = null): self

Loads the construction vocabulary supplied by a database package.

Parameters

$pathstring
$triviaTriviaReader|nullReads the comments of the language, or null to read them as plain block and line comments

Returns

self

Throws

LogicException When generated resources are missing or invalid
Called from 3
Calls 3
public function statement(Node $root): Statement

Lowers a complete parse tree into a statement that keeps its comments, and discards the tree.

Parameters

$rootNode

Returns

Throws

LogicException When parser and model resources disagree
Called from 1
Calls 7
public function lower(Node $node, SourceComments $comments, bool $firstKept): Element

Builds the value of a node, keeping the comments of the symbols it owns.

Parameters

$nodeNode
$commentsSourceCommentsThe comments of the tree the node belongs to
$firstKeptboolWhether an enclosing value or the statement already keeps the comments before the first token

Returns

Throws

LogicException When parser and model resources disagree
Called from 4
Calls 6

Private surface 3§

Implementation details, listed for orientation only.

private Comments $none
private array<string, array<int, Recipe>> $recipes
private TriviaReader $trivia = new \SqlSemantics\Core\Analysis\TriviaReader()

Test cases 17§

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

Dedicated tests 1
Other tests reaching this symbol 16

Relations§

Static calls 3
Method calls 7
Type declarations 12