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

Lowers the number productions of positions that are not expressions.

Rule: MYSQL-NUMERAL-001. Scope: ulong_num, real_ulong_num, ulonglong_num, real_ulonglong_num, dec_num, dec_num_error, size_number, option_autoextend_size, ternary_option, and the bare NUM tokens of other families' productions. A number keeps its exact text; a hexadecimal literal keeps its digits. The rules real_ulong_num and real_ulonglong_num accept a decimal or floating number through dec_num_error, which the server rejects when it parses; the number is structured as written and the statement that holds it reports the problem. A size is a number or a word such as 16M. Constructs: Numeral, ByteSize. Terminates: unit productions over strict subtrees. Source: https://dev.mysql.com/doc/refman/8.4/en/number-literals.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function token(Token $token): Numeral

Lowers a bare NUM token that a production of another family holds, such as the count of IGNORE 2 LINES.

Productions such as opt_ignore_lines, func_datetime_precision or vcpu_num_or_range take the NUM token itself instead of a number nonterminal; the token is a decimal integer and keeps its exact text.

Parameters

$tokenToken

Returns

Test cases 2
Calls 3
public function size(Node $size): ByteSize

Lowers a size in bytes, written alone or as the AUTOEXTEND_SIZE option.

Parameters

$sizeNode

Returns

Throws

ImplementationGap When the production has no rule
Test cases 1
Called from 1
Calls 4
public function ternary(Node $option): ?Numeral

Lowers an option value that is a number or the keyword DEFAULT; DEFAULT is null.

Parameters

$optionNode

Returns

Throws

ImplementationGap When the production has no rule
Test cases 1
Calls 2

Private surface 3§

Implementation details, listed for orientation only.

private const TOKENS = ['ulong_num: NUM' => false, 'ulong_num: HEX_NUM' => true, 'ulong_num: LONG_NUM'…
private const FORWARD = ['real_ulong_num: dec_num_error' => true, 'real_ulonglong_num: dec_num_error' =…
private Lowering $lowering

Test cases 6§

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

Dedicated tests 6

Relations§

Instantiated in 1
Type declarations 1