← All compilation units

Flyology_JSON.Numbers.Signed_Integers

Description

Parse

procedure Parse
  (Lexeme : Ada.Streams.Stream_Element_Array; Result : out Parse_Result)

Parse accepts only a complete strict JSON integer spelling. Fractions and exponents are invalid syntax, -0 converts to zero, and range is detected before arithmetic overflow. No failure publishes a Value.

Parameters
Lexeme
Result

Parse_Result

type Parse_Result is record
   Status : Parse_Status;
   Value  : Value_Type;
end record;

Definite so a constrained out actual cannot fail copy-out. Value is eligible only when Status = Converted; otherwise it remains a valid but unspecified Value_Type value.

Record fields
Status
Value

Parse_Status

type Parse_Status is (Converted, Invalid_Syntax, Below_Range, Above_Range);
Enumeration literals
Converted
Invalid_Syntax
Below_Range
Above_Range

Render

procedure Render
  (Value    : Value_Type;
   Output   : in out Ada.Streams.Stream_Element_Array;
   Produced : out Ada.Streams.Stream_Element_Count;
   Status   : out Numbers.Render_Status)

Render emits exact base ten without a leading zero, exponent, or plus. On insufficient capacity it returns Produced = 0 and leaves Output unchanged. This integer operation never returns Unsupported_Value.

Parameters
Value
Output
Produced
Status

Value_Type

type Value_Type is range <>;