classLookaheadFilter
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§
Applies the substitutions to a lexeme sequence.
Parameters
$lexemes | list<Lexeme> | Lexemes as scanned |
$source | string | The SQL text |
Returns
list<Lexeme> Lexemes as the parser receives themThrows
LexicalException When a `UESCAPE` clause is malformedTest cases 2
Called from 1
Calls 5
- function-call
countline 47 - class-const LookaheadFilter::SUBSTITUTIONS() line 50
- function-call
in_arrayline 51 - new Lexeme line 52
- method-call LookaheadFilter::unicode() line 54
public function unicode(
Lexeme $lexeme,
list<Lexeme> $lexemes,
int &$index,
string $source,
): LexemeFinishes a Unicode literal, taking in its UESCAPE clause when one follows.
Parameters
Returns
Lexeme The plain identifier or stringThrows
LexicalException When `UESCAPE` is not followed by a one-character stringTest cases 2
Called from 1
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
PostgreSqlLexerTestcallsPostgreSqlParserTestcalls