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

The typed, temporary output a statement structure is written to.

Nodes add keywords, punctuation, names and literal spellings; there is no operation that adds a free SQL fragment. The pieces are joined into text by the lexical writer and the result is parsed again and compared with the structure before an operation is published.

Methods§

public function __construct(private Codec $codec)

Parameters

$codecCodecThe name codec of the language profile
public function keyword(string ...$words): $this

Writes fixed keywords.

Parameters

$wordsstring

Returns

$this
Test cases 2
Called from 856
Calls 4
public function symbol(string $symbol): $this

Writes punctuation or an operator made of symbol characters only.

Parameters

$symbolstring

Returns

$this
Called from 117
Calls 4
public function name(Name $name, NameUse $use = NameUse::Column): $this

Writes a decoded name, spelled by the profile codec for its position.

Parameters

$nameName
$useNameUse

Returns

$this
Called from 153
Calls 4
public function spelled(string $text): $this

Writes the spelling a literal or parameter value produces from its exact value.

Parameters

$textstring

Returns

$this
Called from 10
Calls 3
public function glue(): $this

Joins the next piece to the previous one without a separating space.

Returns

$this
Called from 16
public function node(?Node $node): $this

Writes a child node, when there is one.

Parameters

$node?Node

Returns

$this
Called from 175
public function list(list<Node> $nodes, string $separator = ','): $this

Writes child nodes separated by a symbol.

Parameters

$nodeslist<Node>
$separatorstring

Returns

$this
Test cases 5
Called from 21
Calls 1
public function layout(?Layout $layout, Node $node): $this

Writes a node in the spelling of a layout, or regularly when there is none.

The node renders its pieces as always; each piece then takes the spelling and the preceding trivia of the layout token at its position, and the next piece written takes the trailing trivia of the layout. Inside a spelled region a nested layout has no effect, since the outer layout spells every token of the region.

Parameters

$layout?Layout
$nodeNode

Returns

$this

Throws

InvariantViolation When the layout does not have one token per rendered piece
Called from 2
Calls 5
public function trailing(): string

Answers the trivia a layout wrote after the last piece, when nothing followed it.

Returns

string
Called from 1
public function canonical(): list<Piece>

Answers the pieces as the structure renders them, before any layout re-spelled them, for validation.

Returns

list<Piece>
Called from 1
public function pieces(): list<Piece>

Answers the pieces written so far.

Returns

list<Piece>
Test cases 212
Called from 2

Private surface 6§

Implementation details, listed for orientation only.

private list<Piece> $pieces = []
private bool $glue = false
private bool $spelling = false
private ?string $trail = null
private list<Piece> $canonical = []
private Codec $codec

Test cases 213§

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

Other tests reaching this symbol 213

Relations§

Instantiated in 2
Method calls 1353
Type declarations 560