classNumberRule
final class NumberRule
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
$lowering | Lowering | The lowering this rule belongs to |
Lowers a number.
Parameters
$number | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 2
Called from 2
Calls 6
- class-const NumberRule::FORWARD() line 68
- class-const NumberRule::TOKENS() line 71
- static-call ImplementationGap::production() line 71
- new Numeral line 74
- method-call RadixSpelling::digits() line 74
- new RadixSpelling line 74
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
$token | Token |
Returns
Test cases 2
Calls 3
- static-call Check::invariant() line 86
- method-call Token::is() line 86
- new Numeral line 88
Lowers a size in bytes, written alone or as the AUTOEXTEND_SIZE option.
Parameters
$size | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 4
- new ByteSize line 101
- method-call NumberRule::numeral() line 101
- method-call NumberRule::size() line 103
- static-call ImplementationGap::production() line 104
Lowers an option value that is a number or the keyword DEFAULT; DEFAULT is null.
Parameters
$option | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Calls 2
- method-call NumberRule::numeral() line 118
- static-call ImplementationGap::production() line 120
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 $loweringTest cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
NumberRuleTest::testNumeralKeepsTheDigitsOfEveryNumberTokencallsNumberRuleTest::testNumeralReportsAProductionWithoutARulecallsNumberRuleTest::testSizeLowersANumberOrAWordWithAUnitcallsNumberRuleTest::testTernaryLowersANumberOrDefaultcallsNumberRuleTest::testTokenKeepsTheTextOfABareNumberAndRecordsItcallsNumberRuleTest::testTokenRefusesATokenThatIsNotANumbercalls