-->
type indent_struct(object o)
if sequence(o) then
for i=1 to length(o) do
object oi = o[i]
if not sequence(oi)
or length(oi)!=2
or not integer(oi[1])
or not string(oi[2]) then
return false
end if
end for
return true
end if
return false
end type
type nested_struct(object o)
if sequence(o) then
for i=1 to length(o) do
object oi = o[i]
if not sequence(oi)
or length(oi)!=2
or not string(oi[1])
or not nested_struct(oi[2]) then
return false
end if
end for
return true
end if
return false
end type
-- and as above except:
function indent_to_nested(indent_struct indent, integer idx=1, level=1)
function nested_to_indent(nested_struct nested, integer level=1)
-- also make the output sequences better typed:
indent_struct indent = text_to_indent(text)
nested_struct nested = indent_to_nested(indent)[1]
indent_struct r2ichk = nested_to_indent(nested)