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|null

Reads the number at the cursor, if one starts there.

Parameters

$scanScanThe tokenization in progress
$wordsWordScannerReads the identifier a number turns out to be

Returns

Lexeme|null The lexeme, or null when no digit starts here
Test cases 2
Called from 1
Calls 7
public function fraction(Scan $scan, int $start): Lexeme

Reads the fraction and exponent of a number whose integer part is behind the cursor.

Parameters

$scanScanThe tokenization in progress, positioned on the decimal point
$startintOffset the number began at

Returns

Lexeme A decimal or float lexeme
Test cases 1
Called from 2
Calls 1
public static function integerTerminal(string $digits): string

Names the narrowest integer terminal that holds a run of digits.

Parameters

$digitsstringThe digits as written

Returns

string One of NUM, LONG_NUM, ULONGLONG_NUM and DECIMAL_NUM
Test cases 1
Called from 1
Calls 3

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

Relations§

Instantiated in 1
Method calls 1
Type declarations 1