def tree.step

gralha-xml-doc@0.1.0.1 · xml.bend:259

import gralha-xml-doc@0.1.0.1/xml.bend as Xml
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U

259def tree.step(tok: Token, +s: List<&2, Element>) -> List<&2, Element>:
260  match tok:
261    case Chars{txt}: stack.text(s, txt)
262    case Shut{n}: stack.close(s)
263    case Open{n, a, closed}:
264      +node = {Element{n, a, Nil{}, ""} : Element}
265      U.choose(List<&2, Element>, closed, stack.add(s, node), Con{node, s})

Uses (7)

Used by (1)