classRadixSpelling
final class RadixSpelling
Reads and spells the digits of a hexadecimal or bit literal token.
Rule: MYSQL-RADIX-DECODE-001. Scope: the terminals HEX_NUM and BIN_NUM. Both spellings of each literal, X'1F' and 0x1F, b'101' and 0b101, denote the same value: the digits between the quotes or after the prefix. The digits are kept exactly, leading zeros and letter case included. Terminates: constant work per token. Source: https://dev.mysql.com/doc/refman/8.4/en/hexadecimal-literals.html, https://dev.mysql.com/doc/refman/8.4/en/bit-value-literals.html. Status: Implemented.
Methods§
public function digits(string $text): stringAnswers the digits of a hexadecimal or bit literal token text.
Parameters
$text | string |
Returns
stringTest cases 4
Called from 8
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::constant() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:153
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::constant() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:154
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::constant() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:155
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::constant() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:156
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::text() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:247
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\NumberRule::numeral() packages/sql-semantics-mysql/src/Lowering/Leaf/NumberRule.php:74
- method-call SqlSemantics\Platform\MySql\Rules\LeafKeys::terminal() packages/sql-semantics-mysql/src/Rules/LeafKeys.php:115
- method-call SqlSemantics\Platform\MySql\Rules\LeafKeys::terminal() packages/sql-semantics-mysql/src/Rules/LeafKeys.php:116
Calls 1
- function-call
substrline 28
public function hexadecimal(string $digits): stringSpells hexadecimal digits: quoted when their count is even, with the 0x prefix otherwise.
The quoted spelling requires an even count and is the only spelling of no digits at all; the prefixed spelling reads an odd count as having a leading zero. Either spelling answers the same digits to digits().
Parameters
$digits | string |
Returns
stringTest cases 2
Called from 3
- method-call SqlSemantics\Platform\MySql\Statement\Literal\Numeral::render() packages/sql-semantics-mysql/src/Statement/Literal/Numeral.php:47
- method-call SqlSemantics\Platform\MySql\Statement\Literal\RadixLiteral::render() packages/sql-semantics-mysql/src/Statement/Literal/RadixLiteral.php:82
- method-call SqlSemantics\Platform\MySql\Statement\Literal\Text::render() packages/sql-semantics-mysql/src/Statement/Literal/Text.php:51
Calls 1
- function-call
strlenline 40
public function bits(string $digits): stringSpells bit digits in the quoted spelling, which holds any count of digits.
Parameters
$digits | string |
Returns
stringTest cases 1
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
RadixSpellingTest::testBitsQuotesAnyCountOfDigitscallsRadixSpellingTest::testDigitsReadsBothSpellingsOfABitLiteralcallsRadixSpellingTest::testDigitsReadsBothSpellingsOfAHexadecimalLiteralcallsRadixSpellingTest::testHexadecimalQuotesAnEvenCountAndPrefixesAnOddCountcallsRadixSpellingTest::testHexadecimalRoundTripsThroughDigitscalls
Relations§
Instantiated in 9
- new SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::constant() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:147
- new SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::text() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:247
- new SqlSemantics\Platform\MySql\Lowering\Leaf\NumberRule::numeral() packages/sql-semantics-mysql/src/Lowering/Leaf/NumberRule.php:74
- new SqlSemantics\Platform\MySql\Rules\LeafKeys::terminal() packages/sql-semantics-mysql/src/Rules/LeafKeys.php:115
- new SqlSemantics\Platform\MySql\Rules\LeafKeys::terminal() packages/sql-semantics-mysql/src/Rules/LeafKeys.php:116
- new SqlSemantics\Platform\MySql\Statement\Literal\Numeral::render() packages/sql-semantics-mysql/src/Statement/Literal/Numeral.php:47
- new SqlSemantics\Platform\MySql\Statement\Literal\RadixLiteral::render() packages/sql-semantics-mysql/src/Statement/Literal/RadixLiteral.php:82
- new SqlSemantics\Platform\MySql\Statement\Literal\Text::render() packages/sql-semantics-mysql/src/Statement/Literal/Text.php:51
- new SqlSemantics\Platform\MySql\Statement\Literal\Text::render() packages/sql-semantics-mysql/src/Statement/Literal/Text.php:52
Method calls 13
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::constant() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:153
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::constant() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:154
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::constant() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:155
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::constant() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:156
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\LiteralRule::text() packages/sql-semantics-mysql/src/Lowering/Leaf/LiteralRule.php:247
- method-call SqlSemantics\Platform\MySql\Lowering\Leaf\NumberRule::numeral() packages/sql-semantics-mysql/src/Lowering/Leaf/NumberRule.php:74
- method-call SqlSemantics\Platform\MySql\Rules\LeafKeys::terminal() packages/sql-semantics-mysql/src/Rules/LeafKeys.php:115
- method-call SqlSemantics\Platform\MySql\Rules\LeafKeys::terminal() packages/sql-semantics-mysql/src/Rules/LeafKeys.php:116
- method-call SqlSemantics\Platform\MySql\Statement\Literal\Numeral::render() packages/sql-semantics-mysql/src/Statement/Literal/Numeral.php:47
- method-call SqlSemantics\Platform\MySql\Statement\Literal\RadixLiteral::render() packages/sql-semantics-mysql/src/Statement/Literal/RadixLiteral.php:82
- method-call SqlSemantics\Platform\MySql\Statement\Literal\RadixLiteral::render() packages/sql-semantics-mysql/src/Statement/Literal/RadixLiteral.php:82
- method-call SqlSemantics\Platform\MySql\Statement\Literal\Text::render() packages/sql-semantics-mysql/src/Statement/Literal/Text.php:51
- method-call SqlSemantics\Platform\MySql\Statement\Literal\Text::render() packages/sql-semantics-mysql/src/Statement/Literal/Text.php:52