final class NumberScanner
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Reads PostgreSQL's numeric literals and positional parameters.

An integer that fits in 32 bits is ICONST and any other number is FCONST, whatever its base. A digit followed by a letter, and a parameter followed by one, are the trailing junk the scanner rejects.

Methods§

public function scan(Scan $scan): Lexeme|null

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

Parameters

$scanScanThe tokenization in progress

Returns

Lexeme|null The lexeme, or null when no number starts here

Throws

LexicalException When the literal is malformed or followed by junk
Test cases 4
Called from 1
Calls 6
public function rejectJunk(Scan $scan, int $start): void
public static function fitsInt32(string $literal): bool

Reports whether an integer literal, in any base, fits in a signed 32-bit integer.

Parameters

$literalstringThe literal as written, underscores included

Returns

bool True when it fits
Test cases 1
Called from 2
Calls 6

Test cases 8§

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

Dedicated tests 6
Other tests reaching this symbol 2

Relations§

Instantiated in 1
Method calls 1
Type declarations 1