Tempo.Iso8601.Tokenizer.Numbers (Tempo v0.4.0)

Copy Markdown View Source

Numbers aren't just numbers in ISO8601 when considering the extension formats. In some situations they may:

  • Have exponents
  • Have significant digits (the S suffix)
  • Have unspecified digits

And how these are formed varies by whether the number is being parsed for an implicit form, extended form or explicit form.

Implicit form

  • Numbers are always positive with no sign except when its the year in which case it may have a negative sign.

  • Numbers are always a positive integer, or a the "unspecified" symbol X in any digit location. Numbers are either 2, 3 or 4 digits wide (decades are three digits) and this implementation does not currently support more than 4 digits for years.

  • Significant digits are not supported.

** Extended form

  • Same as the Implicit Form

Explicit form

  • Numbers may be positive of negative

  • The "unspecified" symbol X may appear in any digit location.

  • The symbol X* means the entire field is unspecified.

  • Exponent and significant digits are supported, but only if the number is an integer (ie does not have unspecified digits).

Summary

Functions

apply_fraction(other)

digit_or_unspecified()

error_range()

exponent()

form_number(other)

fraction()

maybe_negative_integer(combinator \\ empty(), opts)

maybe_negative_integer_or_integer_set(indicator, tag, opts)

maybe_negative_number(combinator \\ empty(), opts)

maybe_negative_number_or_integer_set(indicator, tag, opts)

normalize_mask(list)

number_separator()

positive_integer(combinator \\ empty(), opts)

positive_integer_or_integer_set(tag, opts)

positive_integer_or_integer_set(indicator, tag, opts)

positive_number(combinator \\ empty(), opts)

positive_number_or_integer_set(tag, opts)

positive_number_or_integer_set(indicator, tag, opts)

significant()

unspecified_or_set()