about summary refs log tree commit diff
path: root/src/libexpr/parser.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-02-03T14·45+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-02-03T14·45+0000
commitc4f7ae4aa5fc7071cfa853ec5d75aaf00e7a97fc (patch)
tree99334d6825236ffcab5a64239b95878e733e9ab5 /src/libexpr/parser.cc
parent1c9c0a5a46822be60c999f0196567c9e17cf5fa3 (diff)
* Verify that all variables in a Nix expression are defined.
Diffstat (limited to 'src/libexpr/parser.cc')
-rw-r--r--src/libexpr/parser.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libexpr/parser.cc b/src/libexpr/parser.cc
index 2574a55bd49e..0a550fb35507 100644
--- a/src/libexpr/parser.cc
+++ b/src/libexpr/parser.cc
@@ -81,6 +81,22 @@ static Expr parse(const char * text, const string & location,
     
     if (res) throw Error(data.error);
 
+    ATermMap primOps;
+    primOps.set("import", (ATerm) ATempty);
+    primOps.set("derivation", (ATerm) ATempty);
+    primOps.set("true", (ATerm) ATempty);
+    primOps.set("false", (ATerm) ATempty);
+    primOps.set("null", (ATerm) ATempty);
+    primOps.set("isNull", (ATerm) ATempty);
+    primOps.set("toString", (ATerm) ATempty);
+    primOps.set("baseNameOf", (ATerm) ATempty);
+
+    try {
+        checkVarDefs(primOps, data.result);
+    } catch (Error & e) {
+        throw Error(format("%1%, in %2%") % e.msg() % location);
+    }
+
     return data.result;
 }