aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/nixexpr.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/nixexpr.hh')
-rw-r--r--src/libexpr/nixexpr.hh28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh
index 61eb81fab..bc6993477 100644
--- a/src/libexpr/nixexpr.hh
+++ b/src/libexpr/nixexpr.hh
@@ -50,10 +50,19 @@ struct Env;
struct Value;
struct EvalState;
struct StaticEnv;
+struct Expr;
/* An attribute path is a sequence of attribute names. */
-typedef vector<Symbol> AttrPath;
+struct AttrName
+{
+ Symbol symbol;
+ Expr *expr;
+ AttrName(const Symbol & s) : symbol(s) {};
+ AttrName(Expr *e) : expr(e) {};
+};
+
+typedef std::vector<AttrName> AttrPath;
string showAttrPath(const AttrPath & attrPath);
@@ -138,7 +147,7 @@ struct ExprSelect : Expr
Expr * e, * def;
AttrPath attrPath;
ExprSelect(Expr * e, const AttrPath & attrPath, Expr * def) : e(e), def(def), attrPath(attrPath) { };
- ExprSelect(Expr * e, const Symbol & name) : e(e), def(0) { attrPath.push_back(name); };
+ ExprSelect(Expr * e, const Symbol & name) : e(e), def(0) { attrPath.push_back(AttrName(name)); };
COMMON_METHODS
};
@@ -163,6 +172,14 @@ struct ExprAttrs : Expr
};
typedef std::map<Symbol, AttrDef> AttrDefs;
AttrDefs attrs;
+ struct DynamicAttrDef {
+ Expr * nameExpr;
+ Expr * valueExpr;
+ Pos pos;
+ DynamicAttrDef(Expr * nameExpr, Expr * valueExpr, const Pos & pos) : nameExpr(nameExpr), valueExpr(valueExpr), pos(pos) { };
+ };
+ typedef std::vector<DynamicAttrDef> DynamicAttrDefs;
+ DynamicAttrDefs dynamicAttrs;
ExprAttrs() : recursive(false) { };
COMMON_METHODS
};
@@ -248,6 +265,13 @@ struct ExprOpNot : Expr
COMMON_METHODS
};
+struct ExprBuiltin : Expr
+{
+ Symbol name;
+ ExprBuiltin(const Symbol & name) : name(name) { };
+ COMMON_METHODS
+};
+
#define MakeBinOp(name, s) \
struct Expr##name : Expr \
{ \