AEKIREIHNEHL4CQEHRZJGRWMCV2XO6ICZK2OM342IKAJV6MUMDOAC
FMJMW4PUGAO6SJ7I7WCFEV44D5ERF7AX2Y2GVODYTFRK7SO7XTHQC
HOVPJBFFZWO37IJWS6XVOZZ6D6UZUZ5J4B3SPN53SQK7GSCJPD3QC
VTNP5KDOVQPWGRARMFJJ3MTU7IAZT4NP7ZFY4HJYT3KYJUSAZEZAC
4XR2A7QDIKUENRUPCDHDEUX7AGSWIYH5B7PP7NBIHLF5AKDDCGNQC
4N5APGRGHTKFMEJ7THSJX6TSYYAP3BUZQG73AJBKCQLXOOEHPATQC
4LWGZL33NOCTVZXUZZM5P6BRBHDUMEAJPVPNB52PN3UZVC7DMSZAC
YGRLM2SKOIPP4M24VYZTRREELKICDFKXL7ZHHR54BR5HVRCDOP6AC
A63IHCMXH3F4V56HDXJLJVVHKXRSJCJMT2PWXXI2IW3J734J6SGQC
KD5237CUR4X3VRUD46H3CVU22NYS7LOPF3WXENWHNSF7GKEIQZ6QC
HVXL2XUZTOWJPESBHBFD74B4QXNMG5SX4LOXDLPJ7732IU4SUYWQC
POPU2ATH2HHBTGHKRAV3EY2K55P664IARI3YJGLDKVJ6PQPXBQ4AC
7YCFGMZBCWDOOO3DHSJ3ZWPUWFMEO6OLQGDZWLULAPER3YZOYUJAC
IZ2AHLM3EGDU7ELRAGXID7UTLPF5JJM2FBMZ7TSG3DS7J3QPFOJAC
const ATermMap & argsUsed, const ATermMap & argsLeft,
const string & attrPath, Expr fun,
ATermList formals, const ATermMap & actualArgs)
const ArgsUsed & argsUsed, const AutoArgs & argsLeft,
const string & attrPath, Value & fun,
Formals::Formals_::iterator cur,
Formals::Formals_::iterator last,
const Bindings & actualArgs)
if (formals == ATempty) {
findJobs(state, doc, argsUsed, argsLeft,
makeCall(fun, makeAttrs(actualArgs)), attrPath);
if (cur == last) {
Value v, arg;
state.mkAttrs(arg);
*arg.attrs = actualArgs;
mkApp(v, fun, arg);
findJobs(state, doc, argsUsed, argsLeft, v, attrPath);
Expr name; ATerm def2; ATermList values;
if (!matchFormal(ATgetFirst(formals), name, def2)) abort();
if ((values = (ATermList) argsLeft.get(name))) {
int n = 0;
for (ATermIterator i(ATreverse(values)); i; ++i, ++n) {
ATermMap actualArgs2(actualArgs);
ATermMap argsUsed2(argsUsed);
ATermMap argsLeft2(argsLeft);
actualArgs2.set(name, makeAttrRHS(*i, makeNoPos()));
argsUsed2.set(name, (ATerm) ATmakeList2(*i, (ATerm) ATmakeInt(n)));
argsLeft2.remove(name);
tryJobAlts(state, doc, argsUsed2, argsLeft2, attrPath, fun, ATgetNext(formals), actualArgs2);
}
}
else
AutoArgs::const_iterator a = argsLeft.find(cur->name);
if (a == argsLeft.end())
% attrPath % aterm2String(name));
% attrPath % cur->name);
Formals::Formals_::iterator next = cur; ++next;
int n = 0;
foreach (list<Value>::const_iterator, i, a->second) {
Bindings actualArgs2(actualArgs); // !!! inefficient
ArgsUsed argsUsed2(argsUsed);
AutoArgs argsLeft2(argsLeft);
actualArgs2[cur->name].value = *i;
argsUsed2[cur->name] = std::pair<unsigned int, Value>(n, *i);
argsLeft2.erase(cur->name);
tryJobAlts(state, doc, argsUsed2, argsLeft2, attrPath, fun, next, last, actualArgs2);
++n;
}
xmlAttrs2["name"] = aterm2String(i->key);
xmlAttrs2["value"] = showValue(ATelementAt((ATermList) i->value, 0));
xmlAttrs2["altnr"] = int2String(ATgetInt((ATermInt) ATelementAt((ATermList) i->value, 1)));
xmlAttrs2["name"] = i->first;
xmlAttrs2["value"] = (format("%1%") % i->second.second).str();
xmlAttrs2["altnr"] = int2String(i->second.first);
const ATermMap & argsUsed, const ATermMap & argsLeft,
Expr e, const string & attrPath)
const ArgsUsed & argsUsed, const AutoArgs & argsLeft,
Value & v, const string & attrPath)
ATermList as, formals;
ATermBool ellipsis;
ATerm pat, body, pos;
string s;
PathSet context;
if (matchAttrs(e, as)) {
ATermMap attrs;
queryAllAttrs(e, attrs);
if (v.type == tAttrs) {
foreach (ATermMap::const_iterator, i, attrs)
findJobs(state, doc, argsUsed, argsLeft, i->value,
(attrPath.empty() ? "" : attrPath + ".") + aterm2String(i->key));
foreach (Bindings::iterator, i, *v.attrs)
findJobs(state, doc, argsUsed, argsLeft, i->second.value,
(attrPath.empty() ? "" : attrPath + ".") + (string) i->first);
else if (matchFunction(e, pat, body, pos) && matchAttrsPat(pat, formals, ellipsis)) {
tryJobAlts(state, doc, argsUsed, argsLeft, attrPath, e, formals, ATermMap());
else if (v.type == tLambda && v.lambda.fun->matchAttrs) {
tryJobAlts(state, doc, argsUsed, argsLeft, attrPath, v,
v.lambda.fun->formals->formals.begin(),
v.lambda.fun->formals->formals.end(),
Bindings());
Expr e = arg == "--arg"
? evalExpr(state, parseExprFromString(state, value, absPath(".")))
: makeStr(value);
autoArgs.set(toATerm(name), (ATerm) ATinsert(autoArgs.get(toATerm(name))
? (ATermList) autoArgs.get(toATerm(name))
: ATempty, e));
Value v;
if (arg == "--arg")
state.eval(parseExprFromString(state, value, absPath(".")), v);
else
mkString(v, value);
autoArgs[state.symbols.create(name)].push_back(v);