diff options
Diffstat (limited to 'tex/context/base/node-ser.lua')
-rw-r--r-- | tex/context/base/node-ser.lua | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/tex/context/base/node-ser.lua b/tex/context/base/node-ser.lua index 8e999f520..63690d00a 100644 --- a/tex/context/base/node-ser.lua +++ b/tex/context/base/node-ser.lua @@ -19,7 +19,6 @@ local nodes, node = nodes, node local traverse = node.traverse local nodecodes = nodes.nodecodes -local noadcodes = nodes.noadcodes local nodefields = nodes.fields local hlist_code = nodecodes.hlist @@ -40,7 +39,6 @@ local expand = allocate ( tohash { "leader", -- leader_ptr "action", -- action_ptr "value", -- user_defined nodes with subtype 'a' en 'n' - "head", } ) -- page_insert: "height", "last_ins_ptr", "best_ins_ptr" @@ -96,9 +94,9 @@ end -- under construction: -local function totable(n,flat,verbose,noattributes) +local function totable(n,flat,verbose) -- todo: no attributes -- todo: no local function - local function to_table(n,flat,verbose,noattributes) -- no need to pass + local function to_table(n,flat,verbose) local f = nodefields(n) local tt = { } for k=1,#f do @@ -107,8 +105,6 @@ local function totable(n,flat,verbose,noattributes) if nv then if ignore[v] then -- skip - elseif noattributes and v == "attr" then - -- skip elseif expand[v] then if type(nv) == "number" or type(nv) == "string" then tt[v] = nv @@ -132,14 +128,14 @@ local function totable(n,flat,verbose,noattributes) local t, tn = { }, 0 while n do tn = tn + 1 - t[tn] = to_table(n,flat,verbose,noattributes) + t[tn] = to_table(n,flat,verbose) n = n.next end return t else local t = to_table(n) if n.next then - t.next = totable(n.next,flat,verbose,noattributes) + t.next = totable(n.next,flat,verbose) end return t end @@ -158,7 +154,7 @@ end -- todo: adapt to nodecodes etc -local function serialize(root,name,handle,depth,m,noattributes) +local function serialize(root,name,handle,depth,m) handle = handle or print if depth then depth = depth .. " " @@ -192,11 +188,6 @@ local function serialize(root,name,handle,depth,m,noattributes) local k = fld[f] if k == "ref_count" then -- skip - elseif noattributes and k == "attr" then - -- skip - elseif k == "id" then - local v = root[k] - handle(format("%s id=%s,",depth,nodecodes[v] or noadcodes[v] or v)) elseif k then local v = root[k] local t = type(v) @@ -215,12 +206,12 @@ local function serialize(root,name,handle,depth,m,noattributes) elseif t == "boolean" then handle(format("%s %s=%q,",depth,key(k),tostring(v))) elseif v then -- userdata or table - serialize(v,k,handle,depth,m+1,noattributes) + serialize(v,k,handle,depth,m+1) end end end if root['next'] then -- userdata or table - serialize(root['next'],'next',handle,depth,m+1,noattributes) + serialize(root['next'],'next',handle,depth,m+1) end end if m and m > 0 then @@ -230,13 +221,13 @@ local function serialize(root,name,handle,depth,m,noattributes) end end -function nodes.serialize(root,name,noattributes) +function nodes.serialize(root,name) local t, n = { }, 0 local function flush(s) n = n + 1 t[n] = s end - serialize(root,name,flush,nil,0,noattributes) + serialize(root, name, flush, nil, 0) return concat(t,"\n") end |