Skip to main content

Module decimal

Module decimal 

Source
Expand description

A decimal literal is a genuine decimal.

The value is a BigDecimal; the lexeme is the text the literal was written with, which is what the wire carries (a JSON string) and what a writer emits. bigdecimal normalises what it parses, so the lexeme is the only record of the written scale and spelling: 10.50 and 10.5 denote the same number and are different literals, which is Java’s BigDecimal.equals rule and the rule the kit’s byte-wise canonical comparison needs.

The grammar is the one the v4 schema page states under “Literals”; both Rust models and the reference apply it before any parser sees the text, so what is refused does not depend on a library’s leniency.

Structs§

DecimalLiteral
A decimal literal: the number it denotes and the text it was written with.
InvalidDecimalLexeme
A string that is not a decimal lexeme.

Functions§

is_decimal_lexeme
Whether text is [+-]? ( digits ( "." digits? )? | "." digits ) ( [eE] [+-]? digits )?.