final class TriviaRule
Restricted visibility: declared "@visibility SqlSemantics\Platform\Sqlite". Code outside that scope must not name this declaration.

Answers the whitespace and comments written after a region of a command.

Rule: SQLITE-TRIVIA-001. SQLite takes the name of an unaliased result column from the text between its first token and the start of the token that follows it (scanpt in parse.y, sqlite3ExprListSetSpan() in expr.c), so a comment written after the expression is part of the name. The trivia after a region is the leading trivia of the next token of the command; every command ends with a semicolon, which the parser supplies with the trivia at the end of the input when none is written, so a region inside a command is always followed by a token. Source: https://sqlite.org/c3ref/column_name.html. Status: Implemented.

Methods§

public function __construct()

Starts without an indexed command.

Calls 1
public function index(Node $command): void
public function after(Node $region): string

Answers the trivia written between the last token of a region and the next token of its command.

Parameters

$regionNode

Returns

string

Throws

InvariantViolation When the region is empty or its command was not indexed
Test cases 4
Calls 3

Private surface 1§

Implementation details, listed for orientation only.

private WeakMap<Token, string> $following

Test cases 4§

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

Dedicated tests 4

Relations§

Instantiated in 1
Method calls 1
Type declarations 1