From 11849a320e4f522b97fcdf09ff0940496880475b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 20 Aug 2014 17:00:17 +0200 Subject: Use proper quotes everywhere --- src/libexpr/attr-path.cc | 14 ++++---- src/libexpr/common-opts.cc | 4 +-- src/libexpr/eval.cc | 28 ++++++++-------- src/libexpr/get-drvs.cc | 2 +- src/libexpr/json-to-value.cc | 6 ++-- src/libexpr/lexer.l | 2 +- src/libexpr/nixexpr.cc | 4 +-- src/libexpr/nixexpr.hh | 2 +- src/libexpr/parser.y | 14 ++++---- src/libexpr/primops.cc | 80 ++++++++++++++++++++++---------------------- 10 files changed, 78 insertions(+), 78 deletions(-) (limited to 'src/libexpr') diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc index 4f28a549f..fdd61a5fd 100644 --- a/src/libexpr/attr-path.cc +++ b/src/libexpr/attr-path.cc @@ -19,7 +19,7 @@ static Strings parseAttrPath(const string & s) ++i; while (1) { if (i == s.end()) - throw Error(format("missing closing quote in selection path `%1%'") % s); + throw Error(format("missing closing quote in selection path ‘%1%’") % s); if (*i == '"') break; cur.push_back(*i++); } @@ -38,7 +38,7 @@ Value * findAlongAttrPath(EvalState & state, const string & attrPath, Strings tokens = parseAttrPath(attrPath); Error attrError = - Error(format("attribute selection path `%1%' does not match expression") % attrPath); + Error(format("attribute selection path ‘%1%’ does not match expression") % attrPath); Value * v = &vIn; @@ -63,15 +63,15 @@ Value * findAlongAttrPath(EvalState & state, const string & attrPath, if (v->type != tAttrs) throw TypeError( - format("the expression selected by the selection path `%1%' should be a set but is %2%") + format("the expression selected by the selection path ‘%1%’ should be a set but is %2%") % attrPath % showType(*v)); if (attr.empty()) - throw Error(format("empty attribute name in selection path `%1%'") % attrPath); + throw Error(format("empty attribute name in selection path ‘%1%’") % attrPath); Bindings::iterator a = v->attrs->find(state.symbols.create(attr)); if (a == v->attrs->end()) - throw Error(format("attribute `%1%' in selection path `%2%' not found") % attr % attrPath); + throw Error(format("attribute ‘%1%’ in selection path ‘%2%’ not found") % attr % attrPath); v = &*a->value; } @@ -79,11 +79,11 @@ Value * findAlongAttrPath(EvalState & state, const string & attrPath, if (v->type != tList) throw TypeError( - format("the expression selected by the selection path `%1%' should be a list but is %2%") + format("the expression selected by the selection path ‘%1%’ should be a list but is %2%") % attrPath % showType(*v)); if (attrIndex >= v->list.length) - throw Error(format("list index %1% in selection path `%2%' is out of range") % attrIndex % attrPath); + throw Error(format("list index %1% in selection path ‘%2%’ is out of range") % attrIndex % attrPath); v = v->list.elems[attrIndex]; } diff --git a/src/libexpr/common-opts.cc b/src/libexpr/common-opts.cc index 2e8bb29c7..25f1e7117 100644 --- a/src/libexpr/common-opts.cc +++ b/src/libexpr/common-opts.cc @@ -12,7 +12,7 @@ bool parseAutoArgs(Strings::iterator & i, string arg = *i; if (arg != "--arg" && arg != "--argstr") return false; - UsageError error(format("`%1%' requires two arguments") % arg); + UsageError error(format("‘%1%’ requires two arguments") % arg); if (++i == argsEnd) throw error; string name = *i; @@ -43,7 +43,7 @@ bool parseSearchPathArg(Strings::iterator & i, const Strings::iterator & argsEnd, Strings & searchPath) { if (*i != "-I") return false; - if (++i == argsEnd) throw UsageError("`-I' requires an argument"); + if (++i == argsEnd) throw UsageError("‘-I’ requires an argument"); searchPath.push_back(*i); return true; } diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index b752e1c75..5cb6fc3cf 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -396,7 +396,7 @@ inline Value * EvalState::lookupVar(Env * env, const ExprVar & var, bool noEval) return j->value; } if (!env->prevWith) - throwUndefinedVarError("undefined variable `%1%' at %2%", var.name, var.pos); + throwUndefinedVarError("undefined variable ‘%1%’ at %2%", var.name, var.pos); for (unsigned int l = env->prevWith; l; --l, env = env->up) ; } } @@ -537,12 +537,12 @@ void EvalState::evalFile(const Path & path, Value & v) return; } - startNest(nest, lvlTalkative, format("evaluating file `%1%'") % path2); + startNest(nest, lvlTalkative, format("evaluating file ‘%1%’") % path2); Expr * e = parseExprFromFile(path2); try { eval(e, v); } catch (Error & e) { - addErrorPrefix(e, "while evaluating the file `%1%':\n", path2); + addErrorPrefix(e, "while evaluating the file ‘%1%’:\n", path2); throw; } @@ -686,7 +686,7 @@ void ExprAttrs::eval(EvalState & state, Env & env, Value & v) Symbol nameSym = state.symbols.create(nameVal.string.s); Bindings::iterator j = v.attrs->find(nameSym); if (j != v.attrs->end()) - throwEvalError("dynamic attribute `%1%' at %2% already defined at %3%", nameSym, i->pos, *j->pos); + throwEvalError("dynamic attribute ‘%1%’ at %2% already defined at %3%", nameSym, i->pos, *j->pos); i->valueExpr->setName(nameSym); /* Keep sorted order so find can catch duplicates */ @@ -764,7 +764,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v) staticPath.push_back(AttrName(getName(*j, state, env))); for (j = j + 1; j != attrPath.end(); ++j) staticPath.push_back(*j); - throwEvalError("attribute `%1%' missing, at %2%", showAttrPath(staticPath), pos); + throwEvalError("attribute ‘%1%’ missing, at %2%", showAttrPath(staticPath), pos); } } vAttrs = j->value; @@ -776,7 +776,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v) } catch (Error & e) { if (pos2 && pos2->file != state.sDerivationNix) - addErrorPrefix(e, "while evaluating the attribute `%1%' at %2%:\n", + addErrorPrefix(e, "while evaluating the attribute ‘%1%’ at %2%:\n", showAttrPath(attrPath), *pos2); throw; } @@ -900,7 +900,7 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & po foreach (Formals::Formals_::iterator, i, lambda.formals->formals) { Bindings::iterator j = arg.attrs->find(i->name); if (j == arg.attrs->end()) { - if (!i->def) throwTypeError("%1% called without required argument `%2%', at %3%", + if (!i->def) throwTypeError("%1% called without required argument ‘%2%’, at %3%", lambda, i->name, pos); env2.values[displ++] = i->def->maybeThunk(*this, env2); } else { @@ -916,7 +916,7 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & po user. */ foreach (Bindings::iterator, i, *arg.attrs) if (lambda.formals->argNames.find(i->name) == lambda.formals->argNames.end()) - throwTypeError("%1% called with unexpected argument `%2%', at %3%", lambda, i->name, pos); + throwTypeError("%1% called with unexpected argument ‘%2%’, at %3%", lambda, i->name, pos); abort(); // can't happen } } @@ -963,7 +963,7 @@ void EvalState::autoCallFunction(Bindings & args, Value & fun, Value & res) if (j != args.end()) actualArgs->attrs->push_back(*j); else if (!i->def) - throwTypeError("cannot auto-call a function that has an argument without a default value (`%1%')", i->name); + throwTypeError("cannot auto-call a function that has an argument without a default value (‘%1%’)", i->name); } actualArgs->attrs->sort(); @@ -1233,10 +1233,10 @@ string EvalState::forceStringNoCtx(Value & v, const Pos & pos) string s = forceString(v, pos); if (v.string.context) { if (pos) - throwEvalError("the string `%1%' is not allowed to refer to a store path (such as `%2%'), at %3%", + throwEvalError("the string ‘%1%’ is not allowed to refer to a store path (such as ‘%2%’), at %3%", v.string.s, v.string.context[0], pos); else - throwEvalError("the string `%1%' is not allowed to refer to a store path (such as `%2%')", + throwEvalError("the string ‘%1%’ is not allowed to refer to a store path (such as ‘%2%’)", v.string.s, v.string.context[0]); } return s; @@ -1307,7 +1307,7 @@ string EvalState::coerceToString(const Pos & pos, Value & v, PathSet & context, string EvalState::copyPathToStore(PathSet & context, const Path & path) { if (nix::isDerivation(path)) - throwEvalError("file names are not allowed to end in `%1%'", drvExtension); + throwEvalError("file names are not allowed to end in ‘%1%’", drvExtension); Path dstPath; if (srcToStore[path] != "") @@ -1317,7 +1317,7 @@ string EvalState::copyPathToStore(PathSet & context, const Path & path) ? computeStorePathForPath(path).first : store->addToStore(path, true, htSHA256, defaultPathFilter, repair); srcToStore[path] = dstPath; - printMsg(lvlChatty, format("copied source `%1%' -> `%2%'") + printMsg(lvlChatty, format("copied source ‘%1%’ -> ‘%2%’") % path % dstPath); } @@ -1330,7 +1330,7 @@ Path EvalState::coerceToPath(const Pos & pos, Value & v, PathSet & context) { string path = coerceToString(pos, v, context, false, false); if (path == "" || path[0] != '/') - throwEvalError("string `%1%' doesn't represent an absolute path, at %1%", path, pos); + throwEvalError("string ‘%1%’ doesn't represent an absolute path, at %1%", path, pos); return path; } diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index 57b87ab58..db91eab37 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -259,7 +259,7 @@ static void getDerivations(EvalState & state, Value & vIn, attrs.insert(std::pair(i->name, i->name)); foreach (SortedSymbols::iterator, i, attrs) { - startNest(nest, lvlDebug, format("evaluating attribute `%1%'") % i->first); + startNest(nest, lvlDebug, format("evaluating attribute ‘%1%’") % i->first); string pathPrefix2 = addToPath(pathPrefix, i->first); Value & v2(*v.attrs->find(i->second)->value); if (combineChannels) diff --git a/src/libexpr/json-to-value.cc b/src/libexpr/json-to-value.cc index 7f60e7cc6..af4394b0b 100644 --- a/src/libexpr/json-to-value.cc +++ b/src/libexpr/json-to-value.cc @@ -65,7 +65,7 @@ static void parseJSON(EvalState & state, const char * & s, Value & v) values.push_back(v2); skipWhitespace(s); if (*s == ']') break; - if (*s != ',') throw JSONParseError("expected `,' or `]' after JSON array element"); + if (*s != ',') throw JSONParseError("expected ‘,’ or ‘]’ after JSON array element"); s++; } s++; @@ -82,14 +82,14 @@ static void parseJSON(EvalState & state, const char * & s, Value & v) if (v.attrs->empty() && *s == '}') break; string name = parseJSONString(s); skipWhitespace(s); - if (*s != ':') throw JSONParseError("expected `:' in JSON object"); + if (*s != ':') throw JSONParseError("expected ‘:’ in JSON object"); s++; Value * v2 = state.allocValue(); parseJSON(state, s, *v2); v.attrs->push_back(Attr(state.symbols.create(name), v2)); skipWhitespace(s); if (*s == '}') break; - if (*s != ',') throw JSONParseError("expected `,' or `}' after JSON member"); + if (*s != ',') throw JSONParseError("expected ‘,’ or ‘}’ after JSON member"); s++; } v.attrs->sort(); diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 911850cc5..82520ee7a 100644 --- a/src/libexpr/lexer.l +++ b/src/libexpr/lexer.l @@ -113,7 +113,7 @@ or { return OR_KW; } {INT} { errno = 0; yylval->n = strtol(yytext, 0, 10); if (errno != 0) - throw ParseError(format("invalid integer `%1%'") % yytext); + throw ParseError(format("invalid integer ‘%1%’") % yytext); return INT; } diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index bb72c007c..c8521718b 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -212,7 +212,7 @@ void ExprVar::bindVars(const StaticEnv & env) /* Otherwise, the variable must be obtained from the nearest enclosing `with'. If there is no `with', then we can issue an "undefined variable" error now. */ - if (withLevel == -1) throw UndefinedVarError(format("undefined variable `%1%' at %2%") % name % pos); + if (withLevel == -1) throw UndefinedVarError(format("undefined variable ‘%1%’ at %2%") % name % pos); fromWith = true; this->level = withLevel; @@ -364,7 +364,7 @@ void ExprLambda::setName(Symbol & name) string ExprLambda::showNamePos() const { - return (format("%1% at %2%") % (name.set() ? "`" + (string) name + "'" : "anonymous function") % pos).str(); + return (format("%1% at %2%") % (name.set() ? "‘" + (string) name + "’" : "anonymous function") % pos).str(); } diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 9c631d093..2619a7026 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -224,7 +224,7 @@ struct ExprLambda : Expr : pos(pos), arg(arg), matchAttrs(matchAttrs), formals(formals), body(body) { if (!arg.empty() && formals && formals->argNames.find(arg) != formals->argNames.end()) - throw ParseError(format("duplicate formal function argument `%1%' at %2%") + throw ParseError(format("duplicate formal function argument ‘%1%’ at %2%") % arg % pos); }; void setName(Symbol & name); diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index a19269b33..60a87ca94 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -67,14 +67,14 @@ 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%") + 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) { - throw ParseError(format("attribute `%1%' at %2% already defined at %3%") + throw ParseError(format("attribute ‘%1%’ at %2% already defined at %3%") % attr % pos % prevPos); } @@ -123,7 +123,7 @@ static void addAttr(ExprAttrs * attrs, AttrPath & attrPath, static void addFormal(const Pos & pos, Formals * formals, const Formal & formal) { if (formals->argNames.find(formal.name) != formals->argNames.end()) - throw ParseError(format("duplicate formal function argument `%1%' at %2%") + throw ParseError(format("duplicate formal function argument ‘%1%’ at %2%") % formal.name % pos); formals->formals.push_front(formal); formals->argNames.insert(formal.name); @@ -570,7 +570,7 @@ Path resolveExprPath(Path path) struct stat st; while (true) { if (lstat(path.c_str(), &st)) - throw SysError(format("getting status of `%1%'") % path); + throw SysError(format("getting status of ‘%1%’") % path); if (!S_ISLNK(st.st_mode)) break; path = absPath(readLink(path), dirOf(path)); } @@ -621,10 +621,10 @@ void EvalState::addToSearchPath(const string & s, bool warn) path = absPath(path); if (pathExists(path)) { - debug(format("adding path `%1%' to the search path") % path); + debug(format("adding path ‘%1%’ to the search path") % path); searchPath.push_back(std::pair(prefix, path)); } else if (warn) - printMsg(lvlError, format("warning: Nix search path entry `%1%' does not exist, ignoring") % path); + printMsg(lvlError, format("warning: Nix search path entry ‘%1%’ does not exist, ignoring") % path); } @@ -649,7 +649,7 @@ Path EvalState::findFile(SearchPath & searchPath, const string & path) } if (pathExists(res)) return canonPath(res); } - throw ThrownError(format("file `%1%' was not found in the Nix search path (add it using $NIX_PATH or -I)") % path); + throw ThrownError(format("file ‘%1%’ was not found in the Nix search path (add it using $NIX_PATH or -I)") % path); } diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 4436b636b..0c4381b11 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -43,7 +43,7 @@ struct InvalidPathError : EvalError { Path path; InvalidPathError(const Path & path) : - EvalError(format("path `%1%' is not valid") % path), path(path) {}; + EvalError(format("path ‘%1%’ is not valid") % path), path(path) {}; ~InvalidPathError() throw () { }; }; @@ -82,7 +82,7 @@ static void prim_scopedImport(EvalState & state, const Pos & pos, Value * * args try { realiseContext(context); } catch (InvalidPathError & e) { - throw EvalError(format("cannot import `%1%', since path `%2%' is not valid, at %3%") + throw EvalError(format("cannot import ‘%1%’, since path ‘%2%’ is not valid, at %3%") % path % e.path % pos); } @@ -123,7 +123,7 @@ static void prim_scopedImport(EvalState & state, const Pos & pos, Value * * args env->values[displ++] = attr.value; } - startNest(nest, lvlTalkative, format("evaluating file `%1%'") % path); + startNest(nest, lvlTalkative, format("evaluating file ‘%1%’") % path); Expr * e = state.parseExprFromFile(resolveExprPath(path), staticEnv); e->eval(state, *env, v); @@ -145,7 +145,7 @@ static void prim_importNative(EvalState & state, const Pos & pos, Value * * args try { realiseContext(context); } catch (InvalidPathError & e) { - throw EvalError(format("cannot import `%1%', since path `%2%' is not valid, at %3%") + throw EvalError(format("cannot import ‘%1%’, since path ‘%2%’ is not valid, at %3%") % path % e.path % pos); } @@ -153,16 +153,16 @@ static void prim_importNative(EvalState & state, const Pos & pos, Value * * args void *handle = dlopen(path.c_str(), RTLD_LAZY | RTLD_LOCAL); if (!handle) - throw EvalError(format("could not open `%1%': %2%") % path % dlerror()); + throw EvalError(format("could not open ‘%1%’: %2%") % path % dlerror()); dlerror(); ValueInitializer func = (ValueInitializer) dlsym(handle, sym.c_str()); if(!func) { char *message = dlerror(); if (message) - throw EvalError(format("could not load symbol `%1%' from `%2%': %3%") % sym % path % message); + throw EvalError(format("could not load symbol ‘%1%’ from ‘%2%’: %3%") % sym % path % message); else - throw EvalError(format("symbol `%1%' from `%2%' resolved to NULL when a function pointer was expected") + throw EvalError(format("symbol ‘%1%’ from ‘%2%’ resolved to NULL when a function pointer was expected") % sym % path); } @@ -273,7 +273,7 @@ static void prim_genericClosure(EvalState & state, const Pos & pos, Value * * ar Bindings::iterator startSet = args[0]->attrs->find(state.symbols.create("startSet")); if (startSet == args[0]->attrs->end()) - throw EvalError(format("attribute `startSet' required, at %1%") % pos); + throw EvalError(format("attribute ‘startSet’ required, at %1%") % pos); state.forceList(*startSet->value, pos); ValueList workSet; @@ -284,7 +284,7 @@ static void prim_genericClosure(EvalState & state, const Pos & pos, Value * * ar Bindings::iterator op = args[0]->attrs->find(state.symbols.create("operator")); if (op == args[0]->attrs->end()) - throw EvalError(format("attribute `operator' required, at %1%") % pos); + throw EvalError(format("attribute ‘operator’ required, at %1%") % pos); state.forceValue(*op->value); /* Construct the closure by applying the operator to element of @@ -303,7 +303,7 @@ static void prim_genericClosure(EvalState & state, const Pos & pos, Value * * ar Bindings::iterator key = e->attrs->find(state.symbols.create("key")); if (key == e->attrs->end()) - throw EvalError(format("attribute `key' required, at %1%") % pos); + throw EvalError(format("attribute ‘key’ required, at %1%") % pos); state.forceValue(*key->value); if (doneKeys.find(key->value) != doneKeys.end()) continue; @@ -333,7 +333,7 @@ static void prim_genericClosure(EvalState & state, const Pos & pos, Value * * ar static void prim_abort(EvalState & state, const Pos & pos, Value * * args, Value & v) { PathSet context; - throw Abort(format("evaluation aborted with the following error message: `%1%'") % + throw Abort(format("evaluation aborted with the following error message: ‘%1%’") % state.coerceToString(pos, *args[0], context)); } @@ -418,13 +418,13 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * /* Figure out the name first (for stack backtraces). */ Bindings::iterator attr = args[0]->attrs->find(state.sName); if (attr == args[0]->attrs->end()) - throw EvalError(format("required attribute `name' missing, at %1%") % pos); + throw EvalError(format("required attribute ‘name’ missing, at %1%") % pos); string drvName; Pos & posDrvName(*attr->pos); try { drvName = state.forceStringNoCtx(*attr->value, pos); } catch (Error & e) { - e.addPrefix(format("while evaluating the derivation attribute `name' at %1%:\n") % posDrvName); + e.addPrefix(format("while evaluating the derivation attribute ‘name’ at %1%:\n") % posDrvName); throw; } @@ -448,7 +448,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * foreach (Bindings::iterator, i, *args[0]->attrs) { if (i->name == state.sIgnoreNulls) continue; string key = i->name; - startNest(nest, lvlVomit, format("processing attribute `%1%'") % key); + startNest(nest, lvlVomit, format("processing attribute ‘%1%’") % key); try { @@ -476,28 +476,28 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * else if (i->name == state.sSystem) drv.platform = s; else if (i->name == state.sName) { drvName = s; - printMsg(lvlVomit, format("derivation name is `%1%'") % drvName); + printMsg(lvlVomit, format("derivation name is ‘%1%’") % drvName); } else if (key == "outputHash") outputHash = s; else if (key == "outputHashAlgo") outputHashAlgo = s; else if (key == "outputHashMode") { if (s == "recursive") outputHashRecursive = true; else if (s == "flat") outputHashRecursive = false; - else throw EvalError(format("invalid value `%1%' for `outputHashMode' attribute, at %2%") % s % posDrvName); + else throw EvalError(format("invalid value ‘%1%’ for ‘outputHashMode’ attribute, at %2%") % s % posDrvName); } else if (key == "outputs") { Strings tmp = tokenizeString(s); outputs.clear(); foreach (Strings::iterator, j, tmp) { if (outputs.find(*j) != outputs.end()) - throw EvalError(format("duplicate derivation output `%1%', at %2%") % *j % posDrvName); + throw EvalError(format("duplicate derivation output ‘%1%’, at %2%") % *j % posDrvName); /* !!! Check whether *j is a valid attribute name. */ /* Derivations cannot be named ‘drv’, because then we'd have an attribute ‘drvPath’ in the resulting set. */ if (*j == "drv") - throw EvalError(format("invalid derivation output name `drv', at %1%") % posDrvName); + throw EvalError(format("invalid derivation output name ‘drv’, at %1%") % posDrvName); outputs.insert(*j); } if (outputs.empty()) @@ -506,7 +506,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * } } catch (Error & e) { - e.addPrefix(format("while evaluating the attribute `%1%' of the derivation `%2%' at %3%:\n") + e.addPrefix(format("while evaluating the attribute ‘%1%’ of the derivation ‘%2%’ at %3%:\n") % key % drvName % posDrvName); throw; } @@ -557,14 +557,14 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * /* Do we have all required attributes? */ if (drv.builder == "") - throw EvalError(format("required attribute `builder' missing, at %1%") % posDrvName); + throw EvalError(format("required attribute ‘builder’ missing, at %1%") % posDrvName); if (drv.platform == "") - throw EvalError(format("required attribute `system' missing, at %1%") % posDrvName); + throw EvalError(format("required attribute ‘system’ missing, at %1%") % posDrvName); /* Check whether the derivation name is valid. */ checkStoreName(drvName); if (isDerivation(drvName)) - throw EvalError(format("derivation names are not allowed to end in `%1%', at %2%") + throw EvalError(format("derivation names are not allowed to end in ‘%1%’, at %2%") % drvExtension % posDrvName); if (outputHash != "") { @@ -574,7 +574,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * HashType ht = parseHashType(outputHashAlgo); if (ht == htUnknown) - throw EvalError(format("unknown hash algorithm `%1%', at %2%") % outputHashAlgo % posDrvName); + throw EvalError(format("unknown hash algorithm ‘%1%’, at %2%") % outputHashAlgo % posDrvName); Hash h = parseHash16or32(ht, outputHash); outputHash = printHash(h); if (outputHashRecursive) outputHashAlgo = "r:" + outputHashAlgo; @@ -610,7 +610,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * /* Write the resulting term into the Nix store directory. */ Path drvPath = writeDerivation(*store, drv, drvName, state.repair); - printMsg(lvlChatty, format("instantiated `%1%' -> `%2%'") + printMsg(lvlChatty, format("instantiated ‘%1%’ -> ‘%2%’") % drvName % drvPath); /* Optimisation, but required in read-only mode! because in that @@ -659,7 +659,7 @@ static void prim_storePath(EvalState & state, const Pos & pos, Value * * args, V e.g. nix-push does the right thing. */ if (!isStorePath(path)) path = canonPath(path, true); if (!isInStore(path)) - throw EvalError(format("path `%1%' is not in the Nix store, at %2%") % path % pos); + throw EvalError(format("path ‘%1%’ is not in the Nix store, at %2%") % path % pos); Path path2 = toStorePath(path); if (!settings.readOnlyMode) store->ensurePath(path2); @@ -673,7 +673,7 @@ static void prim_pathExists(EvalState & state, const Pos & pos, Value * * args, PathSet context; Path path = state.coerceToPath(pos, *args[0], context); if (!context.empty()) - throw EvalError(format("string `%1%' cannot refer to other paths, at %2%") % path % pos); + throw EvalError(format("string ‘%1%’ cannot refer to other paths, at %2%") % path % pos); mkBool(v, pathExists(path)); } @@ -704,7 +704,7 @@ static void prim_readFile(EvalState & state, const Pos & pos, Value * * args, Va PathSet context; Path path = state.coerceToPath(pos, *args[0], context); if (!context.empty()) - throw EvalError(format("string `%1%' cannot refer to other paths, at %2%") % path % pos); + throw EvalError(format("string ‘%1%’ cannot refer to other paths, at %2%") % path % pos); mkString(v, readFile(path).c_str()); } @@ -729,7 +729,7 @@ static void prim_findFile(EvalState & state, const Pos & pos, Value * * args, Va i = v2.attrs->find(state.symbols.create("path")); if (i == v2.attrs->end()) - throw EvalError(format("attribute `path' missing, at %1%") % pos); + throw EvalError(format("attribute ‘path’ missing, at %1%") % pos); string path = state.coerceToPath(pos, *i->value, context); searchPath.push_back(std::pair(prefix, path)); @@ -740,7 +740,7 @@ static void prim_findFile(EvalState & state, const Pos & pos, Value * * args, Va try { realiseContext(context); } catch (InvalidPathError & e) { - throw EvalError(format("cannot find `%1%', since path `%2%' is not valid, at %3%") + throw EvalError(format("cannot find ‘%1%’, since path ‘%2%’ is not valid, at %3%") % path % e.path % pos); } @@ -799,7 +799,7 @@ static void prim_toFile(EvalState & state, const Pos & pos, Value * * args, Valu Path path = *i; if (path.at(0) == '=') path = string(path, 1); if (isDerivation(path)) - throw EvalError(format("in `toFile': the file `%1%' cannot refer to derivation outputs, at %2%") % name % pos); + throw EvalError(format("in ‘toFile’: the file ‘%1%’ cannot refer to derivation outputs, at %2%") % name % pos); refs.insert(path); } @@ -829,7 +829,7 @@ struct FilterFromExpr : PathFilter { struct stat st; if (lstat(path.c_str(), &st)) - throw SysError(format("getting attributes of path `%1%'") % path); + throw SysError(format("getting attributes of path ‘%1%’") % path); /* Call the filter function. The first argument is the path, the second is a string indicating the type of the file. */ @@ -859,11 +859,11 @@ static void prim_filterSource(EvalState & state, const Pos & pos, Value * * args PathSet context; Path path = state.coerceToPath(pos, *args[1], context); if (!context.empty()) - throw EvalError(format("string `%1%' cannot refer to other paths, at %2%") % path % pos); + throw EvalError(format("string ‘%1%’ cannot refer to other paths, at %2%") % path % pos); state.forceValue(*args[0]); if (args[0]->type != tLambda) - throw TypeError(format("first argument in call to `filterSource' is not a function but %1%, at %2%") % showType(*args[0]) % pos); + throw TypeError(format("first argument in call to ‘filterSource’ is not a function but %1%, at %2%") % showType(*args[0]) % pos); FilterFromExpr filter(state, *args[0]); @@ -906,7 +906,7 @@ void prim_getAttr(EvalState & state, const Pos & pos, Value * * args, Value & v) // !!! Should we create a symbol here or just do a lookup? Bindings::iterator i = args[1]->attrs->find(state.symbols.create(attr)); if (i == args[1]->attrs->end()) - throw EvalError(format("attribute `%1%' missing, at %2%") % attr % pos); + throw EvalError(format("attribute ‘%1%’ missing, at %2%") % attr % pos); // !!! add to stack trace? if (state.countCalls && i->pos) state.attrSelects[*i->pos]++; state.forceValue(*i->value); @@ -986,14 +986,14 @@ static void prim_listToAttrs(EvalState & state, const Pos & pos, Value * * args, Bindings::iterator j = v2.attrs->find(state.sName); if (j == v2.attrs->end()) - throw TypeError(format("`name' attribute missing in a call to `listToAttrs', at %1%") % pos); + throw TypeError(format("‘name’ attribute missing in a call to ‘listToAttrs’, at %1%") % pos); string name = state.forceStringNoCtx(*j->value, pos); Symbol sym = state.symbols.create(name); if (seen.find(sym) == seen.end()) { Bindings::iterator j2 = v2.attrs->find(state.symbols.create(state.sValue)); if (j2 == v2.attrs->end()) - throw TypeError(format("`value' attribute missing in a call to `listToAttrs', at %1%") % pos); + throw TypeError(format("‘value’ attribute missing in a call to ‘listToAttrs’, at %1%") % pos); v.attrs->push_back(Attr(sym, j2->value, j2->pos)); seen.insert(sym); @@ -1039,7 +1039,7 @@ static void prim_functionArgs(EvalState & state, const Pos & pos, Value * * args { state.forceValue(*args[0]); if (args[0]->type != tLambda) - throw TypeError(format("`functionArgs' requires a function, at %1%") % pos); + throw TypeError(format("‘functionArgs’ requires a function, at %1%") % pos); if (!args[0]->lambda.fun->matchAttrs) { state.mkAttrs(v, 0); @@ -1098,7 +1098,7 @@ static void prim_tail(EvalState & state, const Pos & pos, Value * * args, Value { state.forceList(*args[0], pos); if (args[0]->list.length == 0) - throw Error(format("`tail' called on an empty list, at %1%") % pos); + throw Error(format("‘tail’ called on an empty list, at %1%") % pos); state.mkList(v, args[0]->list.length - 1); for (unsigned int n = 0; n < v.list.length; ++n) v.list.elems[n] = args[0]->list.elems[n + 1]; @@ -1247,7 +1247,7 @@ static void prim_substring(EvalState & state, const Pos & pos, Value * * args, V PathSet context; string s = state.coerceToString(pos, *args[2], context); - if (start < 0) throw EvalError(format("negative start position in `substring', at %1%") % pos); + if (start < 0) throw EvalError(format("negative start position in ‘substring’, at %1%") % pos); mkString(v, (unsigned int) start >= s.size() ? "" : string(s, start, len), context); } @@ -1297,7 +1297,7 @@ static void prim_hashString(EvalState & state, const Pos & pos, Value * * args, string type = state.forceStringNoCtx(*args[0], pos); HashType ht = parseHashType(type); if (ht == htUnknown) - throw Error(format("unknown hash type `%1%', at %2%") % type % pos); + throw Error(format("unknown hash type ‘%1%’, at %2%") % type % pos); PathSet context; // discarded string s = state.forceString(*args[1], context); -- cgit v1.2.3