Xml parse gives back what no node keeps: a closing tag's name, and the text runs and joins an element's text leaves behind (a run a #text node shares is kept); ludic.ui frees an attribute's value once parsed (every reader copies what it keeps) and act_parse's reader

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 00:30:13 +03:00
parent 7b20f305ff
commit 765d800842
3 changed files with 27 additions and 5 deletions

View file

@ -38,6 +38,7 @@ function act_parse(src: string, err: []string) -> UiAct {
rd_ws(r)
if r.err == "" and r.i < len(r.s) { rd_fail(r, "';' or the end") }
if r.err != "" { push(err, r.err) }
unsafe { free(r) } # the reader only: names and expressions are copied out
return a
}
# `set` or `emit` as the action's first word - not a function of that name, as in `set(4)`

View file

@ -40,6 +40,9 @@ function tpl_read(ui_st: mut UiState, x: Xml, file: string) -> UiTpl {
push(t.keys, k)
push(t.vals, tpl_value(v, err))
}
# the value is parsed (an action, a style, an expression), each copying what it keeps; an
# empty one is the reader's own literal
if len(v) > 0 { unsafe { free(v) } }
}
if tp_mixed(x) { tp_read_mixed(ui_st, t, x, file, err) } else {
for i in 0 .. Xml.child_count(x) { push(t.kids, tpl_read(ui_st, Xml.child(x, i), file)) }