forked from lix-project/lix
* Strict evaluation and XML printing of lists.
This commit is contained in:
parent
943ab38a0d
commit
da25d80152
|
@ -589,7 +589,6 @@ Expr strictEvalExpr(EvalState & state, Expr e)
|
||||||
e = evalExpr(state, e);
|
e = evalExpr(state, e);
|
||||||
|
|
||||||
ATermList as;
|
ATermList as;
|
||||||
|
|
||||||
if (matchAttrs(e, as)) {
|
if (matchAttrs(e, as)) {
|
||||||
ATermList as2 = ATempty;
|
ATermList as2 = ATempty;
|
||||||
for (ATermIterator i(as); i; ++i) {
|
for (ATermIterator i(as); i; ++i) {
|
||||||
|
@ -599,10 +598,17 @@ Expr strictEvalExpr(EvalState & state, Expr e)
|
||||||
}
|
}
|
||||||
return makeAttrs(ATreverse(as2));
|
return makeAttrs(ATreverse(as2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ATermList es;
|
||||||
|
if (matchList(e, es)) {
|
||||||
|
ATermList es2 = ATempty;
|
||||||
|
for (ATermIterator i(es); i; ++i)
|
||||||
|
es2 = ATinsert(es2, strictEvalExpr(state, *i));
|
||||||
|
return makeList(ATreverse(es2));
|
||||||
|
}
|
||||||
|
|
||||||
ATermList formals;
|
ATermList formals;
|
||||||
ATerm body, pos;
|
ATerm body, pos;
|
||||||
|
|
||||||
if (matchFunction(e, formals, body, pos)) {
|
if (matchFunction(e, formals, body, pos)) {
|
||||||
ATermList formals2 = ATempty;
|
ATermList formals2 = ATempty;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ static void printTermAsXML(Expr e, XMLWriter & doc)
|
||||||
XMLAttrs attrs;
|
XMLAttrs attrs;
|
||||||
ATerm s;
|
ATerm s;
|
||||||
int i;
|
int i;
|
||||||
ATermList as, formals;
|
ATermList as, es, formals;
|
||||||
ATerm body, pos;
|
ATerm body, pos;
|
||||||
|
|
||||||
if (matchStr(e, s))
|
if (matchStr(e, s))
|
||||||
|
@ -84,6 +84,12 @@ static void printTermAsXML(Expr e, XMLWriter & doc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (matchList(e, es)) {
|
||||||
|
XMLOpenElement _(doc, "list");
|
||||||
|
for (ATermIterator i(es); i; ++i)
|
||||||
|
printTermAsXML(*i, doc);
|
||||||
|
}
|
||||||
|
|
||||||
else if (matchFunction(e, formals, body, pos)) {
|
else if (matchFunction(e, formals, body, pos)) {
|
||||||
XMLOpenElement _(doc, "function");
|
XMLOpenElement _(doc, "function");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue