about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-02T14·29+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-02T14·29+0200
commit33972629d76b1b1059de5b89ce68ef37dce45cbd (patch)
tree97e1a36a5fa4881c3a87f0ea51268a2b284a985e /src
parentac1b75413821c9ebaf317fb3fe1c695599e93818 (diff)
Fix whitespace
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/attr-path.cc6
-rw-r--r--src/libexpr/eval.cc44
-rw-r--r--src/libexpr/eval.hh20
-rw-r--r--src/libexpr/lexer.l10
-rw-r--r--src/libexpr/nixexpr.cc18
-rw-r--r--src/libexpr/nixexpr.hh2
-rw-r--r--src/libexpr/parser.y34
-rw-r--r--src/libexpr/primops.cc30
8 files changed, 82 insertions, 82 deletions
diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc
index 45794a62d5dc..2b72fea7eb8e 100644
--- a/src/libexpr/attr-path.cc
+++ b/src/libexpr/attr-path.cc
@@ -18,7 +18,7 @@ void findAlongAttrPath(EvalState & state, const string & attrPath,
     string curPath;
 
     state.mkThunk_(v, e);
-    
+
     foreach (Strings::iterator, i, tokens) {
 
         if (!curPath.empty()) curPath += ".";
@@ -65,9 +65,9 @@ void findAlongAttrPath(EvalState & state, const string & attrPath,
 
             v = *v.list.elems[attrIndex];
         }
-        
+
     }
 }
 
- 
+
 }
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 82287f6271e7..e5c7226c1b8c 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -44,7 +44,7 @@ void Bindings::sort()
 {
     std::sort(begin(), end());
 }
-    
+
 
 std::ostream & operator << (std::ostream & str, const Value & v)
 {
@@ -291,7 +291,7 @@ void mkString(Value & v, const string & s, const PathSet & context)
         unsigned int n = 0;
         v.string.context = (const char * *)
             GC_MALLOC((context.size() + 1) * sizeof(char *));
-        foreach (PathSet::const_iterator, i, context)  
+        foreach (PathSet::const_iterator, i, context)
             v.string.context[n++] = GC_STRDUP(i->c_str());
         v.string.context[n] = 0;
     }
@@ -346,7 +346,7 @@ Env & EvalState::allocEnv(unsigned int size)
     /* Clear the values because maybeThunk() and lookupVar fromWith expects this. */
     for (unsigned i = 0; i < size; ++i)
         env->values[i] = 0;
-    
+
     return *env;
 }
 
@@ -358,7 +358,7 @@ Value * EvalState::allocAttr(Value & vAttrs, const Symbol & name)
     return v;
 }
 
-    
+
 void EvalState::mkList(Value & v, unsigned int length)
 {
     v.type = tList;
@@ -607,7 +607,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
     e->eval(state, env, vTmp);
 
     try {
-        
+
         foreach (AttrPath::const_iterator, i, attrPath) {
             nrLookups++;
             Bindings::iterator j;
@@ -628,17 +628,17 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
             pos = j->pos;
             if (state.countCalls && pos) state.attrSelects[*pos]++;
         }
-    
+
 
         state.forceValue(*vAttrs);
-        
+
     } catch (Error & e) {
         if (pos)
             addErrorPrefix(e, "while evaluating the attribute `%1%' at %2%:\n",
                 showAttrPath(attrPath), *pos);
         throw;
     }
-    
+
     v = *vAttrs;
 }
 
@@ -662,7 +662,7 @@ void ExprOpHasAttr::eval(EvalState & state, Env & env, Value & v)
             vAttrs = j->value;
         }
     }
-    
+
     mkBool(v, true);
 }
 
@@ -697,10 +697,10 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v)
         assert(primOp->type == tPrimOp);
         unsigned int arity = primOp->primOp->arity;
         unsigned int argsLeft = arity - argsDone;
-        
+
         if (argsLeft == 1) {
             /* We have all the arguments, so call the primop. */
-                
+
             /* Put all the arguments in an array. */
             Value * vArgs[arity];
             unsigned int n = arity - 1;
@@ -725,7 +725,7 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v)
         }
         return;
     }
-    
+
     if (fun.type != tLambda)
         throwTypeError("attempt to call something which is not a function but %1%",
             showType(fun));
@@ -743,7 +743,7 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v)
 
     else {
         forceAttrs(arg);
-        
+
         if (!fun.lambda.fun->arg.empty())
             env2.values[displ++] = &arg;
 
@@ -830,7 +830,7 @@ void ExprIf::eval(EvalState & state, Env & env, Value & v)
     (state.evalBool(env, cond) ? then : else_)->eval(state, env, v);
 }
 
-    
+
 void ExprAssert::eval(EvalState & state, Env & env, Value & v)
 {
     if (!state.evalBool(env, cond))
@@ -838,7 +838,7 @@ void ExprAssert::eval(EvalState & state, Env & env, Value & v)
     body->eval(state, env, v);
 }
 
-    
+
 void ExprOpNot::eval(EvalState & state, Env & env, Value & v)
 {
     mkBool(v, !state.evalBool(env, e));
@@ -911,7 +911,7 @@ void ExprOpUpdate::eval(EvalState & state, Env & env, Value & v)
 
     while (i != v1.attrs->end()) v.attrs->push_back(*i++);
     while (j != v2.attrs->end()) v.attrs->push_back(*j++);
-    
+
     state.nrOpUpdateValuesCopied += v.attrs->size();
 }
 
@@ -996,12 +996,12 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
 void EvalState::strictForceValue(Value & v)
 {
     forceValue(v);
-    
+
     if (v.type == tAttrs) {
         foreach (Bindings::iterator, i, *v.attrs)
             strictForceValue(*i->value);
     }
-    
+
     else if (v.type == tList) {
         for (unsigned int n = 0; n < v.list.length; ++n)
             strictForceValue(*v.list.elems[n]);
@@ -1047,7 +1047,7 @@ string EvalState::forceString(Value & v)
 void copyContext(const Value & v, PathSet & context)
 {
     if (v.string.context)
-        for (const char * * p = v.string.context; *p; ++p) 
+        for (const char * * p = v.string.context; *p; ++p)
             context.insert(*p);
 }
 
@@ -1097,7 +1097,7 @@ string EvalState::coerceToString(Value & v, PathSet & context,
         Path path(canonPath(v.path));
 
         if (!copyToStore) return path;
-        
+
         if (nix::isDerivation(path))
             throwEvalError("file names are not allowed to end in `%1%'", drvExtension);
 
@@ -1146,7 +1146,7 @@ string EvalState::coerceToString(Value & v, PathSet & context,
             return result;
         }
     }
-    
+
     throwTypeError("cannot coerce %1% to a string", showType(v));
 }
 
@@ -1222,7 +1222,7 @@ bool EvalState::eqValues(Value & v1, Value & v2)
             for (i = v1.attrs->begin(), j = v2.attrs->begin(); i != v1.attrs->end(); ++i, ++j)
                 if (i->name != j->name || !eqValues(*i->value, *j->value))
                     return false;
-            
+
             return true;
         }
 
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index b7b527bc4e6f..f7b21f7a38c5 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -88,7 +88,7 @@ struct EvalState;
 std::ostream & operator << (std::ostream & str, const Value & v);
 
 
-class EvalState 
+class EvalState
 {
 public:
     SymbolTable symbols;
@@ -101,7 +101,7 @@ public:
     bool repair;
 
 private:
-    SrcToStore srcToStore; 
+    SrcToStore srcToStore;
 
     /* A cache from path names to parse trees. */
     std::map<Path, Expr *> parseTrees;
@@ -119,7 +119,7 @@ private:
     SearchPath::iterator searchPathInsertionPoint;
 
 public:
-    
+
     EvalState();
     ~EvalState();
 
@@ -131,7 +131,7 @@ public:
 
     /* Parse a Nix expression from the specified string. */
     Expr * parseExprFromString(const string & s, const Path & basePath);
-    
+
     /* Evaluate an expression read from the given file to normal
        form. */
     void evalFile(const Path & path, Value & v);
@@ -193,21 +193,21 @@ private:
     unsigned int baseEnvDispl;
 
 public:
-    
+
     /* The same, but used during parsing to resolve variables. */
     StaticEnv staticBaseEnv; // !!! should be private
 
 private:
-    
+
     void createBaseEnv();
-    
+
     void addConstant(const string & name, Value & v);
 
     void addPrimOp(const string & name,
         unsigned int arity, PrimOpFun primOp);
 
     inline Value * lookupVar(Env * env, const VarRef & var, bool noEval);
-    
+
     friend class ExprVar;
     friend class ExprAttrs;
     friend class ExprLet;
@@ -216,7 +216,7 @@ private:
         const Path & path, const Path & basePath);
 
 public:
-    
+
     /* Do a deep equality test between two values.  That is, list
        elements and attributes are compared recursively. */
     bool eqValues(Value & v1, Value & v2);
@@ -226,7 +226,7 @@ public:
     /* Automatically call a function for which each argument has a
        default value or has a binding in the `args' map. */
     void autoCallFunction(Bindings & args, Value & fun, Value & res);
-    
+
     /* Allocation primitives. */
     Value * allocValue();
     Env & allocEnv(unsigned int size);
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index 76cd372013a5..5d0360401dd3 100644
--- a/src/libexpr/lexer.l
+++ b/src/libexpr/lexer.l
@@ -15,14 +15,14 @@ using namespace nix;
 
 namespace nix {
 
-    
+
 static void initLoc(YYLTYPE * loc)
 {
     loc->first_line = loc->last_line = 1;
     loc->first_column = loc->last_column = 1;
 }
 
-    
+
 static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
 {
     loc->first_line = loc->last_line;
@@ -34,7 +34,7 @@ static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
            if (*s == '\n') /* cr/lf */
                s++;
            /* fall through */
-       case '\n': 
+       case '\n':
            ++loc->last_line;
            loc->last_column = 1;
            break;
@@ -68,7 +68,7 @@ static Expr * unescapeStr(SymbolTable & symbols, const char * s)
     return new ExprString(symbols.create(t));
 }
 
- 
+
 }
 
 #define YY_USER_INIT initLoc(yylloc)
@@ -171,7 +171,7 @@ or          { return OR_KW; }
 
 
 namespace nix {
-    
+
 /* Horrible, disgusting hack: allow the parser to set the scanner
    start condition back to STRING.  Necessary in interpolations like
    "foo${expr}bar"; after the close brace we have to go back to the
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 72bc0a14bed6..2b33f73015f0 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -224,11 +224,11 @@ void ExprAttrs::bindVars(const StaticEnv & env)
 {
     if (recursive) {
         StaticEnv newEnv(false, &env);
-    
+
         unsigned int displ = 0;
         foreach (AttrDefs::iterator, i, attrs)
             newEnv.vars[i->first] = i->second.displ = displ++;
-        
+
         foreach (AttrDefs::iterator, i, attrs)
             i->second.e->bindVars(i->second.inherited ? env : newEnv);
     }
@@ -247,9 +247,9 @@ void ExprList::bindVars(const StaticEnv & env)
 void ExprLambda::bindVars(const StaticEnv & env)
 {
     StaticEnv newEnv(false, &env);
-    
+
     unsigned int displ = 0;
-    
+
     if (!arg.empty()) newEnv.vars[arg] = displ++;
 
     if (matchAttrs) {
@@ -266,14 +266,14 @@ void ExprLambda::bindVars(const StaticEnv & env)
 void ExprLet::bindVars(const StaticEnv & env)
 {
     StaticEnv newEnv(false, &env);
-    
+
     unsigned int displ = 0;
     foreach (ExprAttrs::AttrDefs::iterator, i, attrs->attrs)
         newEnv.vars[i->first] = i->second.displ = displ++;
-    
+
     foreach (ExprAttrs::AttrDefs::iterator, i, attrs->attrs)
         i->second.e->bindVars(i->second.inherited ? env : newEnv);
-    
+
     body->bindVars(newEnv);
 }
 
@@ -290,8 +290,8 @@ void ExprWith::bindVars(const StaticEnv & env)
             prevWith = level;
             break;
         }
-    
-    attrs->bindVars(env);    
+
+    attrs->bindVars(env);
     StaticEnv newEnv(true, &env);
     body->bindVars(newEnv);
 }
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh
index 69372a77b64c..8733b9c7877c 100644
--- a/src/libexpr/nixexpr.hh
+++ b/src/libexpr/nixexpr.hh
@@ -114,7 +114,7 @@ struct VarRef
     /* Whether the variable comes from an environment (e.g. a rec, let
        or function argument) or from a "with". */
     bool fromWith;
-    
+
     /* In the former case, the value is obtained by going `level'
        levels up from the current environment and getting the
        `displ'th value in that environment.  In the latter case, the
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 0e3086004271..60ad3f0792c4 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -12,18 +12,18 @@
 %expect-rr 1
 
 %code requires {
-    
+
 #ifndef BISON_HEADER
 #define BISON_HEADER
-    
+
 #include "util.hh"
-    
+
 #include "nixexpr.hh"
 #include "eval.hh"
 
 namespace nix {
 
-    struct ParseData 
+    struct ParseData
     {
         EvalState & state;
         SymbolTable & symbols;
@@ -38,7 +38,7 @@ namespace nix {
             , sLetBody(symbols.create("<let-body>"))
             { };
     };
-    
+
 }
 
 #define YY_DECL int yylex \
@@ -63,14 +63,14 @@ using namespace nix;
 
 
 namespace nix {
-    
+
 
 static void dupAttr(const AttrPath & attrPath, const Pos & pos, const Pos & prevPos)
 {
     throw ParseError(format("attribute `%1%' at %2% already defined at %3%")
         % showAttrPath(attrPath) % pos % prevPos);
 }
- 
+
 
 static void dupAttr(Symbol attr, const Pos & pos, const Pos & prevPos)
 {
@@ -78,7 +78,7 @@ static void dupAttr(Symbol attr, const Pos & pos, const Pos & prevPos)
     throw ParseError(format("attribute `%1%' at %2% already defined at %3%")
         % showAttrPath(attrPath) % pos % prevPos);
 }
- 
+
 
 static void addAttr(ExprAttrs * attrs, AttrPath & attrPath,
     Expr * e, const Pos & pos)
@@ -121,7 +121,7 @@ static void addFormal(const Pos & pos, Formals * formals, const Formal & formal)
 static Expr * stripIndentation(SymbolTable & symbols, vector<Expr *> & es)
 {
     if (es.empty()) return new ExprString(symbols.create(""));
-    
+
     /* Figure out the minimum indentation.  Note that by design
        whitespace-only final lines are not taken into account.  (So
        the " " in "\n ''" is ignored, but the " " in "\n foo''" is.) */
@@ -170,7 +170,7 @@ static Expr * stripIndentation(SymbolTable & symbols, vector<Expr *> & es)
             es2->push_back(*i);
             continue;
         }
-        
+
         string s2;
         for (unsigned int j = 0; j < e->s.size(); ++j) {
             if (atStartOfLine) {
@@ -232,7 +232,7 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, ParseData * data, const char * err
 %}
 
 %union {
-  // !!! We're probably leaking stuff here.  
+  // !!! We're probably leaking stuff here.
   nix::Expr * e;
   nix::ExprList * list;
   nix::ExprAttrs * attrs;
@@ -465,7 +465,7 @@ formal
   : ID { $$ = new Formal(data->symbols.create($1), 0); }
   | ID '?' expr { $$ = new Formal(data->symbols.create($1), $3); }
   ;
-  
+
 %%
 
 
@@ -478,7 +478,7 @@ formal
 
 
 namespace nix {
-      
+
 
 Expr * EvalState::parse(const char * text,
     const Path & path, const Path & basePath)
@@ -492,7 +492,7 @@ Expr * EvalState::parse(const char * text,
     yy_scan_string(text, scanner);
     int res = yyparse(scanner, &data);
     yylex_destroy(scanner);
-    
+
     if (res) throw ParseError(data.error);
 
     try {
@@ -500,7 +500,7 @@ Expr * EvalState::parse(const char * text,
     } catch (Error & e) {
         throw ParseError(format("%1%, in `%2%'") % e.msg() % path);
     }
-    
+
     return data.result;
 }
 
@@ -552,7 +552,7 @@ void EvalState::addToSearchPath(const string & s)
         prefix = string(s, 0, pos);
         path = string(s, pos + 1);
     }
-    
+
     path = absPath(path);
     if (pathExists(path)) {
         debug(format("adding path `%1%' to the search path") % path);
@@ -565,7 +565,7 @@ Path EvalState::findFile(const string & path)
 {
     foreach (SearchPath::iterator, i, searchPath) {
         Path res;
-        if (i->first.empty()) 
+        if (i->first.empty())
             res = i->second + "/" + path;
         else {
             if (path.compare(0, i->first.size(), i->first) != 0 ||
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index deb66fd69f16..bcaa51dd6318 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -37,7 +37,7 @@ std::pair<string, string> decodeContext(const string & s)
 
 
 /* Load and evaluate an expression from path specified by the
-   argument. */ 
+   argument. */
 static void prim_import(EvalState & state, Value * * args, Value & v)
 {
     PathSet context;
@@ -56,7 +56,7 @@ static void prim_import(EvalState & state, Value * * args, Value & v)
                 unsigned long long downloadSize, narSize;
                 queryMissing(*store, singleton<PathSet>(ctx),
                     willBuild, willSubstitute, unknown, downloadSize, narSize);
-                  
+
                 /* !!! If using a substitute, we only need to fetch
                    the selected output of this derivation. */
                 store->buildPaths(singleton<PathSet>(ctx));
@@ -197,7 +197,7 @@ static void prim_genericClosure(EvalState & state, Value * * args, Value & v)
         if (doneKeys.find(*key->value) != doneKeys.end()) continue;
         doneKeys.insert(*key->value);
         res.push_back(*e);
-        
+
         /* Call the `operator' function with `e' as argument. */
         Value call;
         mkApp(call, *op->value, *e);
@@ -247,7 +247,7 @@ static void prim_addErrorContext(EvalState & state, Value * * args, Value & v)
 }
 
 
-/* Try evaluating the argument. Success => {success=true; value=something;}, 
+/* Try evaluating the argument. Success => {success=true; value=something;},
  * else => {success=false; value=false;} */
 static void prim_tryEval(EvalState & state, Value * * args, Value & v)
 {
@@ -634,7 +634,7 @@ static void prim_toFile(EvalState & state, Value * * args, Value & v)
             throw EvalError(format("in `toFile': the file `%1%' cannot refer to derivation outputs") % name);
         refs.insert(path);
     }
-    
+
     Path storePath = settings.readOnlyMode
         ? computeStorePathForText(name, contents, refs)
         : store->addTextToStore(name, contents, refs, state.repair);
@@ -651,7 +651,7 @@ struct FilterFromExpr : PathFilter
 {
     EvalState & state;
     Value & filter;
-    
+
     FilterFromExpr(EvalState & state, Value & filter)
         : state(state), filter(filter)
     {
@@ -672,12 +672,12 @@ struct FilterFromExpr : PathFilter
         state.callFunction(filter, arg1, fun2);
 
         Value arg2;
-        mkString(arg2, 
+        mkString(arg2,
             S_ISREG(st.st_mode) ? "regular" :
             S_ISDIR(st.st_mode) ? "directory" :
             S_ISLNK(st.st_mode) ? "symlink" :
             "unknown" /* not supported, will fail! */);
-        
+
         Value res;
         state.callFunction(fun2, arg2, res);
 
@@ -801,12 +801,12 @@ static void prim_listToAttrs(EvalState & state, Value * * args, Value & v)
     for (unsigned int i = 0; i < args[0]->list.length; ++i) {
         Value & v2(*args[0]->list.elems[i]);
         state.forceAttrs(v2);
-        
+
         Bindings::iterator j = v2.attrs->find(state.sName);
         if (j == v2.attrs->end())
             throw TypeError("`name' attribute missing in a call to `listToAttrs'");
         string name = state.forceStringNoCtx(*j->value);
-        
+
         Bindings::iterator j2 = v2.attrs->find(state.symbols.create("value"));
         if (j2 == v2.attrs->end())
             throw TypeError("`value' attribute missing in a call to `listToAttrs'");
@@ -830,7 +830,7 @@ static void prim_intersectAttrs(EvalState & state, Value * * args, Value & v)
 {
     state.forceAttrs(*args[0]);
     state.forceAttrs(*args[1]);
-        
+
     state.mkAttrs(v, std::min(args[0]->attrs->size(), args[1]->attrs->size()));
 
     foreach (Bindings::iterator, i, *args[0]->attrs) {
@@ -933,7 +933,7 @@ static void prim_map(EvalState & state, Value * * args, Value & v)
     state.mkList(v, args[1]->list.length);
 
     for (unsigned int n = 0; n < v.list.length; ++n)
-        mkApp(*(v.list.elems[n] = state.allocValue()), 
+        mkApp(*(v.list.elems[n] = state.allocValue()),
             *args[0], *args[1]->list.elems[n]);
 }
 
@@ -1105,7 +1105,7 @@ static void prim_unsafeDiscardOutputDependency(EvalState & state, Value * * args
         if (p.at(0) == '=') p = "~" + string(p, 1);
         context2.insert(p);
     }
-    
+
     mkString(v, s, context2);
 }
 
@@ -1167,10 +1167,10 @@ void EvalState::createBaseEnv()
 
     mkBool(v, true);
     addConstant("true", v);
-    
+
     mkBool(v, false);
     addConstant("false", v);
-    
+
     v.type = tNull;
     addConstant("null", v);