parseNumber

Parse/validate a number from the given iopipe. This is used to validate the number follows the correct grammar from the JSON spec, and also to find out how many elements in the stream are used for this number.

int
parseNumber
(
Chain
)
(
ref Chain c
,
ref size_t pos
,)

Parameters

c Chain

The iopipe the number is being parsed from.

pos size_t

Upon calling, the position in the iopipe window where this number should start. Upon exit, if successfully parsed, this is the position after the last number element. If there was a parsing error, this is the position where the parsing error occurred.

hint JSONParseHint

Indicates upon return whether this number is integral, floating point, or a floating point with exponent. This can be used to parse the correct type using standard parsing techniques. Note that no attempt is made to verify the number will fit within, or can be properly represented by any type.

Return Value

Type: int

The number of elements in the iopipe that comprise this number, or -1 if there was a parsing error.

Meta