diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-05-07T14·46+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-05-07T14·46+0000 |
commit | 83dfa898706e1faa491b3a50ea20baf60abda387 (patch) | |
tree | c498fcd4428bd53f41415b027bc9eb5f044c5e95 /src/nix-instantiate | |
parent | 01e58adce0767f1a484d80fcbcf67c7945cbc146 (diff) | |
parent | 4750065ada362bd46e85879975a3148e18df5b0c (diff) |
* Sync with the trunk.
Diffstat (limited to 'src/nix-instantiate')
-rw-r--r-- | src/nix-instantiate/help.txt | 2 | ||||
-rw-r--r-- | src/nix-instantiate/nix-instantiate.cc | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/nix-instantiate/help.txt b/src/nix-instantiate/help.txt index fa0a4590ee92..21822132aece 100644 --- a/src/nix-instantiate/help.txt +++ b/src/nix-instantiate/help.txt @@ -22,6 +22,8 @@ Options: For --eval-only / --parse-only: --xml: print an XML representation of the abstract syntax tree + --no-location: don't provide source location information in the + output XML tree For --eval-only: diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index c61cf89c90e4..4d629ea1b333 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -39,7 +39,7 @@ static bool indirectRoot = false; void processExpr(EvalState & state, const Strings & attrPaths, bool parseOnly, bool strict, const Bindings & autoArgs, - bool evalOnly, bool xmlOutput, Expr * e) + bool evalOnly, bool xmlOutput, bool location, Expr * e) { if (parseOnly) std::cout << format("%1%\n") % *e; @@ -52,7 +52,7 @@ void processExpr(EvalState & state, const Strings & attrPaths, PathSet context; if (evalOnly) if (xmlOutput) - printValueAsXML(state, strict, v, std::cout, context); + printValueAsXML(state, strict, location, v, std::cout, context); else { if (strict) state.strictForceValue(v); std::cout << v << std::endl; @@ -83,6 +83,7 @@ void run(Strings args) bool evalOnly = false; bool parseOnly = false; bool xmlOutput = false; + bool xmlOutputSourceLocation = true; bool strict = false; Strings attrPaths; Bindings autoArgs; @@ -116,6 +117,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] == '-') @@ -131,14 +134,14 @@ void run(Strings args) if (readStdin) { Expr * e = parseStdin(state); processExpr(state, attrPaths, parseOnly, strict, autoArgs, - evalOnly, xmlOutput, e); + evalOnly, xmlOutput, xmlOutputSourceLocation, e); } foreach (Strings::iterator, i, files) { Path path = absPath(*i); Expr * e = parseExprFromFile(state, path); processExpr(state, attrPaths, parseOnly, strict, autoArgs, - evalOnly, xmlOutput, e); + evalOnly, xmlOutput, xmlOutputSourceLocation, e); } state.printStats(); |