about summary refs log tree commit diff
path: root/src/libexpr/parser.cc
diff options
context:
space:
mode:
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;
 }