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

Reads the exact value of a PostgreSQL numeric constant token without floating point.

Rule: PG-LEX-NUMBER-001. Scope: the ICONST and FCONST terminals. A constant written as an integer, in decimal, hexadecimal (0x), octal (0o) or binary (0b) digits with optional underscores between digits, is the integer it denotes whatever its size. The scanner makes it an ICONST holding that integer when it fits 32 bits (process_integer_literal in scan.l); otherwise, and for every constant written with a decimal point or an exponent, it makes an FCONST that holds the written text itself (a T_Float node keeps the string), because the parser does not yet know the type the value is read as. Commands such as SET, storage parameters and trigger arguments receive that text verbatim, so 1e2 and 100. are different values there. Source: https://www.postgresql.org/docs/17/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC, process_integer_literal and the {numeric}, {real} rules of src/backend/parser/scan.l of PostgreSQL 17. Termination: one pass over the digits per conversion step. Status: Implemented.

Methods§

public function integral(string $text): bool

Tells whether a numeric token is written as an integer.

Parameters

$textstring

Returns

bool
Test cases 1
Called from 1
Calls 1
public function integer(string $text): ?string

Answers the canonical decimal digits of the integer a constant written as an integer denotes, or null for one with a point or an exponent.

Parameters

$textstring

Returns

?string
Test cases 1
Called from 2
Calls 2
public function kept(string $text): bool

Tells whether a text is one constant the scanner reads as an FCONST and keeps as written.

That is a decimal number with a point, an exponent or both, or an integer spelling whose value does not fit 32 bits.

Parameters

$textstring

Returns

bool
Test cases 1
Called from 1
Calls 3
public function within(string $digits, string $limit): bool

Tells whether canonical decimal digits denote a value not above a canonical limit.

Parameters

$digitsstring
$limitstring

Returns

bool
Test cases 1
Called from 8
Calls 2

Test cases 6§

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

Dedicated tests 6

Relations§

Instantiated in 13
Method calls 18