def pair.of

ezx@1.11.0.0 · src/toml/toml.bend:213

import ezx@1.11.0.0/src/toml/toml.bend as Toml
import Base
import emerging-eztoml@0.9.0.0/main.bend as E

213# a pair whose value is written as text: a string or a boolean, as ez writes
214# them; an integer as its digits. A table, an array or an inline table is not
215# a pair of the section.
216def pair.of(+name: String, val: E.Val) -> List<&2, Kv>:
217  match val:
218    case E.VStr{text}:
219      [Kv{name, text}]
220    case E.VSpan{src, nn}:
221      [Kv{name, E.string(E.VSpan{src, nn})}]
222    case E.VBool{bit}:
223      [Kv{name, flag.text(bit)}]
224    case E.VInt{_sign, digits}:
225      [Kv{name, digits}]
226    case _:
227      []

Uses (6)

Used by (1)