module
TOML::ValueDecoder
Overview
Decoders that turn raw atom/string text into typed Values.
Kept in a dedicated module so the parser stays focused on
structural concerns. All decoders raise TOML::ParseError (with
1-based line/column) on invalid input.
Extended Modules
Defined in:
toml/value_decoder.crInstance Method Summary
-
#decode_basic_string(raw : String, line : Int32, column : Int32) : StringValue
Decodes a
BasicStringtoken (raw still includes the surrounding"quotes) into aStringValue. -
#decode_float(raw : String) : FloatValue | Nil
Build a
FloatValuefrom the textual form `int_part . - #decode_literal_string(raw : String, _line : Int32, _column : Int32) : StringValue
- #decode_multiline_basic_string(raw : String, line : Int32, column : Int32) : StringValue
- #decode_multiline_literal_string(raw : String, _line : Int32, _column : Int32) : StringValue
-
#try_decode_atom(raw : String) : Value | Nil
Try to decode an atom as an integer, float, boolean, or special float (
inf,nan,+inf,-inf,+nan,-nan). -
#try_decode_datetime(raw : String) : Value | Nil
Try to decode
rawas one of the four TOML date/time variants: OffsetDateTime, LocalDateTime, LocalDate, LocalTime.
Instance Method Detail
Decodes a BasicString token (raw still includes the
surrounding " quotes) into a StringValue.
Build a FloatValue from the textual form int_part . frac_part
or with an exponent. Used by the parser when it has reassembled
the parts that the lexer emitted as Atom Dot Atom.
Try to decode an atom as an integer, float, boolean, or
special float (inf, nan, +inf, -inf, +nan, -nan).
Returns nil if raw is none of these so the caller can try
other interpretations (datetime, dotted-key segment, …).
Try to decode raw as one of the four TOML date/time variants:
OffsetDateTime, LocalDateTime, LocalDate, LocalTime. Returns
nil if raw does not match any of these shapes so the
caller can keep trying integer/float interpretations.
Accepts both T/t and a literal space as the date/time
delimiter (per TOML 1.0). The lexer emits a space-separated
form as separate tokens, so this method only sees T/t
forms and the space variant must be reassembled by the parser.