diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-20T09·20+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-20T09·20+0000 |
commit | d66ea83a763a36e7e7b9558b90abcfe09bec1b85 (patch) | |
tree | 6eaa7fc607da31c6ed3e221826cb1d6be43a6c9b /src/nix-instantiate/nix-instantiate.cc | |
parent | f71ea9c911294ec72f52137175ad088a2f50ab97 (diff) | |
parent | aac5fcfbb54ff64c593d8919f7f52025415ea996 (diff) |
* Sync with the trunk.
Diffstat (limited to 'src/nix-instantiate/nix-instantiate.cc')
-rw-r--r-- | src/nix-instantiate/nix-instantiate.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index d8b39eca2694..03fb35ada18e 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -39,13 +39,13 @@ static bool indirectRoot = false; static void printResult(EvalState & state, Expr e, - bool evalOnly, bool xmlOutput, const ATermMap & autoArgs) + bool evalOnly, bool xmlOutput, bool location, const ATermMap & autoArgs) { PathSet context; if (evalOnly) if (xmlOutput) - printTermAsXML(e, std::cout, context); + printTermAsXML(e, std::cout, context, location); else std::cout << format("%1%\n") % canonicaliseExpr(e); @@ -68,7 +68,7 @@ static void printResult(EvalState & state, Expr e, void processExpr(EvalState & state, const Strings & attrPaths, bool parseOnly, bool strict, const ATermMap & autoArgs, - bool evalOnly, bool xmlOutput, Expr e) + bool evalOnly, bool xmlOutput, bool location, Expr e) { for (Strings::const_iterator i = attrPaths.begin(); i != attrPaths.end(); ++i) { Expr e2 = findAlongAttrPath(state, *i, autoArgs, e); @@ -77,7 +77,7 @@ void processExpr(EvalState & state, const Strings & attrPaths, e2 = strictEvalExpr(state, e2); else e2 = evalExpr(state, e2); - printResult(state, e2, evalOnly, xmlOutput, autoArgs); + printResult(state, e2, evalOnly, xmlOutput, location, autoArgs); } } @@ -90,6 +90,7 @@ void run(Strings args) bool evalOnly = false; bool parseOnly = false; bool xmlOutput = false; + bool xmlOutputSourceLocation = true; bool strict = false; Strings attrPaths; ATermMap autoArgs(128); @@ -125,6 +126,8 @@ void run(Strings args) indirectRoot = true; else if (arg == "--xml") xmlOutput = true; + else if (arg == "--no-location") + xmlOutputSourceLocation = false; else if (arg == "--strict") strict = true; else if (arg[0] == '-') @@ -140,7 +143,7 @@ void run(Strings args) if (readStdin) { Expr e = parseStdin(state); processExpr(state, attrPaths, parseOnly, strict, autoArgs, - evalOnly, xmlOutput, e); + evalOnly, xmlOutput, xmlOutputSourceLocation, e); } for (Strings::iterator i = files.begin(); @@ -149,7 +152,7 @@ void run(Strings args) Path path = absPath(*i); Expr e = parseExprFromFile(state, path); processExpr(state, attrPaths, parseOnly, strict, autoArgs, - evalOnly, xmlOutput, e); + evalOnly, xmlOutput, xmlOutputSourceLocation, e); } printEvalStats(state); |