classNumberScanner
final class NumberScanner
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Reads MySQL's numeric literals and the identifiers that begin with a digit.
An integer becomes the narrowest of NUM, LONG_NUM and ULONGLONG_NUM that holds it, and DECIMAL_NUM beyond that. Digits followed by letters are an identifier, unless the letter is an exponent.
Methods§
public function scan(Scan $scan, WordScanner $words): Lexeme|nullReads the number at the cursor, if one starts there.
Parameters
$scan | Scan | The tokenization in progress |
$words | WordScanner | Reads the identifier a number turns out to be |
Returns
Lexeme|null The lexeme, or null when no digit starts hereTest cases 2
Called from 1
Calls 7
- function-call
ctype_digitline 32 - method-call NumberScanner::fraction() line 33
- static-call Scan::isIdentifierByte() line 39
- method-call Scan::lexeme() line 40
- function-call
strtolowerline 40 - method-call WordScanner::identifier() line 53
- static-call NumberScanner::integerTerminal() line 56
Reads the fraction and exponent of a number whose integer part is behind the cursor.
Parameters
$scan | Scan | The tokenization in progress, positioned on the decimal point |
$start | int | Offset the number began at |
Returns
Lexeme A decimal or float lexemeTest cases 1
Called from 2
Calls 1
- method-call Scan::lexeme() line 74
public static function integerTerminal(string $digits): stringNames the narrowest integer terminal that holds a run of digits.
Parameters
$digits | string | The digits as written |
Returns
string One of NUM, LONG_NUM, ULONGLONG_NUM and DECIMAL_NUMTest cases 1
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
MySqlLexerTestcallsMySqlParserTestcalls