about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-03-25T12·19+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-03-25T12·19+0000
commit8a10360c912bc344ea9ce7f8871a47a6e036552f (patch)
tree09ed76a3e11754ee09c48cd491782848df169063
parent7482349fe8ba9f285f6c7e53d8573fc367ecff8b (diff)
* Simplify @-patterns: only `{attrs}@name' or `name@{attrs}' are now
  allowed.  So `name1@name2', `{attrs1}@{attrs2}' and so on are now no
  longer legal.  This is no big loss because they were not useful
  anyway.

  This also changes the output of builtins.toXML for @-patterns
  slightly.

-rw-r--r--src/libexpr/eval-test.cc136
-rw-r--r--src/libexpr/eval.cc15
-rw-r--r--src/libexpr/expr-to-xml.cc14
-rw-r--r--src/libexpr/nixexpr-ast.def4
-rw-r--r--src/libexpr/nixexpr.cc8
-rw-r--r--src/libexpr/parser.y45
-rw-r--r--src/libexpr/primops.cc7
-rw-r--r--tests/lang/eval-okay-patterns.exp2
-rw-r--r--tests/lang/eval-okay-patterns.nix3
-rw-r--r--tests/lang/eval-okay-xml.exp.xml16
-rw-r--r--tests/lang/parse-okay-1.exp2
-rw-r--r--tests/lang/parse-okay-regression-20041027.exp2
-rw-r--r--tests/lang/parse-okay-subversion.exp2
13 files changed, 83 insertions, 173 deletions
diff --git a/src/libexpr/eval-test.cc b/src/libexpr/eval-test.cc
index 27cf685f9de4..71b16384bec6 100644
--- a/src/libexpr/eval-test.cc
+++ b/src/libexpr/eval-test.cc
@@ -111,91 +111,6 @@ Env * allocEnv()
 }
 
 
-static bool patternIsStrict(Pattern pat)
-{
-    ATerm name, ellipsis, pat1, pat2;
-    ATermList formals;
-    if (matchVarPat(pat, name)) return false;
-    else if (matchAttrsPat(pat, formals, ellipsis)) return true;
-    else if (matchAtPat(pat, pat1, pat2))
-        return patternIsStrict(pat1) || patternIsStrict(pat2);
-    else abort();
-}
-
-
-static void bindVarPats(Pattern pat, Env & newEnv,
-    Env * argEnv, Expr argExpr, Value * & vArg)
-{
-    Pattern pat1, pat2;
-    if (matchAtPat(pat, pat1, pat2)) {
-        bindVarPats(pat1, newEnv, argEnv, argExpr, vArg);
-        bindVarPats(pat2, newEnv, argEnv, argExpr, vArg);
-        return;
-    }
-
-    ATerm name;
-    if (!matchVarPat(pat, name)) abort();
-
-    if (vArg) {
-        Value & v = newEnv.bindings[aterm2String(name)];
-        v.type = tCopy;
-        v.val = vArg;
-    } else {
-        vArg = &newEnv.bindings[aterm2String(name)];
-        vArg->type = tThunk;
-        vArg->thunk.env = argEnv;
-        vArg->thunk.expr = argExpr;
-    }
-}
-
-
-static void bindAttrPats(Pattern pat, Env & newEnv,
-    Value & vArg, Value * & vArgInEnv)
-{
-    Pattern pat1, pat2;
-    if (matchAtPat(pat, pat1, pat2)) {
-        bindAttrPats(pat1, newEnv, vArg, vArgInEnv);
-        bindAttrPats(pat2, newEnv, vArg, vArgInEnv);
-        return;
-    }
-    
-    ATerm name;
-    if (matchVarPat(pat, name)) {
-        if (vArgInEnv) {
-            Value & v = newEnv.bindings[aterm2String(name)];
-            v.type = tCopy;
-            v.val = vArgInEnv;
-        } else {
-            vArgInEnv = &newEnv.bindings[aterm2String(name)];
-            *vArgInEnv = vArg;
-        }
-        return;
-    }
-
-    ATerm ellipsis;
-    ATermList formals;
-    if (matchAttrsPat(pat, formals, ellipsis)) {
-        for (ATermIterator i(formals); i; ++i) {
-            Expr name, def;
-            DefaultValue def2;
-            if (!matchFormal(*i, name, def2)) abort(); /* can't happen */
-
-            Bindings::iterator j = vArg.attrs->find(aterm2String(name));
-            if (j == vArg.attrs->end())
-                throw TypeError(format("the argument named `%1%' required by the function is missing")
-                    % aterm2String(name));
-            
-            Value & v = newEnv.bindings[aterm2String(name)];
-            v.type = tCopy;
-            v.val = &j->second;
-        }
-        return;
-    }
-
-    abort();
-}
-
-
 static void eval(Env * env, Expr e, Value & v)
 {
     printMsg(lvlError, format("eval: %1%") % e);
@@ -279,16 +194,44 @@ static void eval(Env * env, Expr e, Value & v)
         Env * env2 = allocEnv();
         env2->up = env;
 
-        if (patternIsStrict(v.lambda.pat)) {
-            Value vArg;
-            eval(env, arg, vArg);
-            if (vArg.type != tAttrs) throw TypeError("expected attribute set");
-            Value * vArg2 = 0;
-            bindAttrPats(v.lambda.pat, *env2, vArg, vArg2);
-        } else {
-            Value * vArg = 0;
-            bindVarPats(v.lambda.pat, *env2, env, arg, vArg);
+        ATermList formals; ATerm ellipsis;
+
+        if (matchVarPat(v.lambda.pat, name)) {
+            Value & vArg = env2->bindings[aterm2String(name)];
+            vArg.type = tThunk;
+            vArg.thunk.env = env;
+            vArg.thunk.expr = arg;
+        }
+
+        else if (matchAttrsPat(v.lambda.pat, formals, ellipsis, name)) {
+            Value * vArg;
+            Value vArg_;
+
+            if (name == sNoAlias)
+                vArg = &vArg_;
+            else 
+                vArg = &env2->bindings[aterm2String(name)];
+
+            eval(env, arg, *vArg);
+            if (vArg->type != tAttrs) throw TypeError("expected attribute set");
+            
+            for (ATermIterator i(formals); i; ++i) {
+                Expr name, def;
+                DefaultValue def2;
+                if (!matchFormal(*i, name, def2)) abort(); /* can't happen */
+
+                Bindings::iterator j = vArg->attrs->find(aterm2String(name));
+                if (j == vArg->attrs->end())
+                    throw TypeError(format("the argument named `%1%' required by the function is missing")
+                    % aterm2String(name));
+            
+                Value & v = env2->bindings[aterm2String(name)];
+                v.type = tCopy;
+                v.val = &j->second;
+            }            
         }
+
+        else abort();
         
         eval(env2, v.lambda.body, v);
         return;
@@ -319,13 +262,10 @@ void run(Strings args)
     doTest("rec { x = 1; y = x; }.y");
     doTest("(x: x) 1");
     doTest("(x: y: y) 1 2");
-    doTest("(x@y: x) 1");
-    doTest("(x@y: y) 2");
-    doTest("(x@y@z: y) 3");
     doTest("x: x");
     doTest("({x, y}: x) { x = 1; y = 2; }");
     doTest("({x, y}@args: args.x) { x = 1; y = 2; }");
-    doTest("({x, y}@args@args2: args2.x) { x = 1; y = 2; }");
+    doTest("(args@{x, y}: args.x) { x = 1; y = 2; }");
     
     //Expr e = parseExprFromString(state, "let x = \"a\"; in x + \"b\"", "/");
     //Expr e = parseExprFromString(state, "(x: x + \"b\") \"a\"", "/");
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index cd9c64594747..1501fc0480b2 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -85,16 +85,17 @@ static void patternMatch(EvalState & state,
 {
     ATerm name;
     ATermList formals;
-    Pattern pat1, pat2;
     ATermBool ellipsis;
     
     if (matchVarPat(pat, name)) 
         subs.set(name, arg);
 
-    else if (matchAttrsPat(pat, formals, ellipsis)) {
+    else if (matchAttrsPat(pat, formals, ellipsis, name)) {
 
         arg = evalExpr(state, arg);
 
+        if (name != sNoAlias) subs.set(name, arg);
+
         /* Get the actual arguments. */
         ATermMap attrs;
         queryAllAttrs(arg, attrs);
@@ -131,11 +132,6 @@ static void patternMatch(EvalState & state,
                 % aterm2String(attrs.begin()->key));
     }
 
-    else if (matchAtPat(pat, pat1, pat2)) {
-        patternMatch(state, pat1, arg, subs, subsRecursive);
-        patternMatch(state, pat2, arg, subs, subsRecursive);
-    }
-
     else abort();
 }
 
@@ -425,12 +421,11 @@ Path coerceToPath(EvalState & state, Expr e, PathSet & context)
 Expr autoCallFunction(Expr e, const ATermMap & args)
 {
     Pattern pat;
-    ATerm body, pos;
+    ATerm body, pos, name;
     ATermList formals;
     ATermBool ellipsis;
     
-    /* !!! this should be more general */
-    if (matchFunction(e, pat, body, pos) && matchAttrsPat(pat, formals, ellipsis)) {
+    if (matchFunction(e, pat, body, pos) && matchAttrsPat(pat, formals, ellipsis, name)) {
         ATermMap actualArgs(ATgetLength(formals));
         
         for (ATermIterator i(formals); i; ++i) {
diff --git a/src/libexpr/expr-to-xml.cc b/src/libexpr/expr-to-xml.cc
index e401001ead01..9b3062804e29 100644
--- a/src/libexpr/expr-to-xml.cc
+++ b/src/libexpr/expr-to-xml.cc
@@ -44,23 +44,19 @@ static void printPatternAsXML(Pattern pat, XMLWriter & doc)
 {
     ATerm name;
     ATermList formals;
-    Pattern pat1, pat2;
     ATermBool ellipsis;
     if (matchVarPat(pat, name))
         doc.writeEmptyElement("varpat", singletonAttrs("name", aterm2String(name)));
-    else if (matchAttrsPat(pat, formals, ellipsis)) {
-        XMLOpenElement _(doc, "attrspat");
+    else if (matchAttrsPat(pat, formals, ellipsis, name)) {
+        XMLAttrs attrs;
+        if (name != sNoAlias) attrs["name"] = aterm2String(name);
+        if (ellipsis == eTrue) attrs["ellipsis"] = "1";
+        XMLOpenElement _(doc, "attrspat", attrs);
         for (ATermIterator i(formals); i; ++i) {
             Expr name; ATerm dummy;
             if (!matchFormal(*i, name, dummy)) abort();
             doc.writeEmptyElement("attr", singletonAttrs("name", aterm2String(name)));
         }
-        if (ellipsis == eTrue) doc.writeEmptyElement("ellipsis");
-    }
-    else if (matchAtPat(pat, pat1, pat2)) {
-        XMLOpenElement _(doc, "at");
-        printPatternAsXML(pat1, doc);
-        printPatternAsXML(pat2, doc);
     }
 }
 
diff --git a/src/libexpr/nixexpr-ast.def b/src/libexpr/nixexpr-ast.def
index 00b5f5a13716..2bf8492dd05e 100644
--- a/src/libexpr/nixexpr-ast.def
+++ b/src/libexpr/nixexpr-ast.def
@@ -77,8 +77,7 @@ Inherit | Expr ATermList Pos | ATerm |
 Scope | | Expr |
 
 VarPat | string | Pattern |
-AttrsPat | ATermList ATermBool | Pattern | # bool = `...'
-AtPat | Pattern Pattern | Pattern |
+AttrsPat | ATermList ATermBool string | Pattern | # bool = `...'
 
 Formal | string DefaultValue | ATerm |
 
@@ -95,3 +94,4 @@ AttrRHS | Expr Pos | ATerm |
 eTrue = makeBool(makeTrue())
 eFalse = makeBool(makeFalse())
 sOverrides = toATerm("__overrides")
+sNoAlias = toATerm("")
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 3675dcceaf66..e581b1329c88 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -114,23 +114,19 @@ static void varsBoundByPattern(ATermMap & map, Pattern pat)
 {
     ATerm name;
     ATermList formals;
-    Pattern pat1, pat2;
     ATermBool ellipsis;
     /* Use makeRemoved() so that it can be used directly in
        substitute(). */
     if (matchVarPat(pat, name))
         map.set(name, makeRemoved());
-    else if (matchAttrsPat(pat, formals, ellipsis)) { 
+    else if (matchAttrsPat(pat, formals, ellipsis, name)) {
+        if (name != sNoAlias) map.set(name, makeRemoved());
         for (ATermIterator i(formals); i; ++i) {
             ATerm d1;
             if (!matchFormal(*i, name, d1)) abort();
             map.set(name, makeRemoved());
         }
     }
-    else if (matchAtPat(pat, pat1, pat2)) {
-        varsBoundByPattern(map, pat1);
-        varsBoundByPattern(map, pat2);
-    }
     else abort();
 }
 
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 8706ce025477..e55dfd76f591 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -140,31 +140,29 @@ static Expr fixAttrs(bool recursive, ATermList as)
 
 static void checkPatternVars(ATerm pos, ATermMap & map, Pattern pat)
 {
-    ATerm name;
+    ATerm name = sNoAlias;
     ATermList formals;
-    Pattern pat1, pat2;
     ATermBool ellipsis;
-    if (matchVarPat(pat, name)) {
-        if (map.get(name))
-            throw ParseError(format("duplicate formal function argument `%1%' at %2%")
-                % aterm2String(name) % showPos(pos));
-        map.set(name, name);
-    }
-    else if (matchAttrsPat(pat, formals, ellipsis)) { 
+    
+    if (matchAttrsPat(pat, formals, ellipsis, name)) { 
         for (ATermIterator i(formals); i; ++i) {
-            ATerm d1;
-            if (!matchFormal(*i, name, d1)) abort();
-            if (map.get(name))
+            ATerm d1, name2;
+            if (!matchFormal(*i, name2, d1)) abort();
+            if (map.get(name2))
                 throw ParseError(format("duplicate formal function argument `%1%' at %2%")
-                    % aterm2String(name) % showPos(pos));
-            map.set(name, name);
+                    % aterm2String(name2) % showPos(pos));
+            map.set(name2, name2);
         }
     }
-    else if (matchAtPat(pat, pat1, pat2)) {
-        checkPatternVars(pos, map, pat1);
-        checkPatternVars(pos, map, pat2);
+
+    else matchVarPat(pat, name);
+
+    if (name != sNoAlias) {
+        if (map.get(name))
+            throw ParseError(format("duplicate formal function argument `%1%' at %2%")
+                % aterm2String(name) % showPos(pos));
+        map.set(name, name);
     }
-    else abort();
 }
 
 
@@ -323,7 +321,7 @@ static void freeAndUnprotect(void * p)
 
 %type <t> start expr expr_function expr_if expr_op
 %type <t> expr_app expr_select expr_simple bind inheritsrc formal
-%type <t> pattern pattern2
+%type <t> pattern
 %type <ts> binds ids attrpath expr_list string_parts ind_string_parts
 %type <formals> formals
 %token <t> ID INT STR IND_STR PATH URI
@@ -433,13 +431,10 @@ ind_string_parts
   ;
 
 pattern
-  : pattern2 '@' pattern { $$ = makeAtPat($1, $3); }
-  | pattern2
-  ;
-
-pattern2
   : ID { $$ = makeVarPat($1); }
-  | '{' formals '}' { $$ = makeAttrsPat($2.formals, $2.ellipsis ? eTrue : eFalse); }
+  | '{' formals '}' { $$ = makeAttrsPat($2.formals, $2.ellipsis ? eTrue : eFalse, sNoAlias); }
+  | '{' formals '}' '@' ID { $$ = makeAttrsPat($2.formals, $2.ellipsis ? eTrue : eFalse, $5); }
+  | ID '@' '{' formals '}' { $$ = makeAttrsPat($4.formals, $4.ellipsis ? eTrue : eFalse, $1); }
   ;
 
 binds
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 7dddc91a86ab..52292f3f8461 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -846,19 +846,14 @@ static void attrsInPattern(ATermMap & map, Pattern pat)
 {
     ATerm name;
     ATermList formals;
-    Pattern pat1, pat2;
     ATermBool ellipsis;
-    if (matchAttrsPat(pat, formals, ellipsis)) { 
+    if (matchAttrsPat(pat, formals, ellipsis, name)) { 
         for (ATermIterator i(formals); i; ++i) {
             ATerm def;
             if (!matchFormal(*i, name, def)) abort();
             map.set(name, makeAttrRHS(makeBool(def != constNoDefaultValue), makeNoPos()));
         }
     }
-    else if (matchAtPat(pat, pat1, pat2)) {
-        attrsInPattern(map, pat1);
-        attrsInPattern(map, pat2);
-    }
 }
 
 
diff --git a/tests/lang/eval-okay-patterns.exp b/tests/lang/eval-okay-patterns.exp
index 8422900dd9e8..d497e9f2ba9a 100644
--- a/tests/lang/eval-okay-patterns.exp
+++ b/tests/lang/eval-okay-patterns.exp
@@ -1 +1 @@
-Str("abcxyzDDDDEFghijk",[])
+Str("abcxyzDDDDEFijk",[])
diff --git a/tests/lang/eval-okay-patterns.nix b/tests/lang/eval-okay-patterns.nix
index c233c406c766..96fd25a01517 100644
--- a/tests/lang/eval-okay-patterns.nix
+++ b/tests/lang/eval-okay-patterns.nix
@@ -6,8 +6,6 @@ let
 
   h = {x ? "d", y ? x, z ? args.x}@args: x + y + z;
 
-  i = args@args2: args.x + args2.y;
-
   j = {x, y, z, ...}: x + y + z;
 
 in
@@ -15,5 +13,4 @@ in
   g {x = "x"; y = "y"; z = "z";} +
   h {x = "D";} +
   h {x = "D"; y = "E"; z = "F";} +
-  i {x = "g"; y = "h";} +
   j {x = "i"; y = "j"; z = "k"; bla = "bla"; foo = "bar";}
diff --git a/tests/lang/eval-okay-xml.exp.xml b/tests/lang/eval-okay-xml.exp.xml
index 72a96d54c7d3..f124f939ed48 100644
--- a/tests/lang/eval-okay-xml.exp.xml
+++ b/tests/lang/eval-okay-xml.exp.xml
@@ -6,14 +6,11 @@
     </attr>
     <attr name="at">
       <function>
-        <at>
-          <varpat name="args" />
-          <attrspat>
-            <attr name="x" />
-            <attr name="y" />
-            <attr name="z" />
-          </attrspat>
-        </at>
+        <attrspat name="args">
+          <attr name="x" />
+          <attr name="y" />
+          <attr name="z" />
+        </attrspat>
       </function>
     </attr>
     <attr name="b">
@@ -24,11 +21,10 @@
     </attr>
     <attr name="ellipsis">
       <function>
-        <attrspat>
+        <attrspat ellipsis="1">
           <attr name="x" />
           <attr name="y" />
           <attr name="z" />
-          <ellipsis />
         </attrspat>
       </function>
     </attr>
diff --git a/tests/lang/parse-okay-1.exp b/tests/lang/parse-okay-1.exp
index bb8746ec45a6..2a6f05dd5da2 100644
--- a/tests/lang/parse-okay-1.exp
+++ b/tests/lang/parse-okay-1.exp
@@ -1 +1 @@
-Function(AttrsPat([Formal("x",NoDefaultValue),Formal("y",NoDefaultValue),Formal("z",NoDefaultValue)],Bool(False)),OpPlus(OpPlus(Var("x"),Var("y")),Var("z")),NoPos)
+Function(AttrsPat([Formal("x",NoDefaultValue),Formal("y",NoDefaultValue),Formal("z",NoDefaultValue)],Bool(False),""),OpPlus(OpPlus(Var("x"),Var("y")),Var("z")),NoPos)
diff --git a/tests/lang/parse-okay-regression-20041027.exp b/tests/lang/parse-okay-regression-20041027.exp
index a302e248844f..48251516d6dd 100644
--- a/tests/lang/parse-okay-regression-20041027.exp
+++ b/tests/lang/parse-okay-regression-20041027.exp
@@ -1 +1 @@
-Function(AttrsPat([Formal("stdenv",NoDefaultValue),Formal("fetchurl",NoDefaultValue)],Bool(False)),Call(Select(Var("stdenv"),"mkDerivation"),Attrs([Bind("name",Str("libXi-6.0.1",[]),NoPos),Bind("src",Call(Var("fetchurl"),Attrs([Bind("md5",Str("7e935a42428d63a387b3c048be0f2756",[]),NoPos),Bind("url",Str("http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2",[]),NoPos)])),NoPos)])),NoPos)
+Function(AttrsPat([Formal("stdenv",NoDefaultValue),Formal("fetchurl",NoDefaultValue)],Bool(False),""),Call(Select(Var("stdenv"),"mkDerivation"),Attrs([Bind("name",Str("libXi-6.0.1",[]),NoPos),Bind("src",Call(Var("fetchurl"),Attrs([Bind("md5",Str("7e935a42428d63a387b3c048be0f2756",[]),NoPos),Bind("url",Str("http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2",[]),NoPos)])),NoPos)])),NoPos)
diff --git a/tests/lang/parse-okay-subversion.exp b/tests/lang/parse-okay-subversion.exp
index 102153c18a84..b54e3af780c4 100644
--- a/tests/lang/parse-okay-subversion.exp
+++ b/tests/lang/parse-okay-subversion.exp
@@ -1 +1 @@
-Function(AttrsPat([Formal("localServer",DefaultValue(Var("false"))),Formal("httpServer",DefaultValue(Var("false"))),Formal("sslSupport",DefaultValue(Var("false"))),Formal("pythonBindings",DefaultValue(Var("false"))),Formal("javaSwigBindings",DefaultValue(Var("false"))),Formal("javahlBindings",DefaultValue(Var("false"))),Formal("stdenv",NoDefaultValue),Formal("fetchurl",NoDefaultValue),Formal("openssl",DefaultValue(Var("null"))),Formal("httpd",DefaultValue(Var("null"))),Formal("db4",DefaultValue(Var("null"))),Formal("expat",NoDefaultValue),Formal("swig",DefaultValue(Var("null"))),Formal("j2sdk",DefaultValue(Var("null")))],Bool(False)),Assert(OpNEq(Var("expat"),Var("null")),Assert(OpImpl(Var("localServer"),OpNEq(Var("db4"),Var("null"))),Assert(OpImpl(Var("httpServer"),OpAnd(OpNEq(Var("httpd"),Var("null")),OpEq(Select(Var("httpd"),"expat"),Var("expat")))),Assert(OpImpl(Var("sslSupport"),OpAnd(OpNEq(Var("openssl"),Var("null")),OpImpl(Var("httpServer"),OpEq(Select(Var("httpd"),"openssl"),Var("openssl"))))),Assert(OpImpl(Var("pythonBindings"),OpAnd(OpNEq(Var("swig"),Var("null")),Select(Var("swig"),"pythonSupport"))),Assert(OpImpl(Var("javaSwigBindings"),OpAnd(OpNEq(Var("swig"),Var("null")),Select(Var("swig"),"javaSupport"))),Assert(OpImpl(Var("javahlBindings"),OpNEq(Var("j2sdk"),Var("null"))),Call(Select(Var("stdenv"),"mkDerivation"),Attrs([Bind("builder",Path("/foo/bar"),NoPos),Bind("db4",If(Var("localServer"),Var("db4"),Var("null")),NoPos),Bind("expat",Var("expat"),NoPos),Bind("httpServer",Var("httpServer"),NoPos),Bind("httpd",If(Var("httpServer"),Var("httpd"),Var("null")),NoPos),Bind("j2sdk",If(Var("javaSwigBindings"),Select(Var("swig"),"j2sdk"),If(Var("javahlBindings"),Var("j2sdk"),Var("null"))),NoPos),Bind("javaSwigBindings",Var("javaSwigBindings"),NoPos),Bind("javahlBindings",Var("javahlBindings"),NoPos),Bind("localServer",Var("localServer"),NoPos),Bind("name",Str("subversion-1.1.1",[]),NoPos),Bind("openssl",If(Var("sslSupport"),Var("openssl"),Var("null")),NoPos),Bind("patches",If(Var("javahlBindings"),List([Path("/javahl.patch")]),List([])),NoPos),Bind("python",If(Var("pythonBindings"),Select(Var("swig"),"python"),Var("null")),NoPos),Bind("pythonBindings",Var("pythonBindings"),NoPos),Bind("src",Call(Var("fetchurl"),Attrs([Bind("md5",Str("a180c3fe91680389c210c99def54d9e0",[]),NoPos),Bind("url",Str("http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2",[]),NoPos)])),NoPos),Bind("sslSupport",Var("sslSupport"),NoPos),Bind("swig",If(OpOr(Var("pythonBindings"),Var("javaSwigBindings")),Var("swig"),Var("null")),NoPos)])),NoPos),NoPos),NoPos),NoPos),NoPos),NoPos),NoPos),NoPos)
+Function(AttrsPat([Formal("localServer",DefaultValue(Var("false"))),Formal("httpServer",DefaultValue(Var("false"))),Formal("sslSupport",DefaultValue(Var("false"))),Formal("pythonBindings",DefaultValue(Var("false"))),Formal("javaSwigBindings",DefaultValue(Var("false"))),Formal("javahlBindings",DefaultValue(Var("false"))),Formal("stdenv",NoDefaultValue),Formal("fetchurl",NoDefaultValue),Formal("openssl",DefaultValue(Var("null"))),Formal("httpd",DefaultValue(Var("null"))),Formal("db4",DefaultValue(Var("null"))),Formal("expat",NoDefaultValue),Formal("swig",DefaultValue(Var("null"))),Formal("j2sdk",DefaultValue(Var("null")))],Bool(False),""),Assert(OpNEq(Var("expat"),Var("null")),Assert(OpImpl(Var("localServer"),OpNEq(Var("db4"),Var("null"))),Assert(OpImpl(Var("httpServer"),OpAnd(OpNEq(Var("httpd"),Var("null")),OpEq(Select(Var("httpd"),"expat"),Var("expat")))),Assert(OpImpl(Var("sslSupport"),OpAnd(OpNEq(Var("openssl"),Var("null")),OpImpl(Var("httpServer"),OpEq(Select(Var("httpd"),"openssl"),Var("openssl"))))),Assert(OpImpl(Var("pythonBindings"),OpAnd(OpNEq(Var("swig"),Var("null")),Select(Var("swig"),"pythonSupport"))),Assert(OpImpl(Var("javaSwigBindings"),OpAnd(OpNEq(Var("swig"),Var("null")),Select(Var("swig"),"javaSupport"))),Assert(OpImpl(Var("javahlBindings"),OpNEq(Var("j2sdk"),Var("null"))),Call(Select(Var("stdenv"),"mkDerivation"),Attrs([Bind("builder",Path("/foo/bar"),NoPos),Bind("db4",If(Var("localServer"),Var("db4"),Var("null")),NoPos),Bind("expat",Var("expat"),NoPos),Bind("httpServer",Var("httpServer"),NoPos),Bind("httpd",If(Var("httpServer"),Var("httpd"),Var("null")),NoPos),Bind("j2sdk",If(Var("javaSwigBindings"),Select(Var("swig"),"j2sdk"),If(Var("javahlBindings"),Var("j2sdk"),Var("null"))),NoPos),Bind("javaSwigBindings",Var("javaSwigBindings"),NoPos),Bind("javahlBindings",Var("javahlBindings"),NoPos),Bind("localServer",Var("localServer"),NoPos),Bind("name",Str("subversion-1.1.1",[]),NoPos),Bind("openssl",If(Var("sslSupport"),Var("openssl"),Var("null")),NoPos),Bind("patches",If(Var("javahlBindings"),List([Path("/javahl.patch")]),List([])),NoPos),Bind("python",If(Var("pythonBindings"),Select(Var("swig"),"python"),Var("null")),NoPos),Bind("pythonBindings",Var("pythonBindings"),NoPos),Bind("src",Call(Var("fetchurl"),Attrs([Bind("md5",Str("a180c3fe91680389c210c99def54d9e0",[]),NoPos),Bind("url",Str("http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2",[]),NoPos)])),NoPos),Bind("sslSupport",Var("sslSupport"),NoPos),Bind("swig",If(OpOr(Var("pythonBindings"),Var("javaSwigBindings")),Var("swig"),Var("null")),NoPos)])),NoPos),NoPos),NoPos),NoPos),NoPos),NoPos),NoPos),NoPos)