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

The token substitutions PostgreSQL makes between its scanner and its parser.

A few keywords mean something else when a particular keyword follows: NOT before LIKE is the NOT of the predicate, WITH before TIME belongs to a type name. The parser's own lexer wrapper looks one token ahead and renames them, and it also finishes Unicode literals, which may carry their escape character in a following UESCAPE clause.

Constants§

public const SUBSTITUTIONS = ['FORMAT' => ['FORMAT_LA', ['JSON']], 'NOT' => ['NOT_LA', ['BETWEEN', 'IN_P', '…

Renamed terminal by the terminal that precedes a listed one.

Methods§

public function apply(list<Lexeme> $lexemes, string $source): list<Lexeme>

Applies the substitutions to a lexeme sequence.

Parameters

$lexemeslist<Lexeme>Lexemes as scanned
$sourcestringThe SQL text

Returns

list<Lexeme> Lexemes as the parser receives them

Throws

LexicalException When a `UESCAPE` clause is malformed
Test cases 2
Called from 1
Calls 5
public function unicode(
    Lexeme $lexeme,
    list<Lexeme> $lexemes,
    int &$index,
    string $source,
): Lexeme

Finishes a Unicode literal, taking in its UESCAPE clause when one follows.

Parameters

$lexemeLexemeThe Unicode identifier or string
$lexemeslist<Lexeme>Every lexeme, to look ahead in
$indexintPosition of the literal, advanced past the clause
$sourcestringThe SQL text

Returns

Lexeme The plain identifier or string

Throws

LexicalException When `UESCAPE` is not followed by a one-character string
Test cases 2
Called from 1
Calls 5

Test cases 6§

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

Dedicated tests 4
Other tests reaching this symbol 2

Relations§

Instantiated in 1
Method calls 1
Type declarations 1