about summary refs log tree commit diff
path: root/src/libexpr/nixexpr.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-04-12T21·21+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-04-12T21·21+0000
commita60317f20fbc8be8e339060d932946f6d99ece6a (patch)
treeb6cd2cc61fb904fafc7527f2a776cdb6b0e9c179 /src/libexpr/nixexpr.hh
parent4d6ad5be1738c64b1de4274cafbd4b8f23ca287c (diff)
* More missing constructs.
Diffstat (limited to 'src/libexpr/nixexpr.hh')
-rw-r--r--src/libexpr/nixexpr.hh38
1 files changed, 33 insertions, 5 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh
index ebdfd0a152ca..d6e088c41661 100644
--- a/src/libexpr/nixexpr.hh
+++ b/src/libexpr/nixexpr.hh
@@ -24,6 +24,9 @@ struct Pos
 };
 
 
+std::ostream & operator << (std::ostream & str, const Pos & pos);
+
+
 /* Abstract syntax of Nix expressions. */
 
 struct Env;
@@ -81,6 +84,14 @@ struct ExprSelect : Expr
     COMMON_METHODS
 };
 
+struct ExprOpHasAttr : Expr
+{
+    Expr * e;
+    string name;
+    ExprOpHasAttr(Expr * e, const string & name) : e(e), name(name) { };
+    COMMON_METHODS
+};
+
 struct ExprAttrs : Expr
 {
     bool recursive;
@@ -139,6 +150,21 @@ struct ExprIf : Expr
     COMMON_METHODS
 };
 
+struct ExprAssert : Expr
+{
+    Pos pos;
+    Expr * cond, * body;
+    ExprAssert(const Pos & pos, Expr * cond, Expr * body) : pos(pos), cond(cond), body(body) { };
+    COMMON_METHODS
+};
+
+struct ExprOpNot : Expr
+{
+    Expr * e;
+    ExprOpNot(Expr * e) : e(e) { };
+    COMMON_METHODS
+};
+
 #define MakeBinOp(name, s) \
     struct Expr##name : Expr \
     { \
@@ -158,15 +184,17 @@ MakeBinOp(OpAnd, "&&")
 MakeBinOp(OpOr, "||")
 MakeBinOp(OpImpl, "->")
 MakeBinOp(OpUpdate, "//")
-MakeBinOp(OpConcatStrings, "+")
 MakeBinOp(OpConcatLists, "++")
 
-
-#if 0
-/* Show a position. */
-string showPos(ATerm pos);
+struct ExprConcatStrings : Expr
+{
+    vector<Expr *> * es;
+    ExprConcatStrings(vector<Expr *> * es) : es(es) { };
+    COMMON_METHODS
+};
 
 
+#if 0
 /* Generic bottomup traversal over ATerms.  The traversal first
    recursively descends into subterms, and then applies the given term
    function to the resulting term. */