def tables

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

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

292# the sections of every table among a table's rows, in document order: each
293# table's own section, then the tables in it, then the tables after it. The
294# path to the table is kept innermost first, so a level prepends its name.
295def tables(rows: List<&2, E.Val>, +segs: List<&2, String>) -> List<&2, Sect>:
296  match rows:
297    case []:
298      []
299    case E.VPair{name, E.VHead{_path, +sub}} <> tl:
300      +at : List<&2, String> = name <> segs
301      List.append(&2, Sect, table.sects(at, sub, tables(sub, at)), tables(tl, segs))
302    case _hd <> tl:
303      tables(tl, segs)

Uses (6)

Used by (1)