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

Lowers the literal productions of every release into exact values.

Rule: MYSQL-LITERAL-001. Scope: literal, literal_or_null, null_as_literal, signed_literal, signed_literal_or_null, text_literal, NUM_literal, int64_literal, temporal_literal, param_marker, text_string, TEXT_STRING_sys, TEXT_STRING_sys_nonewline, TEXT_STRING_literal, TEXT_STRING_filesystem, TEXT_STRING_password, TEXT_STRING_hash, TEXT_STRING_validated, TEXT_STRING_sys_list, json_attribute. A quoted string is decoded by MYSQL-STRING-DECODE-001 under the escape setting of the profile; adjacent strings are the segments of one literal; an introducer or the national prefix belongs to the literal. A number keeps its exact text, a hexadecimal or bit literal its digits whatever its spelling. At an expression position the result is a scalar; at any other position it is a text operand. Every value is recorded as an operand leaf. Constructs: StringLiteral, NumberLiteral, RadixLiteral, NullLiteral, BooleanLiteral, TemporalLiteral, SignedLiteral, Parameter, Text. Terminates: the segment list is walked along its spine in a loop; every other child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/literals.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function literal(Node $literal): Scalar

Lowers a literal at an expression position.

Parameters

$literalNode

Returns

Throws

ImplementationGap When the production has no rule
Calls 9
public function string(Node $literal): StringLiteral

Lowers a character string literal with its adjacent segments, introducer and national prefix.

Parameters

$literalNode

Throws

ImplementationGap When a production has no rule
Called from 1
Calls 7
public function text(Node $string): Text
public function texts(Node $list): list<Text>

Lowers a comma-separated list of strings.

Parameters

$listNode

Returns

list<Text>

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 5
public function parameter(Node $marker): Parameter

Lowers a parameter marker.

Parameters

$markerNode

Returns

Throws

ImplementationGap When the production has no rule
Calls 2

Private surface 7§

Implementation details, listed for orientation only.

private const FORWARD = ['literal: text_literal' => true, 'literal: NUM_literal' => true, 'literal: tem…
private const NUMBERS = ['NUM_literal: NUM' => true, 'NUM_literal: LONG_NUM' => true, 'NUM_literal: ULO…
private const TEMPORAL = ['temporal_literal: DATE_SYM TEXT_STRING' => \SqlSemantics\Platform\MySql\State…
private const STRINGS = ['TEXT_STRING_sys: TEXT_STRING' => true, 'TEXT_STRING_literal: TEXT_STRING' => …
private const STRING_FORWARD = ['TEXT_STRING_sys_nonewline: TEXT_STRING_sys' => true, 'TEXT_STRING_hash: TEXT_…
private const RADIX_TEXT = ['TEXT_STRING_hash: HEX_NUM' => \SqlSemantics\Platform\MySql\Statement\Literal\…
private Lowering $lowering

Test cases 8§

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

Dedicated tests 8

Relations§

Instantiated in 1
Type declarations 1