Merge changes I995f0bdc,Icdbaad17 into main
* changes: libexpr: Refactor ExprState::pushExpr libexpr: Remove `Expr::show`, add JSON expression serialization
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
---
|
||||
synopsis: '`nix-instantiate --parse` outputs json'
|
||||
issues: [fj#487, 11124, 4726, 3077]
|
||||
cls: [2190]
|
||||
category: Breaking Changes
|
||||
credits: [piegames, horrors]
|
||||
---
|
||||
|
||||
`nix-instantiate --parse` does not print out the AST in a Nix-like format anymore.
|
||||
Instead, it now prints a JSON representation of the internal expression tree.
|
||||
Tooling should not rely on the stdout of `nix-instantiate --parse`.
|
||||
|
||||
We've done our best to ensure that the new behavior is as compatible with the old one as possible.
|
||||
If you depend on the old behavior in ways that are not covered anymore or are otherwise negatively affected by this change,
|
||||
then please reach out so that we can find a sustainable solution together.
|
||||
@@ -35,7 +35,14 @@ standard input.
|
||||
|
||||
- `--parse`\
|
||||
Just parse the input files, and print their abstract syntax trees on
|
||||
standard output as a Nix expression.
|
||||
standard output. The output format of the AST depends on the current
|
||||
internal representation and may change in the future.
|
||||
|
||||
Tooling can use the stderr and exit code of `--parse` to check any
|
||||
Nix code for correctness, but should not rely on stdout without careful
|
||||
versioning. Note that `--parse` also checks for unbound variables.
|
||||
In cases where this is undesired, `with {};` can be prepended
|
||||
to the program to transform all such parse errors into eval errors.
|
||||
|
||||
- `--eval`\
|
||||
Just parse and evaluate the input files, and print the resulting
|
||||
|
||||
@@ -31,7 +31,7 @@ void processExpr(EvalState & state, const Strings & attrPaths,
|
||||
bool evalOnly, OutputKind output, bool location, Expr & e)
|
||||
{
|
||||
if (parseOnly) {
|
||||
e.show(state.ctx.symbols, std::cout);
|
||||
std::cout << e.toJSON(state.ctx.symbols).dump(2);
|
||||
std::cout << "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
+156
-153
@@ -8,6 +8,8 @@
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace nix {
|
||||
|
||||
ExprBlackHole eBlackHole;
|
||||
@@ -29,63 +31,80 @@ AttrName::AttrName(PosIdx pos, std::unique_ptr<Expr> e) : pos(pos), expr(std::mo
|
||||
{
|
||||
}
|
||||
|
||||
void Expr::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json Expr::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
void ExprInt::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprInt::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << n;
|
||||
return {
|
||||
{"_type", "ExprInt"},
|
||||
{"value", n.value}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprFloat::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprFloat::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << nf;
|
||||
return {
|
||||
{"_type", "ExprFloat"},
|
||||
{"value", nf}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprString::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprString::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
escapeString(str, s);
|
||||
return {
|
||||
{"_type", "ExprString"},
|
||||
{"value", s}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprPath::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprPath::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << s;
|
||||
return {
|
||||
{"_type", "ExprPath"},
|
||||
{"value", s}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprVar::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprVar::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << symbols[name];
|
||||
return {
|
||||
{"_type", "ExprVar"},
|
||||
{"value", symbols[name]}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprInheritFrom::show(SymbolTable const & symbols, std::ostream & str) const
|
||||
json ExprInheritFrom::toJSON(SymbolTable const & symbols) const
|
||||
{
|
||||
str << "(/* expanded inherit (expr) */ ";
|
||||
fromExpr->show(symbols, str);
|
||||
str << ")";
|
||||
return {
|
||||
{"_type", "ExprInheritFrom"}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprSelect::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprSelect::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "(";
|
||||
e->show(symbols, str);
|
||||
str << ")." << showAttrPath(symbols, attrPath);
|
||||
if (def) {
|
||||
str << " or (";
|
||||
def->show(symbols, str);
|
||||
str << ")";
|
||||
}
|
||||
json out = {
|
||||
{"_type", "ExprSelect"},
|
||||
{"e", e->toJSON(symbols)},
|
||||
{"attrs", printAttrPathToJson(symbols, attrPath)}
|
||||
};
|
||||
if (def)
|
||||
out["default"] = def->toJSON(symbols);
|
||||
return out;
|
||||
}
|
||||
|
||||
void ExprOpHasAttr::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprOpHasAttr::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "((";
|
||||
e->show(symbols, str);
|
||||
str << ") ? " << showAttrPath(symbols, attrPath) << ")";
|
||||
return {
|
||||
{"_type", "ExprOpHasAttr"},
|
||||
{"e", e->toJSON(symbols)},
|
||||
{"attrs", printAttrPathToJson(symbols, attrPath)}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprAttrs::showBindings(const SymbolTable & symbols, std::ostream & str) const
|
||||
void ExprAttrs::addBindingsToJSON(json & out, const SymbolTable & symbols) const
|
||||
{
|
||||
typedef const decltype(attrs)::value_type * Attr;
|
||||
std::vector<Attr> sorted;
|
||||
@@ -94,14 +113,14 @@ void ExprAttrs::showBindings(const SymbolTable & symbols, std::ostream & str) co
|
||||
std::string_view sa = symbols[a->first], sb = symbols[b->first];
|
||||
return sa < sb;
|
||||
});
|
||||
std::vector<Symbol> inherits;
|
||||
std::map<Displacement, std::vector<Symbol>> inheritsFrom;
|
||||
for (auto & i : sorted) {
|
||||
switch (i->second.kind) {
|
||||
case AttrDef::Kind::Plain:
|
||||
out["attrs"][symbols[i->first]] = i->second.e->toJSON(symbols);
|
||||
break;
|
||||
case AttrDef::Kind::Inherited:
|
||||
inherits.push_back(i->first);
|
||||
out["inherit"][symbols[i->first]] = i->second.e->toJSON(symbols);
|
||||
break;
|
||||
case AttrDef::Kind::InheritedFrom: {
|
||||
auto & select = dynamic_cast<ExprSelect &>(*i->second.e);
|
||||
@@ -111,167 +130,142 @@ void ExprAttrs::showBindings(const SymbolTable & symbols, std::ostream & str) co
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!inherits.empty()) {
|
||||
str << "inherit";
|
||||
for (auto sym : inherits) str << " " << symbols[sym];
|
||||
str << "; ";
|
||||
}
|
||||
|
||||
for (const auto & [from, syms] : inheritsFrom) {
|
||||
str << "inherit (";
|
||||
(*inheritFromExprs)[from]->show(symbols, str);
|
||||
str << ")";
|
||||
for (auto sym : syms) str << " " << symbols[sym];
|
||||
str << "; ";
|
||||
}
|
||||
for (auto & i : sorted) {
|
||||
if (i->second.kind == AttrDef::Kind::Plain) {
|
||||
str << symbols[i->first] << " = ";
|
||||
i->second.e->show(symbols, str);
|
||||
str << "; ";
|
||||
}
|
||||
json attrs = json::array();
|
||||
for (auto sym : syms)
|
||||
attrs.push_back(symbols[sym]);
|
||||
out["inheritFrom"].push_back({
|
||||
{"from", (*inheritFromExprs)[from]->toJSON(symbols)},
|
||||
{"attrs", attrs}
|
||||
});
|
||||
}
|
||||
|
||||
for (auto & i : dynamicAttrs) {
|
||||
str << "\"${";
|
||||
i.nameExpr->show(symbols, str);
|
||||
str << "}\" = ";
|
||||
i.valueExpr->show(symbols, str);
|
||||
str << "; ";
|
||||
out["dynamicAttrs"].push_back({
|
||||
{"name", i.nameExpr->toJSON(symbols) },
|
||||
{"value", i.valueExpr->toJSON(symbols)}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void ExprSet::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprSet::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
if (recursive) str << "rec ";
|
||||
str << "{ ";
|
||||
showBindings(symbols, str);
|
||||
str << "}";
|
||||
json out = {
|
||||
{"_type", "ExprSet"},
|
||||
{"recursive", recursive},
|
||||
};
|
||||
addBindingsToJSON(out, symbols);
|
||||
return out;
|
||||
}
|
||||
|
||||
void ExprList::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprList::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "[ ";
|
||||
for (auto & i : elems) {
|
||||
str << "(";
|
||||
i->show(symbols, str);
|
||||
str << ") ";
|
||||
}
|
||||
str << "]";
|
||||
json list = json::array();
|
||||
for (auto & i : elems)
|
||||
list.push_back(i->toJSON(symbols));
|
||||
return {
|
||||
{ "_type", "ExprList" },
|
||||
{ "elems", list },
|
||||
};
|
||||
}
|
||||
|
||||
void ExprLambda::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprLambda::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "(";
|
||||
json out = {
|
||||
{ "_type", "ExprLambda" },
|
||||
{ "body", body->toJSON(symbols) }
|
||||
};
|
||||
if (hasFormals()) {
|
||||
str << "{ ";
|
||||
bool first = true;
|
||||
// the natural Symbol ordering is by creation time, which can lead to the
|
||||
// same expression being printed in two different ways depending on its
|
||||
// context. always use lexicographic ordering to avoid this.
|
||||
for (const Formal & i : formals->lexicographicOrder(symbols)) {
|
||||
if (first) first = false; else str << ", ";
|
||||
str << symbols[i.name];
|
||||
if (i.def) {
|
||||
str << " ? ";
|
||||
i.def->show(symbols, str);
|
||||
}
|
||||
if (i.def)
|
||||
out["formals"][symbols[i.name]] = i.def->toJSON(symbols);
|
||||
else
|
||||
out["formals"][symbols[i.name]] = nullptr;
|
||||
}
|
||||
if (formals->ellipsis) {
|
||||
if (!first) str << ", ";
|
||||
str << "...";
|
||||
}
|
||||
str << " }";
|
||||
if (arg) str << " @ ";
|
||||
out["formalsEllipsis"] = formals->ellipsis;
|
||||
}
|
||||
if (arg) str << symbols[arg];
|
||||
str << ": ";
|
||||
body->show(symbols, str);
|
||||
str << ")";
|
||||
if (arg)
|
||||
out["arg"] = symbols[arg];
|
||||
return out;
|
||||
}
|
||||
|
||||
void ExprCall::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprCall::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << '(';
|
||||
fun->show(symbols, str);
|
||||
for (auto & e : args) {
|
||||
str << ' ';
|
||||
e->show(symbols, str);
|
||||
}
|
||||
str << ')';
|
||||
json outArgs = json::array();
|
||||
for (auto & e : args)
|
||||
outArgs.push_back(e->toJSON(symbols));
|
||||
return {
|
||||
{"_type", "ExprCall"},
|
||||
{"fun", fun->toJSON(symbols)},
|
||||
{"args", outArgs}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprLet::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprLet::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "(let ";
|
||||
showBindings(symbols, str);
|
||||
str << "in ";
|
||||
body->show(symbols, str);
|
||||
str << ")";
|
||||
json out = {
|
||||
{ "_type", "ExprLet" },
|
||||
{ "body", body->toJSON(symbols) }
|
||||
};
|
||||
addBindingsToJSON(out, symbols);
|
||||
return out;
|
||||
}
|
||||
|
||||
void ExprWith::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprWith::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "(with ";
|
||||
attrs->show(symbols, str);
|
||||
str << "; ";
|
||||
body->show(symbols, str);
|
||||
str << ")";
|
||||
return {
|
||||
{"_type", "ExprWith"},
|
||||
{"attrs", attrs->toJSON(symbols)},
|
||||
{"body", body->toJSON(symbols)}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprIf::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprIf::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "(if ";
|
||||
cond->show(symbols, str);
|
||||
str << " then ";
|
||||
then->show(symbols, str);
|
||||
str << " else ";
|
||||
else_->show(symbols, str);
|
||||
str << ")";
|
||||
return {
|
||||
{"_type", "ExprIf"},
|
||||
{"cond", cond->toJSON(symbols)},
|
||||
{"then", then->toJSON(symbols)},
|
||||
{"else", else_->toJSON(symbols)}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprAssert::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprAssert::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "assert ";
|
||||
cond->show(symbols, str);
|
||||
str << "; ";
|
||||
body->show(symbols, str);
|
||||
return {
|
||||
{"_type", "ExprAssert"},
|
||||
{"cond", cond->toJSON(symbols)},
|
||||
{"body", body->toJSON(symbols)}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprOpNot::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprOpNot::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "(! ";
|
||||
e->show(symbols, str);
|
||||
str << ")";
|
||||
return {
|
||||
{"_type", "ExprOpNot"},
|
||||
{"e", e->toJSON(symbols)}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprConcatStrings::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprConcatStrings::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
bool first = true;
|
||||
str << "(";
|
||||
for (auto & [_pos, part] : es) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
str << " + ";
|
||||
|
||||
if (forceString && !dynamic_cast<ExprString *>(part.get())) {
|
||||
/* Print as a string with an interpolation, to preserve the
|
||||
* semantics of the value having to be a string.
|
||||
* Interpolations are weird and someone should eventually
|
||||
* move them out into their own AST node please.
|
||||
*/
|
||||
str << "\"${";
|
||||
part->show(symbols, str);
|
||||
str << "}\"";
|
||||
} else {
|
||||
part->show(symbols, str);
|
||||
}
|
||||
}
|
||||
str << ")";
|
||||
json parts = json::array();
|
||||
for (auto & [_pos, part] : es)
|
||||
parts.push_back(part->toJSON(symbols));
|
||||
return {
|
||||
{"_type", "ExprConcatStrings"},
|
||||
{"forceString", forceString},
|
||||
{"es", parts}
|
||||
};
|
||||
}
|
||||
|
||||
void ExprPos::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
json ExprPos::toJSON(const SymbolTable & symbols) const
|
||||
{
|
||||
str << "__curPos";
|
||||
return {{ "_type", "ExprPos" }};
|
||||
}
|
||||
|
||||
|
||||
@@ -283,15 +277,24 @@ std::string showAttrPath(const SymbolTable & symbols, const AttrPath & attrPath)
|
||||
if (!first) out << '.'; else first = false;
|
||||
if (i.symbol)
|
||||
out << symbols[i.symbol];
|
||||
else {
|
||||
out << "\"${";
|
||||
i.expr->show(symbols, out);
|
||||
out << "}\"";
|
||||
}
|
||||
else
|
||||
out << "\"${...}\"";
|
||||
}
|
||||
return out.str();
|
||||
}
|
||||
|
||||
json printAttrPathToJson(const SymbolTable & symbols, const AttrPath & attrPath)
|
||||
{
|
||||
json out = json::array();
|
||||
for (auto & i : attrPath) {
|
||||
if (i.symbol)
|
||||
out.push_back(symbols[i.symbol]);
|
||||
else
|
||||
out.push_back(i.expr->toJSON(symbols));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/* Computing levels/displacements for variables. */
|
||||
|
||||
|
||||
+13
-8
@@ -13,8 +13,9 @@
|
||||
#include "lix/libexpr/pos-table.hh"
|
||||
#include "lix/libutil/strings.hh"
|
||||
|
||||
namespace nix {
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace nix {
|
||||
|
||||
struct Env;
|
||||
struct Value;
|
||||
@@ -38,6 +39,7 @@ struct AttrName
|
||||
typedef std::vector<AttrName> AttrPath;
|
||||
|
||||
std::string showAttrPath(const SymbolTable & symbols, const AttrPath & attrPath);
|
||||
nlohmann::json printAttrPathToJson(const SymbolTable & symbols, const AttrPath & attrPath);
|
||||
|
||||
|
||||
/* Abstract syntax of Nix expressions. */
|
||||
@@ -59,7 +61,7 @@ public:
|
||||
Expr & operator=(const Expr &) = delete;
|
||||
virtual ~Expr() { };
|
||||
|
||||
virtual void show(const SymbolTable & symbols, std::ostream & str) const;
|
||||
virtual nlohmann::json toJSON(const SymbolTable & symbols) const;
|
||||
virtual void bindVars(Evaluator & es, const std::shared_ptr<const StaticEnv> & env);
|
||||
virtual void eval(EvalState & state, Env & env, Value & v);
|
||||
virtual Value * maybeThunk(EvalState & state, Env & env);
|
||||
@@ -68,7 +70,7 @@ public:
|
||||
};
|
||||
|
||||
#define COMMON_METHODS \
|
||||
void show(const SymbolTable & symbols, std::ostream & str) const override; \
|
||||
nlohmann::json toJSON(const SymbolTable & symbols) const override; \
|
||||
void eval(EvalState & state, Env & env, Value & v) override; \
|
||||
void bindVars(Evaluator & es, const std::shared_ptr<const StaticEnv> & env) override;
|
||||
|
||||
@@ -163,7 +165,7 @@ struct ExprInheritFrom : ExprVar
|
||||
this->fromWith = nullptr;
|
||||
}
|
||||
|
||||
void show(SymbolTable const & symbols, std::ostream & str) const override;
|
||||
nlohmann::json toJSON(SymbolTable const & symbols) const override;
|
||||
void bindVars(Evaluator & es, const std::shared_ptr<const StaticEnv> & env) override;
|
||||
};
|
||||
|
||||
@@ -254,7 +256,7 @@ struct ExprAttrs
|
||||
std::shared_ptr<const StaticEnv> bindInheritSources(
|
||||
Evaluator & es, const std::shared_ptr<const StaticEnv> & env);
|
||||
Env * buildInheritFromEnv(EvalState & state, Env & up);
|
||||
void showBindings(const SymbolTable & symbols, std::ostream & str) const;
|
||||
void addBindingsToJSON(nlohmann::json & out, const SymbolTable & symbols) const;
|
||||
};
|
||||
|
||||
struct ExprSet : Expr, ExprAttrs {
|
||||
@@ -431,9 +433,13 @@ struct ExprOpNot : Expr
|
||||
std::unique_ptr<Expr> e1, e2; \
|
||||
name(std::unique_ptr<Expr> e1, std::unique_ptr<Expr> e2) : e1(std::move(e1)), e2(std::move(e2)) { }; \
|
||||
name(const PosIdx & pos, std::unique_ptr<Expr> e1, std::unique_ptr<Expr> e2) : pos(pos), e1(std::move(e1)), e2(std::move(e2)) { }; \
|
||||
void show(const SymbolTable & symbols, std::ostream & str) const override \
|
||||
nlohmann::json toJSON(const SymbolTable & symbols) const override \
|
||||
{ \
|
||||
str << "("; e1->show(symbols, str); str << " " s " "; e2->show(symbols, str); str << ")"; \
|
||||
return { \
|
||||
{"_type", #name}, \
|
||||
{"e1", e1->toJSON(symbols)}, \
|
||||
{"e2", e2->toJSON(symbols)} \
|
||||
};\
|
||||
} \
|
||||
void bindVars(Evaluator & es, const std::shared_ptr<const StaticEnv> & env) override \
|
||||
{ \
|
||||
@@ -473,7 +479,6 @@ struct ExprPos : Expr
|
||||
/* only used to mark thunks as black holes. */
|
||||
struct ExprBlackHole : Expr
|
||||
{
|
||||
void show(const SymbolTable & symbols, std::ostream & str) const override {}
|
||||
void eval(EvalState & state, Env & env, Value & v) override;
|
||||
void bindVars(Evaluator & es, const std::shared_ptr<const StaticEnv> & env) override {}
|
||||
};
|
||||
|
||||
@@ -648,10 +648,12 @@ struct nothing : p::nothing<Rule> {
|
||||
|
||||
template<typename Self, typename OpCtx, typename AttrPathT, typename ExprT>
|
||||
struct operator_semantics {
|
||||
public:
|
||||
struct has_attr : grammar::v1::op::has_attr {
|
||||
AttrPathT path;
|
||||
};
|
||||
|
||||
protected:
|
||||
struct OpEntry {
|
||||
OpCtx ctx;
|
||||
uint8_t prec;
|
||||
@@ -688,7 +690,7 @@ struct operator_semantics {
|
||||
|
||||
// derived class is expected to define members:
|
||||
//
|
||||
// ExprT applyOp(OpCtx & pos, auto & op, auto &... args);
|
||||
// void applyOp(OpCtx & pos, auto & op, auto &... args);
|
||||
// [[noreturn]] static void badOperator(OpCtx & pos, auto &... args);
|
||||
|
||||
void reduce(uint8_t toPrecedence, auto &... args) {
|
||||
@@ -699,12 +701,13 @@ struct operator_semantics {
|
||||
|| (kind != grammar::v1::op::kind::leftAssoc && precedence == toPrecedence))
|
||||
break;
|
||||
std::visit([&, ctx=std::move(ctx)] (auto & op) {
|
||||
exprs.push_back(static_cast<Self &>(*this).applyOp(ctx, op, args...));
|
||||
static_cast<Self &>(*this).applyOp(ctx, op, args...);
|
||||
}, op);
|
||||
ops.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
ExprT popExpr()
|
||||
{
|
||||
auto r = std::move(exprs.back());
|
||||
|
||||
@@ -141,38 +141,36 @@ struct ExprState
|
||||
return std::make_unique<ExprCall>(pos, state.mkInternalVar(pos, state.s.sub), std::move(args));
|
||||
}
|
||||
|
||||
std::pair<PosIdx, std::unique_ptr<Expr>> applyOp(PosIdx pos, auto & op, State & state) {
|
||||
void applyOp(PosIdx pos, auto & op, State & state) {
|
||||
using Op = grammar::v1::op;
|
||||
|
||||
auto not_ = [] (auto e) {
|
||||
return std::make_unique<ExprOpNot>(std::move(e));
|
||||
};
|
||||
|
||||
return {
|
||||
pos,
|
||||
(overloaded {
|
||||
[&] (Op::implies) { return applyBinary<ExprOpImpl>(pos); },
|
||||
[&] (Op::or_) { return applyBinary<ExprOpOr>(pos); },
|
||||
[&] (Op::and_) { return applyBinary<ExprOpAnd>(pos); },
|
||||
[&] (Op::equals) { return applyBinary<ExprOpEq>(pos); },
|
||||
[&] (Op::not_equals) { return applyBinary<ExprOpNEq>(pos); },
|
||||
[&] (Op::less) { return order(pos, true, state); },
|
||||
[&] (Op::greater_eq) { return not_(order(pos, true, state)); },
|
||||
[&] (Op::greater) { return order(pos, false, state); },
|
||||
[&] (Op::less_eq) { return not_(order(pos, false, state)); },
|
||||
[&] (Op::update) { return applyBinary<ExprOpUpdate>(pos); },
|
||||
[&] (Op::not_) { return applyUnary<ExprOpNot>(); },
|
||||
[&] (Op::plus) { return concatStrings(pos); },
|
||||
[&] (Op::minus) { return call(pos, state, state.s.sub); },
|
||||
[&] (Op::mul) { return call(pos, state, state.s.mul); },
|
||||
[&] (Op::div) { return call(pos, state, state.s.div); },
|
||||
[&] (Op::concat) { return applyBinary<ExprOpConcatLists>(pos); },
|
||||
[&] (has_attr & a) { return applyUnary<ExprOpHasAttr>(std::move(a.path)); },
|
||||
[&] (Op::unary_minus) { return negate(pos, state); },
|
||||
[&] (Op::pipe_right) { return pipe(pos, state, true); },
|
||||
[&] (Op::pipe_left) { return pipe(pos, state); },
|
||||
})(op)
|
||||
};
|
||||
auto expr = (overloaded {
|
||||
[&] (Op::implies) { return applyBinary<ExprOpImpl>(pos); },
|
||||
[&] (Op::or_) { return applyBinary<ExprOpOr>(pos); },
|
||||
[&] (Op::and_) { return applyBinary<ExprOpAnd>(pos); },
|
||||
[&] (Op::equals) { return applyBinary<ExprOpEq>(pos); },
|
||||
[&] (Op::not_equals) { return applyBinary<ExprOpNEq>(pos); },
|
||||
[&] (Op::less) { return order(pos, true, state); },
|
||||
[&] (Op::greater_eq) { return not_(order(pos, true, state)); },
|
||||
[&] (Op::greater) { return order(pos, false, state); },
|
||||
[&] (Op::less_eq) { return not_(order(pos, false, state)); },
|
||||
[&] (Op::update) { return applyBinary<ExprOpUpdate>(pos); },
|
||||
[&] (Op::not_) { return applyUnary<ExprOpNot>(); },
|
||||
[&] (Op::plus) { return concatStrings(pos); },
|
||||
[&] (Op::minus) { return call(pos, state, state.s.sub); },
|
||||
[&] (Op::mul) { return call(pos, state, state.s.mul); },
|
||||
[&] (Op::div) { return call(pos, state, state.s.div); },
|
||||
[&] (Op::concat) { return applyBinary<ExprOpConcatLists>(pos); },
|
||||
[&] (has_attr & a) { return applyUnary<ExprOpHasAttr>(std::move(a.path)); },
|
||||
[&] (Op::unary_minus) { return negate(pos, state); },
|
||||
[&] (Op::pipe_right) { return pipe(pos, state, true); },
|
||||
[&] (Op::pipe_left) { return pipe(pos, state); },
|
||||
})(op);
|
||||
pushExpr(pos, std::move(expr));
|
||||
}
|
||||
|
||||
// always_inline is needed, otherwise pushOp slows down considerably
|
||||
@@ -185,12 +183,19 @@ struct ExprState
|
||||
});
|
||||
}
|
||||
|
||||
template<typename Expr, typename... Args>
|
||||
Expr & pushExpr(PosIdx pos, Args && ... args)
|
||||
template<typename ExprT, typename... Args>
|
||||
inline ExprT & emplaceExpr(PosIdx pos, Args && ... args)
|
||||
{
|
||||
auto p = std::make_unique<Expr>(std::forward<Args>(args)...);
|
||||
auto p = std::make_unique<ExprT>(std::forward<Args>(args)...);
|
||||
auto & result = *p;
|
||||
exprs.emplace_back(pos, std::move(p));
|
||||
pushExpr(pos, std::move(p));
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Expr & pushExpr(PosIdx pos, std::unique_ptr<Expr> expr)
|
||||
{
|
||||
auto & result = *expr;
|
||||
exprs.emplace_back(pos, std::move(expr));
|
||||
return result;
|
||||
}
|
||||
};
|
||||
@@ -398,9 +403,9 @@ template<> struct BuildAST<grammar::v1::binding> {
|
||||
template<> struct BuildAST<grammar::v1::expr::id> {
|
||||
static void apply(const auto & in, ExprState & s, State & ps) {
|
||||
if (in.string_view() == "__curPos")
|
||||
s.pushExpr<ExprPos>(ps.at(in), ps.at(in));
|
||||
s.emplaceExpr<ExprPos>(ps.at(in), ps.at(in));
|
||||
else
|
||||
s.pushExpr<ExprVar>(ps.at(in), ps.at(in), ps.symbols.create(in.string_view()));
|
||||
s.emplaceExpr<ExprVar>(ps.at(in), ps.at(in), ps.symbols.create(in.string_view()));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -413,7 +418,7 @@ template<> struct BuildAST<grammar::v1::expr::int_> {
|
||||
.pos = ps.positions[ps.at(in)],
|
||||
});
|
||||
}
|
||||
s.pushExpr<ExprInt>(noPos, v);
|
||||
s.emplaceExpr<ExprInt>(noPos, v);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -448,7 +453,7 @@ template<> struct BuildAST<grammar::v1::expr::float_> {
|
||||
});
|
||||
}
|
||||
}();
|
||||
s.pushExpr<ExprFloat>(noPos, v);
|
||||
s.emplaceExpr<ExprFloat>(noPos, v);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -542,7 +547,7 @@ template<> struct BuildAST<grammar::v1::string::escape> {
|
||||
|
||||
template<> struct BuildAST<grammar::v1::string> : change_head<StringState> {
|
||||
static void success0(StringState & s, ExprState & e, State &) {
|
||||
e.exprs.emplace_back(noPos, s.finish());
|
||||
e.pushExpr(noPos, s.finish());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -590,7 +595,7 @@ template<> struct BuildAST<grammar::v1::ind_string::has_content> {
|
||||
|
||||
template<> struct BuildAST<grammar::v1::ind_string> : change_head<IndStringState> {
|
||||
static void success(const auto & in, IndStringState & s, ExprState & e, State & ps) {
|
||||
e.exprs.emplace_back(noPos, ps.stripIndentation(ps.at(in), std::move(s.lines)));
|
||||
e.pushExpr(noPos, ps.stripIndentation(ps.at(in), std::move(s.lines)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -663,9 +668,9 @@ template<> struct BuildAST<grammar::v1::path> : change_head<StringState> {
|
||||
check_slash<ExprPath>(ps.atEnd(in), s, ps);
|
||||
check_slash<ExprString>(ps.atEnd(in), s, ps);
|
||||
if (s.parts.size() == 1) {
|
||||
e.exprs.emplace_back(noPos, std::move(s.parts.back().second));
|
||||
e.pushExpr(noPos, std::move(s.parts.back().second));
|
||||
} else {
|
||||
e.pushExpr<ExprConcatStrings>(ps.at(in), ps.at(in), false, std::move(s.parts));
|
||||
e.emplaceExpr<ExprConcatStrings>(ps.at(in), ps.at(in), false, std::move(s.parts));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -683,7 +688,7 @@ template<> struct BuildAST<grammar::v1::expr::uri> {
|
||||
.msg = HintFmt("URL literals are deprecated, allow using them with %s", "--extra-deprecated-features url-literals"),
|
||||
.pos = ps.positions[ps.at(in)]
|
||||
});
|
||||
s.pushExpr<ExprString>(ps.at(in), in.string());
|
||||
s.emplaceExpr<ExprString>(ps.at(in), in.string());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -701,21 +706,21 @@ template<> struct BuildAST<grammar::v1::expr::ancient_let> : change_head<Binding
|
||||
|
||||
auto pos = ps.at(in);
|
||||
b.set.pos = pos;
|
||||
s.pushExpr<ExprSelect>(pos, pos, std::make_unique<ExprSet>(std::move(b.set)), pos, ps.s.body);
|
||||
s.emplaceExpr<ExprSelect>(pos, pos, std::make_unique<ExprSet>(std::move(b.set)), pos, ps.s.body);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::expr::rec_set> : change_head<BindingsStateRecSet> {
|
||||
static void success(const auto & in, BindingsStateRecSet & b, ExprState & s, State & ps) {
|
||||
b.set.pos = ps.at(in);
|
||||
s.pushExpr<ExprSet>(ps.at(in), std::move(b.set));
|
||||
s.emplaceExpr<ExprSet>(ps.at(in), std::move(b.set));
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::expr::set> : change_head<BindingsStateSet> {
|
||||
static void success(const auto & in, BindingsStateSet & b, ExprState & s, State & ps) {
|
||||
b.set.pos = ps.at(in);
|
||||
s.pushExpr<ExprSet>(ps.at(in), std::move(b.set));
|
||||
s.emplaceExpr<ExprSet>(ps.at(in), std::move(b.set));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -725,7 +730,7 @@ template<> struct BuildAST<grammar::v1::expr::list> : change_head<ListState> {
|
||||
static void success(const auto & in, ListState & ls, ExprState & s, State & ps) {
|
||||
auto e = std::make_unique<ExprList>();
|
||||
e->elems = std::move(ls);
|
||||
s.exprs.emplace_back(ps.at(in), std::move(e));
|
||||
s.pushExpr(ps.at(in), std::move(e));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -750,7 +755,7 @@ template<> struct BuildAST<grammar::v1::expr::select::head> {
|
||||
|
||||
template<> struct BuildAST<grammar::v1::expr::select::attr> : change_head<AttrState> {
|
||||
static void success0(AttrState & a, SelectState & s, State &) {
|
||||
s.e = &s->pushExpr<ExprSelect>(s.pos, s.pos, s->popExprOnly(), std::move(a.attrs), nullptr);
|
||||
s.e = &s->emplaceExpr<ExprSelect>(s.pos, s.pos, s->popExprOnly(), std::move(a.attrs), nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -764,7 +769,7 @@ template<> struct BuildAST<grammar::v1::expr::select::as_app_or> {
|
||||
static void apply(const auto & in, SelectState & s, State & ps) {
|
||||
std::vector<std::unique_ptr<Expr>> args(1);
|
||||
args[0] = std::make_unique<ExprVar>(ps.at(in), ps.s.or_);
|
||||
s->pushExpr<ExprCall>(s.pos, s.pos, s->popExprOnly(), std::move(args));
|
||||
s->emplaceExpr<ExprCall>(s.pos, s.pos, s->popExprOnly(), std::move(args));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -794,11 +799,11 @@ template<> struct BuildAST<grammar::v1::expr::app::first_arg> {
|
||||
// this can happen on occasions such as `<p> <p>` or `a or b or`,
|
||||
// neither of which are super worth optimizing.
|
||||
s.e->args.push_back(std::move(arg));
|
||||
s->exprs.emplace_back(noPos, std::move(fn));
|
||||
s->pushExpr(noPos, std::move(fn));
|
||||
} else {
|
||||
std::vector<std::unique_ptr<Expr>> args{1};
|
||||
args[0] = std::move(arg);
|
||||
s.e = &s->pushExpr<ExprCall>(s.pos, s.pos, std::move(fn), std::move(args));
|
||||
s.e = &s->emplaceExpr<ExprCall>(s.pos, s.pos, std::move(fn), std::move(args));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -834,21 +839,21 @@ template<> struct BuildAST<grammar::v1::expr::lambda> : change_head<LambdaState>
|
||||
static void success(const auto & in, LambdaState & l, ExprState & s, State & ps) {
|
||||
if (l.formals)
|
||||
l.formals = ps.validateFormals(std::move(l.formals), ps.at(in), l.arg);
|
||||
s.pushExpr<ExprLambda>(ps.at(in), ps.at(in), l.arg, std::move(l.formals), l->popExprOnly());
|
||||
s.emplaceExpr<ExprLambda>(ps.at(in), ps.at(in), l.arg, std::move(l.formals), l->popExprOnly());
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::expr::assert_> {
|
||||
static void apply(const auto & in, ExprState & s, State & ps) {
|
||||
auto body = s.popExprOnly(), cond = s.popExprOnly();
|
||||
s.pushExpr<ExprAssert>(ps.at(in), ps.at(in), std::move(cond), std::move(body));
|
||||
s.emplaceExpr<ExprAssert>(ps.at(in), ps.at(in), std::move(cond), std::move(body));
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::expr::with> {
|
||||
static void apply(const auto & in, ExprState & s, State & ps) {
|
||||
auto body = s.popExprOnly(), scope = s.popExprOnly();
|
||||
s.pushExpr<ExprWith>(ps.at(in), ps.at(in), std::move(scope), std::move(body));
|
||||
s.emplaceExpr<ExprWith>(ps.at(in), ps.at(in), std::move(scope), std::move(body));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -860,20 +865,21 @@ template<> struct BuildAST<grammar::v1::expr::let> : change_head<BindingsStateLe
|
||||
.pos = ps.positions[ps.at(in)]
|
||||
});
|
||||
b.let.body = b->popExprOnly();
|
||||
s.pushExpr<ExprLet>(ps.at(in), std::move(b.let));
|
||||
s.emplaceExpr<ExprLet>(ps.at(in), std::move(b.let));
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::expr::if_> {
|
||||
static void apply(const auto & in, ExprState & s, State & ps) {
|
||||
auto else_ = s.popExprOnly(), then = s.popExprOnly(), cond = s.popExprOnly();
|
||||
s.pushExpr<ExprIf>(ps.at(in), ps.at(in), std::move(cond), std::move(then), std::move(else_));
|
||||
s.emplaceExpr<ExprIf>(ps.at(in), ps.at(in), std::move(cond), std::move(then), std::move(else_));
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::expr> : change_head<ExprState> {
|
||||
static void success0(ExprState & inner, ExprState & outer, State & ps) {
|
||||
outer.exprs.push_back(inner.finish(ps));
|
||||
auto [pos, expr] = inner.finish(ps);
|
||||
outer.pushExpr(pos, std::move(expr));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
util-linuxMinimal ? utillinuxMinimal,
|
||||
utillinuxMinimal ? null,
|
||||
xz,
|
||||
yq,
|
||||
|
||||
busybox-sandbox-shell,
|
||||
|
||||
@@ -270,6 +271,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
git
|
||||
mercurial
|
||||
jq
|
||||
yq
|
||||
lsof
|
||||
]
|
||||
++ lib.optional hostPlatform.isLinux util-linuxMinimal
|
||||
|
||||
@@ -69,6 +69,7 @@ for i in lang/parse-okay-*.nix; do
|
||||
2> "lang/$i.err"
|
||||
then
|
||||
sed "s!$(pwd)!/pwd!g" "lang/$i.out" "lang/$i.err"
|
||||
yq --in-place --yaml-output '.' "lang/$i.out"
|
||||
diffAndAccept "$i" out exp
|
||||
diffAndAccept "$i" err err.exp
|
||||
else
|
||||
|
||||
@@ -1 +1,19 @@
|
||||
({ x, y, z }: ((x + y) + z))
|
||||
_type: ExprLambda
|
||||
body:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprVar
|
||||
value: x
|
||||
- _type: ExprVar
|
||||
value: y
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: z
|
||||
forceString: false
|
||||
formals:
|
||||
x: null
|
||||
y: null
|
||||
z: null
|
||||
formalsEllipsis: false
|
||||
|
||||
@@ -1 +1,35 @@
|
||||
(__sub (7 + (__div (__mul (__sub 0 5) 12) 3)) 1)
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprInt
|
||||
value: 7
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 0
|
||||
- _type: ExprInt
|
||||
value: 5
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __sub
|
||||
- _type: ExprInt
|
||||
value: 12
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __mul
|
||||
- _type: ExprInt
|
||||
value: 3
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __div
|
||||
forceString: false
|
||||
- _type: ExprInt
|
||||
value: 1
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __sub
|
||||
|
||||
@@ -1 +1,15 @@
|
||||
rec { foo = "multi\nline\n string\n test\r"; x = y; y = 123; z = 456; }
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
foo:
|
||||
_type: ExprString
|
||||
value: "multi\nline\n string\n test\r"
|
||||
x:
|
||||
_type: ExprVar
|
||||
value: y
|
||||
y:
|
||||
_type: ExprInt
|
||||
value: 123
|
||||
z:
|
||||
_type: ExprInt
|
||||
value: 456
|
||||
recursive: true
|
||||
|
||||
@@ -1 +1,17 @@
|
||||
{ services = { ssh = { enable = true; port = 23; }; }; }
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
services:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
ssh:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
enable:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
port:
|
||||
_type: ExprInt
|
||||
value: 23
|
||||
recursive: false
|
||||
recursive: false
|
||||
recursive: false
|
||||
|
||||
@@ -1 +1,17 @@
|
||||
{ services = { ssh = { enable = true; port = 23; }; }; }
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
services:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
ssh:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
enable:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
port:
|
||||
_type: ExprInt
|
||||
value: 23
|
||||
recursive: false
|
||||
recursive: false
|
||||
recursive: false
|
||||
|
||||
@@ -1 +1,375 @@
|
||||
(let s1 = "This is an indented multi-line string\nliteral. An amount of whitespace at\nthe start of each line matching the minimum\nindentation of all lines in the string\nliteral together will be removed. Thus,\nin this case four spaces will be\nstripped from each line, even though\n THIS LINE is indented six spaces.\n\nAlso, empty lines don't count in the\ndetermination of the indentation level (the\nprevious empty line has indentation 0, but\nit doesn't matter).\n"; s10 = ""; s11 = ""; s12 = ""; s13 = ("start on network-interfaces\n\nstart script\n\n rm -f /var/run/opengl-driver\n " + "${(if true then "ln -sf 123 /var/run/opengl-driver" else (if true then "ln -sf 456 /var/run/opengl-driver" else ""))}" + "\n\n rm -f /var/log/slim.log\n \nend script\n\nenv SLIM_CFGFILE=" + "abc" + "\nenv SLIM_THEMESDIR=" + "def" + "\nenv FONTCONFIG_FILE=/etc/fonts/fonts.conf \t\t\t\t# !!! cleanup\nenv XKB_BINDIR=" + "foo" + "/bin \t\t\t\t# Needed for the Xkb extension.\nenv LD_LIBRARY_PATH=" + "libX11" + "/lib:" + "libXext" + "/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)\n\n" + "${(if true then ("env XORG_DRI_DRIVER_PATH=" + "nvidiaDrivers" + "/X11R6/lib/modules/drivers/") else (if true then ("env XORG_DRI_DRIVER_PATH=" + "mesa" + "/lib/modules/dri") else ""))}" + " \n\nexec " + "slim" + "/bin/slim\n"); s14 = "Escaping of ' followed by ': ''\nEscaping of $ followed by {: \${\nAnd finally to interpret \\n etc. as in a string: \n, \r, \t.\n"; s15 = (let x = "bla"; in ("foo\n'" + "${x}" + "'\nbar\n")); s16 = "cut -d $'\\t' -f 1\n"; s17 = (("ending dollar $" + "$") + "\n"); s18 = " Lines without any indentation effectively disable the indentation\n stripping for the entire string:\n\n cat >$out/foo/data <<EOF\n lasjdöaxnasd\nasdom 12398\nä\"§Æẞ¢«»”alsd\nEOF\n"; s19 = "Empty lines with a bit of whitespace don't affect the indentation calculation:\n\nAnd empty lines with more whitespace will have whitespace in the string:\n \nUnless it's the last line:\n"; s2 = "If the string starts with whitespace\n followed by a newline, it's stripped, but\n that's not the case here. Two spaces are\n stripped because of the \" \" at the start. \n"; s20 = " Indentation stripping\n must not be impressed by\nthe last line not being empty"; s21 = "\t Nor by people\n weirdly mixing tabs\n\tand spaces\n\t"; s3 = "This line is indented\na bit further.\n"; s4 = ("Anti-quotations, like " + "${(if true then "so" else "not so")}" + ", are\nalso allowed.\n"); s5 = (" The \\ is not special here.\n' can be followed by any character except another ', e.g. 'x'.\nLikewise for $, e.g. $$ or $varName.\nBut ' followed by ' is special, as is $ followed by {.\nIf you want them, use anti-quotations: " + "''" + ", " + "\${" + ".\n"); s6 = " Tabs are not interpreted as whitespace (since we can't guess\n what tab settings are intended), so don't use them.\n\tThis line starts with a space and a tab, so only one\n space will be stripped from each line.\n"; s7 = "Also note that if the last line (just before the closing ' ')\nconsists only of whitespace, it's ignored. But here there is\nsome non-whitespace stuff, so the line isn't removed. "; s8 = ("" + "\nThis shows a hacky way to preserve an empty line after the start.\nBut there's no reason to do so: you could just repeat the empty\nline.\n"); s9 = ("" + " Similarly you can force an indentation level,\n in this case to 2 spaces. This works because the anti-quote\n is significant (not whitespace).\n"); in ((((((((((((((((((((s1 + s2) + s3) + s4) + s5) + s6) + s7) + s8) + s9) + s10) + s11) + s12) + s13) + s14) + s15) + s16) + s17) + s18) + s19) + s20) + s21))
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
s1:
|
||||
_type: ExprString
|
||||
value: "This is an indented multi-line string\nliteral. An amount of whitespace\
|
||||
\ at\nthe start of each line matching the minimum\nindentation of all lines\
|
||||
\ in the string\nliteral together will be removed. Thus,\nin this case four\
|
||||
\ spaces will be\nstripped from each line, even though\n THIS LINE is indented\
|
||||
\ six spaces.\n\nAlso, empty lines don't count in the\ndetermination of the\
|
||||
\ indentation level (the\nprevious empty line has indentation 0, but\nit doesn't\
|
||||
\ matter).\n"
|
||||
s10:
|
||||
_type: ExprString
|
||||
value: ''
|
||||
s11:
|
||||
_type: ExprString
|
||||
value: ''
|
||||
s12:
|
||||
_type: ExprString
|
||||
value: ''
|
||||
s13:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: "start on network-interfaces\n\nstart script\n\n rm -f /var/run/opengl-driver\n\
|
||||
\ "
|
||||
- _type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
else:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
else:
|
||||
_type: ExprString
|
||||
value: ''
|
||||
then:
|
||||
_type: ExprString
|
||||
value: ln -sf 456 /var/run/opengl-driver
|
||||
then:
|
||||
_type: ExprString
|
||||
value: ln -sf 123 /var/run/opengl-driver
|
||||
- _type: ExprString
|
||||
value: "\n\n rm -f /var/log/slim.log\n \nend script\n\nenv SLIM_CFGFILE="
|
||||
- _type: ExprString
|
||||
value: abc
|
||||
- _type: ExprString
|
||||
value: '
|
||||
|
||||
env SLIM_THEMESDIR='
|
||||
- _type: ExprString
|
||||
value: def
|
||||
- _type: ExprString
|
||||
value: "\nenv FONTCONFIG_FILE=/etc/fonts/fonts.conf \t\t\t\t# !!! cleanup\n\
|
||||
env XKB_BINDIR="
|
||||
- _type: ExprString
|
||||
value: foo
|
||||
- _type: ExprString
|
||||
value: "/bin \t\t\t\t# Needed for the Xkb extension.\nenv LD_LIBRARY_PATH="
|
||||
- _type: ExprString
|
||||
value: libX11
|
||||
- _type: ExprString
|
||||
value: '/lib:'
|
||||
- _type: ExprString
|
||||
value: libXext
|
||||
- _type: ExprString
|
||||
value: '/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load
|
||||
libglx for (AI)GLX support (for compiz)
|
||||
|
||||
|
||||
'
|
||||
- _type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
else:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
else:
|
||||
_type: ExprString
|
||||
value: ''
|
||||
then:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: env XORG_DRI_DRIVER_PATH=
|
||||
- _type: ExprString
|
||||
value: mesa
|
||||
- _type: ExprString
|
||||
value: /lib/modules/dri
|
||||
forceString: true
|
||||
then:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: env XORG_DRI_DRIVER_PATH=
|
||||
- _type: ExprString
|
||||
value: nvidiaDrivers
|
||||
- _type: ExprString
|
||||
value: /X11R6/lib/modules/drivers/
|
||||
forceString: true
|
||||
- _type: ExprString
|
||||
value: " \n\nexec "
|
||||
- _type: ExprString
|
||||
value: slim
|
||||
- _type: ExprString
|
||||
value: '/bin/slim
|
||||
|
||||
'
|
||||
forceString: true
|
||||
s14:
|
||||
_type: ExprString
|
||||
value: "Escaping of ' followed by ': ''\nEscaping of $ followed by {: ${\nAnd\
|
||||
\ finally to interpret \\n etc. as in a string: \n, \r, \t.\n"
|
||||
s15:
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
x:
|
||||
_type: ExprString
|
||||
value: bla
|
||||
body:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: 'foo
|
||||
|
||||
'''
|
||||
- _type: ExprVar
|
||||
value: x
|
||||
- _type: ExprString
|
||||
value: '''
|
||||
|
||||
bar
|
||||
|
||||
'
|
||||
forceString: true
|
||||
s16:
|
||||
_type: ExprString
|
||||
value: 'cut -d $''\t'' -f 1
|
||||
|
||||
'
|
||||
s17:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: ending dollar $
|
||||
- _type: ExprString
|
||||
value: $
|
||||
forceString: false
|
||||
- _type: ExprString
|
||||
value: '
|
||||
|
||||
'
|
||||
forceString: false
|
||||
s18:
|
||||
_type: ExprString
|
||||
value: " Lines without any indentation effectively disable the indentation\n\
|
||||
\ stripping for the entire string:\n\n cat >$out/foo/data <<EOF\n\
|
||||
\ lasjdöaxnasd\nasdom 12398\nä\"§Æẞ¢«»”alsd\nEOF\n"
|
||||
s19:
|
||||
_type: ExprString
|
||||
value: "Empty lines with a bit of whitespace don't affect the indentation calculation:\n\
|
||||
\nAnd empty lines with more whitespace will have whitespace in the string:\n\
|
||||
\ \nUnless it's the last line:\n"
|
||||
s2:
|
||||
_type: ExprString
|
||||
value: "If the string starts with whitespace\n followed by a newline, it's stripped,\
|
||||
\ but\n that's not the case here. Two spaces are\n stripped because of the\
|
||||
\ \" \" at the start. \n"
|
||||
s20:
|
||||
_type: ExprString
|
||||
value: " Indentation stripping\n must not be impressed by\nthe last line not\
|
||||
\ being empty"
|
||||
s21:
|
||||
_type: ExprString
|
||||
value: "\t Nor by people\n weirdly mixing tabs\n\tand spaces\n\t"
|
||||
s3:
|
||||
_type: ExprString
|
||||
value: 'This line is indented
|
||||
|
||||
a bit further.
|
||||
|
||||
'
|
||||
s4:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: 'Anti-quotations, like '
|
||||
- _type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
else:
|
||||
_type: ExprString
|
||||
value: not so
|
||||
then:
|
||||
_type: ExprString
|
||||
value: so
|
||||
- _type: ExprString
|
||||
value: ', are
|
||||
|
||||
also allowed.
|
||||
|
||||
'
|
||||
forceString: true
|
||||
s5:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: ' The \ is not special here.
|
||||
|
||||
'' can be followed by any character except another '', e.g. ''x''.
|
||||
|
||||
Likewise for $, e.g. $$ or $varName.
|
||||
|
||||
But '' followed by '' is special, as is $ followed by {.
|
||||
|
||||
If you want them, use anti-quotations: '
|
||||
- _type: ExprString
|
||||
value: ''''''
|
||||
- _type: ExprString
|
||||
value: ', '
|
||||
- _type: ExprString
|
||||
value: ${
|
||||
- _type: ExprString
|
||||
value: '.
|
||||
|
||||
'
|
||||
forceString: true
|
||||
s6:
|
||||
_type: ExprString
|
||||
value: " Tabs are not interpreted as whitespace (since we can't guess\n what\
|
||||
\ tab settings are intended), so don't use them.\n\tThis line starts with a\
|
||||
\ space and a tab, so only one\n space will be stripped from each line.\n"
|
||||
s7:
|
||||
_type: ExprString
|
||||
value: 'Also note that if the last line (just before the closing '' '')
|
||||
|
||||
consists only of whitespace, it''s ignored. But here there is
|
||||
|
||||
some non-whitespace stuff, so the line isn''t removed. '
|
||||
s8:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: ''
|
||||
- _type: ExprString
|
||||
value: '
|
||||
|
||||
This shows a hacky way to preserve an empty line after the start.
|
||||
|
||||
But there''s no reason to do so: you could just repeat the empty
|
||||
|
||||
line.
|
||||
|
||||
'
|
||||
forceString: true
|
||||
s9:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: ''
|
||||
- _type: ExprString
|
||||
value: " Similarly you can force an indentation level,\n in this case to\
|
||||
\ 2 spaces. This works because the anti-quote\n is significant (not whitespace).\n"
|
||||
forceString: true
|
||||
body:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprVar
|
||||
value: s1
|
||||
- _type: ExprVar
|
||||
value: s2
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s3
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s4
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s5
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s6
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s7
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s8
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s9
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s10
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s11
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s12
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s13
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s14
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s15
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s16
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s17
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s18
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s19
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s20
|
||||
forceString: false
|
||||
- _type: ExprVar
|
||||
value: s21
|
||||
forceString: false
|
||||
|
||||
@@ -1 +1,29 @@
|
||||
(let b = 2; c = { }; in { inherit b; inherit (c) d e; a = 1; f = 3; })
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
b:
|
||||
_type: ExprInt
|
||||
value: 2
|
||||
c:
|
||||
_type: ExprSet
|
||||
recursive: false
|
||||
body:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
a:
|
||||
_type: ExprInt
|
||||
value: 1
|
||||
f:
|
||||
_type: ExprInt
|
||||
value: 3
|
||||
inherit:
|
||||
b:
|
||||
_type: ExprVar
|
||||
value: b
|
||||
inheritFrom:
|
||||
- attrs:
|
||||
- d
|
||||
- e
|
||||
from:
|
||||
_type: ExprVar
|
||||
value: c
|
||||
recursive: false
|
||||
|
||||
@@ -0,0 +1,556 @@
|
||||
_type: ExprWith
|
||||
attrs:
|
||||
_type: ExprSet
|
||||
recursive: false
|
||||
body:
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprInt
|
||||
value: 0
|
||||
- _type: ExprFloat
|
||||
value: 0.0
|
||||
- _type: ExprString
|
||||
value: ''
|
||||
- _type: ExprString
|
||||
value: foo
|
||||
- _type: ExprString
|
||||
value: 'foo
|
||||
|
||||
bar'
|
||||
- _type: ExprPath
|
||||
value: /root
|
||||
- _type: ExprVar
|
||||
value: var1
|
||||
- _type: ExprSelect
|
||||
attrs:
|
||||
- bar
|
||||
default:
|
||||
_type: ExprVar
|
||||
value: baz
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: foo
|
||||
- _type: ExprOpHasAttr
|
||||
attrs:
|
||||
- bar
|
||||
- baz
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: foo
|
||||
- _type: ExprSet
|
||||
recursive: false
|
||||
- _type: ExprSet
|
||||
recursive: true
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
attr1:
|
||||
_type: ExprVar
|
||||
value: value1
|
||||
attr2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
attr3:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
nested:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
merged:
|
||||
_type: ExprInt
|
||||
value: 1
|
||||
more:
|
||||
_type: ExprInt
|
||||
value: 0
|
||||
recursive: false
|
||||
recursive: false
|
||||
fake dynamic attr:
|
||||
_type: ExprInt
|
||||
value: 42
|
||||
string attr:
|
||||
_type: ExprString
|
||||
value: string value
|
||||
dynamicAttrs:
|
||||
- name:
|
||||
_type: ExprVar
|
||||
value: dynamicAttr
|
||||
value:
|
||||
_type: ExprSet
|
||||
dynamicAttrs:
|
||||
- name:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: anotherOne
|
||||
- _type: ExprString
|
||||
value: ''
|
||||
forceString: false
|
||||
value:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
recursive: false
|
||||
inherit:
|
||||
foo:
|
||||
_type: ExprVar
|
||||
value: foo
|
||||
inheritFrom:
|
||||
- attrs:
|
||||
- baz
|
||||
from:
|
||||
_type: ExprVar
|
||||
value: bar
|
||||
- attrs:
|
||||
- thing
|
||||
from:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprList
|
||||
elems:
|
||||
- _type: ExprVar
|
||||
value: expression
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: complicated
|
||||
recursive: false
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
attr1:
|
||||
_type: ExprVar
|
||||
value: value1
|
||||
attr2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
attr3:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
nested:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
merged:
|
||||
_type: ExprInt
|
||||
value: 1
|
||||
more:
|
||||
_type: ExprInt
|
||||
value: 0
|
||||
recursive: false
|
||||
recursive: false
|
||||
fake dynamic attr:
|
||||
_type: ExprInt
|
||||
value: 42
|
||||
string attr:
|
||||
_type: ExprString
|
||||
value: string value
|
||||
dynamicAttrs:
|
||||
- name:
|
||||
_type: ExprVar
|
||||
value: dynamicAttr
|
||||
value:
|
||||
_type: ExprSet
|
||||
dynamicAttrs:
|
||||
- name:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: anotherOne
|
||||
- _type: ExprString
|
||||
value: ''
|
||||
forceString: false
|
||||
value:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
recursive: false
|
||||
inherit:
|
||||
foo:
|
||||
_type: ExprVar
|
||||
value: foo
|
||||
inheritFrom:
|
||||
- attrs:
|
||||
- baz
|
||||
from:
|
||||
_type: ExprVar
|
||||
value: bar
|
||||
- attrs:
|
||||
- thing
|
||||
from:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprList
|
||||
elems:
|
||||
- _type: ExprVar
|
||||
value: expression
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: complicated
|
||||
recursive: true
|
||||
- _type: ExprLet
|
||||
body:
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
attr1:
|
||||
_type: ExprVar
|
||||
value: value1
|
||||
attr2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
attr3:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
nested:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
merged:
|
||||
_type: ExprInt
|
||||
value: 1
|
||||
more:
|
||||
_type: ExprInt
|
||||
value: 0
|
||||
recursive: false
|
||||
recursive: false
|
||||
fake dynamic attr:
|
||||
_type: ExprInt
|
||||
value: 42
|
||||
string attr:
|
||||
_type: ExprString
|
||||
value: string value
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprList
|
||||
elems: []
|
||||
cond:
|
||||
_type: ExprLet
|
||||
body:
|
||||
_type: ExprOpEq
|
||||
e1:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprSelect
|
||||
attrs:
|
||||
- overrideStuff
|
||||
e:
|
||||
_type: ExprSet
|
||||
recursive: false
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: myFunction
|
||||
e2:
|
||||
_type: ExprFloat
|
||||
value: 4.2
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: 'false'
|
||||
inherit:
|
||||
foo:
|
||||
_type: ExprVar
|
||||
value: foo
|
||||
inheritFrom:
|
||||
- attrs:
|
||||
- baz
|
||||
from:
|
||||
_type: ExprVar
|
||||
value: bar
|
||||
- attrs:
|
||||
- thing
|
||||
from:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprList
|
||||
elems:
|
||||
- _type: ExprVar
|
||||
value: expression
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: complicated
|
||||
- _type: ExprLambda
|
||||
arg: x
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: x
|
||||
- _type: ExprLambda
|
||||
arg: x
|
||||
body:
|
||||
_type: ExprLambda
|
||||
arg: y
|
||||
body:
|
||||
_type: ExprLambda
|
||||
arg: z
|
||||
body:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: y
|
||||
- _type: ExprVar
|
||||
value: x
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: z
|
||||
- _type: ExprLambda
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
formalsEllipsis: false
|
||||
- _type: ExprLambda
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
formalsEllipsis: true
|
||||
- _type: ExprLambda
|
||||
arg: arg
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
formalsEllipsis: false
|
||||
- _type: ExprLambda
|
||||
arg: all
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: all
|
||||
formals:
|
||||
bar: null
|
||||
baz: null
|
||||
foo:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
formalsEllipsis: false
|
||||
- _type: ExprLambda
|
||||
arg: all
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: all
|
||||
formals:
|
||||
foo:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
formalsEllipsis: true
|
||||
- _type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
else:
|
||||
_type: ExprInt
|
||||
value: 1
|
||||
then:
|
||||
_type: ExprInt
|
||||
value: 0
|
||||
- _type: ExprOpNot
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprInt
|
||||
value: 7
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 0
|
||||
- _type: ExprInt
|
||||
value: 5
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __sub
|
||||
- _type: ExprInt
|
||||
value: 12
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __mul
|
||||
- _type: ExprInt
|
||||
value: 3
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __div
|
||||
forceString: false
|
||||
- _type: ExprInt
|
||||
value: 1
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __sub
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprInt
|
||||
value: 0
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 0
|
||||
- _type: ExprInt
|
||||
value: 10
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __sub
|
||||
forceString: false
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 0
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 0
|
||||
- _type: ExprInt
|
||||
value: 11
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __sub
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __sub
|
||||
forceString: false
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 0
|
||||
- _type: ExprVar
|
||||
value: x
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __sub
|
||||
forceString: false
|
||||
- _type: ExprIf
|
||||
cond:
|
||||
_type: ExprOpImpl
|
||||
e1:
|
||||
_type: ExprOpEq
|
||||
e1:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 1
|
||||
- _type: ExprInt
|
||||
value: 2
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __lessThan
|
||||
e2:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 1
|
||||
- _type: ExprInt
|
||||
value: 2
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __lessThan
|
||||
e2:
|
||||
_type: ExprOpOr
|
||||
e1:
|
||||
_type: ExprOpAnd
|
||||
e1:
|
||||
_type: ExprOpNEq
|
||||
e1:
|
||||
_type: ExprOpNot
|
||||
e:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 2
|
||||
- _type: ExprInt
|
||||
value: 1
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __lessThan
|
||||
e2:
|
||||
_type: ExprOpNot
|
||||
e:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprInt
|
||||
value: 2
|
||||
- _type: ExprInt
|
||||
value: 1
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: __lessThan
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: 'false'
|
||||
else:
|
||||
_type: ExprVar
|
||||
value: err
|
||||
then:
|
||||
_type: ExprInt
|
||||
value: 1
|
||||
- _type: ExprOpUpdate
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: foo
|
||||
e2:
|
||||
_type: ExprOpUpdate
|
||||
e1:
|
||||
_type: ExprSet
|
||||
recursive: false
|
||||
e2:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- baz
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: bar
|
||||
- _type: ExprOpConcatLists
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: foo
|
||||
e2:
|
||||
_type: ExprOpConcatLists
|
||||
e1:
|
||||
_type: ExprList
|
||||
elems: []
|
||||
e2:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: cond
|
||||
- _type: ExprVar
|
||||
value: value
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: optional
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprInt
|
||||
value: 1
|
||||
- _type: ExprInt
|
||||
value: 2
|
||||
forceString: false
|
||||
- _type: ExprInt
|
||||
value: 3
|
||||
forceString: false
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: ''
|
||||
forceString: true
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: 'Foo '
|
||||
- _type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprInt
|
||||
value: 3
|
||||
- _type: ExprString
|
||||
value: '2'
|
||||
forceString: false
|
||||
forceString: true
|
||||
- _type: ExprPos
|
||||
@@ -0,0 +1,99 @@
|
||||
# File which contains all possible syntax constructs in order to fully test the JSON output from `nix-instantiate --parse`
|
||||
|
||||
# ExprWith
|
||||
with {};
|
||||
# ExprList
|
||||
[
|
||||
# ExprInt
|
||||
0
|
||||
# ExprFloat
|
||||
0.0
|
||||
# ExprString
|
||||
""
|
||||
"foo"
|
||||
"foo\nbar"
|
||||
# ExprPath
|
||||
/root
|
||||
# ExprVar
|
||||
var1
|
||||
# ExprSelect
|
||||
foo.bar or baz
|
||||
# ExprOpHasAttr
|
||||
(foo ? bar.baz)
|
||||
# ExprSet (ExprAttrs, ExprInheritFrom, ...)
|
||||
{ }
|
||||
rec { }
|
||||
{
|
||||
attr1 = value1;
|
||||
attr2 = null;
|
||||
inherit foo;
|
||||
inherit (bar) baz;
|
||||
inherit (complicated [ expression ]) thing;
|
||||
inherit;
|
||||
"string attr" = "string value";
|
||||
${"fake dynamic attr"} = 42;
|
||||
${dynamicAttr}.${"anotherOne" + ""} = null;
|
||||
attr3.nested = { more = 0; };
|
||||
attr3.nested.merged = 1;
|
||||
}
|
||||
rec {
|
||||
attr1 = value1;
|
||||
attr2 = null;
|
||||
inherit foo;
|
||||
inherit (bar) baz;
|
||||
inherit (complicated [ expression ]) thing;
|
||||
inherit;
|
||||
"string attr" = "string value";
|
||||
${"fake dynamic attr"} = 42;
|
||||
${dynamicAttr}.${"anotherOne" + ""} = null;
|
||||
attr3.nested = { more = 0; };
|
||||
attr3.nested.merged = 1;
|
||||
}
|
||||
(
|
||||
# ExprLet
|
||||
let in
|
||||
let
|
||||
attr1 = value1;
|
||||
attr2 = null;
|
||||
inherit foo;
|
||||
inherit (bar) baz;
|
||||
inherit (complicated [ expression ]) thing;
|
||||
inherit;
|
||||
"string attr" = "string value";
|
||||
${"fake dynamic attr"} = 42;
|
||||
attr3.nested = { more = 0; };
|
||||
attr3.nested.merged = 1;
|
||||
in
|
||||
# ExprAssert
|
||||
assert false;
|
||||
assert true;
|
||||
assert let in (myFunction {}.overrideStuff) == 4.2;
|
||||
[ ]
|
||||
)
|
||||
# ExprLambda
|
||||
(x: x)
|
||||
(x: y: z: z y x)
|
||||
({}: null)
|
||||
({...}: null)
|
||||
({}@arg: null)
|
||||
({foo ? null, bar, baz}@all: all)
|
||||
(all@{foo ? null, ...}: all)
|
||||
# ExprIf
|
||||
(if null then 0 else 1)
|
||||
# ExprOpNot
|
||||
(!true)
|
||||
# ExprOpEq, ExprOpNEq, ExprOpAnd, ExprOpOr, ExprOpImpl, and general arithmetic
|
||||
(7 + (-5) * 12 / 3 - 1)
|
||||
(0 + -10 + -(-11) + -x)
|
||||
(if 2 > 1 == 1 < 2 -> 2 >= 1 != 1 <= 2 && true || false then 1 else err)
|
||||
# ExprOpUpdate
|
||||
(foo // {} // bar.baz)
|
||||
# ExprOpConcatLists
|
||||
(foo ++ [] ++ optional cond value)
|
||||
# ExprConcatStrings
|
||||
(1 + 2 + 3)
|
||||
"${""}"
|
||||
"Foo ${3 + "2"}"
|
||||
# ExprPos
|
||||
__curPos
|
||||
]
|
||||
@@ -1 +1,16 @@
|
||||
{ x = { q = 3; y = 3; z = 3; }; }
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
x:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
q:
|
||||
_type: ExprInt
|
||||
value: 3
|
||||
y:
|
||||
_type: ExprInt
|
||||
value: 3
|
||||
z:
|
||||
_type: ExprInt
|
||||
value: 3
|
||||
recursive: false
|
||||
recursive: false
|
||||
|
||||
@@ -1 +1,16 @@
|
||||
{ x = { q = 3; y = 3; z = 3; }; }
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
x:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
q:
|
||||
_type: ExprInt
|
||||
value: 3
|
||||
y:
|
||||
_type: ExprInt
|
||||
value: 3
|
||||
z:
|
||||
_type: ExprInt
|
||||
value: 3
|
||||
recursive: false
|
||||
recursive: false
|
||||
|
||||
@@ -1 +1,24 @@
|
||||
{ services = { httpd = { enable = true; }; ssh = { enable = true; port = 123; }; }; }
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
services:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
httpd:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
enable:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
recursive: false
|
||||
ssh:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
enable:
|
||||
_type: ExprVar
|
||||
value: 'true'
|
||||
port:
|
||||
_type: ExprInt
|
||||
value: 123
|
||||
recursive: false
|
||||
recursive: false
|
||||
recursive: false
|
||||
|
||||
@@ -1 +1,38 @@
|
||||
[ ({ a = rec { __overrides = { }; }; }) (rec { __overrides = { }; }) ({ __overrides = { }; }) (rec { "${("__overrides" + "")}" = { }; }) ]
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
a:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
__overrides:
|
||||
_type: ExprSet
|
||||
recursive: false
|
||||
recursive: true
|
||||
recursive: false
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
__overrides:
|
||||
_type: ExprSet
|
||||
recursive: false
|
||||
recursive: true
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
__overrides:
|
||||
_type: ExprSet
|
||||
recursive: false
|
||||
recursive: false
|
||||
- _type: ExprSet
|
||||
dynamicAttrs:
|
||||
- name:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprString
|
||||
value: __overrides
|
||||
- _type: ExprString
|
||||
value: ''
|
||||
forceString: false
|
||||
value:
|
||||
_type: ExprSet
|
||||
recursive: false
|
||||
recursive: true
|
||||
|
||||
@@ -1 +1,36 @@
|
||||
({ fetchurl, stdenv }: ((stdenv).mkDerivation { name = "libXi-6.0.1"; src = (fetchurl { md5 = "7e935a42428d63a387b3c048be0f2756"; url = "http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2"; }); }))
|
||||
_type: ExprLambda
|
||||
body:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
name:
|
||||
_type: ExprString
|
||||
value: libXi-6.0.1
|
||||
src:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
md5:
|
||||
_type: ExprString
|
||||
value: 7e935a42428d63a387b3c048be0f2756
|
||||
url:
|
||||
_type: ExprString
|
||||
value: http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2
|
||||
recursive: false
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: fetchurl
|
||||
recursive: false
|
||||
fun:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- mkDerivation
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: stdenv
|
||||
formals:
|
||||
fetchurl: null
|
||||
stdenv: null
|
||||
formalsEllipsis: false
|
||||
|
||||
@@ -1 +1,23 @@
|
||||
(let const = (a: "const"); in ("${(const { x = "q"; })}"))
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
const:
|
||||
_type: ExprLambda
|
||||
arg: a
|
||||
body:
|
||||
_type: ExprString
|
||||
value: const
|
||||
body:
|
||||
_type: ExprConcatStrings
|
||||
es:
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
x:
|
||||
_type: ExprString
|
||||
value: q
|
||||
recursive: false
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: const
|
||||
forceString: true
|
||||
|
||||
@@ -1 +1,346 @@
|
||||
({ db4 ? null, expat, fetchurl, httpServer ? false, httpd ? null, j2sdk ? null, javaSwigBindings ? false, javahlBindings ? false, localServer ? false, openssl ? null, pythonBindings ? false, sslSupport ? false, stdenv, swig ? null }: assert (expat != null); assert (localServer -> (db4 != null)); assert (httpServer -> ((httpd != null) && ((httpd).expat == expat))); assert (sslSupport -> ((openssl != null) && (httpServer -> ((httpd).openssl == openssl)))); assert (pythonBindings -> ((swig != null) && (swig).pythonSupport)); assert (javaSwigBindings -> ((swig != null) && (swig).javaSupport)); assert (javahlBindings -> (j2sdk != null)); ((stdenv).mkDerivation { inherit expat httpServer javaSwigBindings javahlBindings localServer pythonBindings sslSupport; builder = /foo/bar; db4 = (if localServer then db4 else null); httpd = (if httpServer then httpd else null); j2sdk = (if javaSwigBindings then (swig).j2sdk else (if javahlBindings then j2sdk else null)); name = "subversion-1.1.1"; openssl = (if sslSupport then openssl else null); patches = (if javahlBindings then [ (/javahl.patch) ] else [ ]); python = (if pythonBindings then (swig).python else null); src = (fetchurl { md5 = "a180c3fe91680389c210c99def54d9e0"; url = "http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2"; }); swig = (if (pythonBindings || javaSwigBindings) then swig else null); }))
|
||||
_type: ExprLambda
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprAssert
|
||||
body:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
builder:
|
||||
_type: ExprPath
|
||||
value: /foo/bar
|
||||
db4:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: localServer
|
||||
else:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
then:
|
||||
_type: ExprVar
|
||||
value: db4
|
||||
httpd:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: httpServer
|
||||
else:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
then:
|
||||
_type: ExprVar
|
||||
value: httpd
|
||||
j2sdk:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: javaSwigBindings
|
||||
else:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: javahlBindings
|
||||
else:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
then:
|
||||
_type: ExprVar
|
||||
value: j2sdk
|
||||
then:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- j2sdk
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: swig
|
||||
name:
|
||||
_type: ExprString
|
||||
value: subversion-1.1.1
|
||||
openssl:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: sslSupport
|
||||
else:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
then:
|
||||
_type: ExprVar
|
||||
value: openssl
|
||||
patches:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: javahlBindings
|
||||
else:
|
||||
_type: ExprList
|
||||
elems: []
|
||||
then:
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprPath
|
||||
value: /javahl.patch
|
||||
python:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprVar
|
||||
value: pythonBindings
|
||||
else:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
then:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- python
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: swig
|
||||
src:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprSet
|
||||
attrs:
|
||||
md5:
|
||||
_type: ExprString
|
||||
value: a180c3fe91680389c210c99def54d9e0
|
||||
url:
|
||||
_type: ExprString
|
||||
value: http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2
|
||||
recursive: false
|
||||
fun:
|
||||
_type: ExprVar
|
||||
value: fetchurl
|
||||
swig:
|
||||
_type: ExprIf
|
||||
cond:
|
||||
_type: ExprOpOr
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: pythonBindings
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: javaSwigBindings
|
||||
else:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
then:
|
||||
_type: ExprVar
|
||||
value: swig
|
||||
inherit:
|
||||
expat:
|
||||
_type: ExprVar
|
||||
value: expat
|
||||
httpServer:
|
||||
_type: ExprVar
|
||||
value: httpServer
|
||||
javaSwigBindings:
|
||||
_type: ExprVar
|
||||
value: javaSwigBindings
|
||||
javahlBindings:
|
||||
_type: ExprVar
|
||||
value: javahlBindings
|
||||
localServer:
|
||||
_type: ExprVar
|
||||
value: localServer
|
||||
pythonBindings:
|
||||
_type: ExprVar
|
||||
value: pythonBindings
|
||||
sslSupport:
|
||||
_type: ExprVar
|
||||
value: sslSupport
|
||||
recursive: false
|
||||
fun:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- mkDerivation
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: stdenv
|
||||
cond:
|
||||
_type: ExprOpImpl
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: javahlBindings
|
||||
e2:
|
||||
_type: ExprOpNEq
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: j2sdk
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
cond:
|
||||
_type: ExprOpImpl
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: javaSwigBindings
|
||||
e2:
|
||||
_type: ExprOpAnd
|
||||
e1:
|
||||
_type: ExprOpNEq
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: swig
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
e2:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- javaSupport
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: swig
|
||||
cond:
|
||||
_type: ExprOpImpl
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: pythonBindings
|
||||
e2:
|
||||
_type: ExprOpAnd
|
||||
e1:
|
||||
_type: ExprOpNEq
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: swig
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
e2:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- pythonSupport
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: swig
|
||||
cond:
|
||||
_type: ExprOpImpl
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: sslSupport
|
||||
e2:
|
||||
_type: ExprOpAnd
|
||||
e1:
|
||||
_type: ExprOpNEq
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: openssl
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
e2:
|
||||
_type: ExprOpImpl
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: httpServer
|
||||
e2:
|
||||
_type: ExprOpEq
|
||||
e1:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- openssl
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: httpd
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: openssl
|
||||
cond:
|
||||
_type: ExprOpImpl
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: httpServer
|
||||
e2:
|
||||
_type: ExprOpAnd
|
||||
e1:
|
||||
_type: ExprOpNEq
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: httpd
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
e2:
|
||||
_type: ExprOpEq
|
||||
e1:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- expat
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: httpd
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: expat
|
||||
cond:
|
||||
_type: ExprOpImpl
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: localServer
|
||||
e2:
|
||||
_type: ExprOpNEq
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: db4
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
cond:
|
||||
_type: ExprOpNEq
|
||||
e1:
|
||||
_type: ExprVar
|
||||
value: expat
|
||||
e2:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
formals:
|
||||
db4:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
expat: null
|
||||
fetchurl: null
|
||||
httpServer:
|
||||
_type: ExprVar
|
||||
value: 'false'
|
||||
httpd:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
j2sdk:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
javaSwigBindings:
|
||||
_type: ExprVar
|
||||
value: 'false'
|
||||
javahlBindings:
|
||||
_type: ExprVar
|
||||
value: 'false'
|
||||
localServer:
|
||||
_type: ExprVar
|
||||
value: 'false'
|
||||
openssl:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
pythonBindings:
|
||||
_type: ExprVar
|
||||
value: 'false'
|
||||
sslSupport:
|
||||
_type: ExprVar
|
||||
value: 'false'
|
||||
stdenv: null
|
||||
swig:
|
||||
_type: ExprVar
|
||||
value: 'null'
|
||||
formalsEllipsis: false
|
||||
|
||||
@@ -1 +1,16 @@
|
||||
[ ("x:x") ("https://svn.cs.uu.nl:12443/repos/trace/trunk") ("http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2") ("http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz") ("http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz") ("https://ftp5.gwdg.de/pub/linux/archlinux/extra/os/x86_64/unzip-6.0-14-x86_64.pkg.tar.zst") ("ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz") ]
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprString
|
||||
value: x:x
|
||||
- _type: ExprString
|
||||
value: https://svn.cs.uu.nl:12443/repos/trace/trunk
|
||||
- _type: ExprString
|
||||
value: http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
|
||||
- _type: ExprString
|
||||
value: http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz
|
||||
- _type: ExprString
|
||||
value: http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz
|
||||
- _type: ExprString
|
||||
value: https://ftp5.gwdg.de/pub/linux/archlinux/extra/os/x86_64/unzip-6.0-14-x86_64.pkg.tar.zst
|
||||
- _type: ExprString
|
||||
value: ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz
|
||||
|
||||
@@ -201,7 +201,6 @@ libexpr_tests_sources = files(
|
||||
'libexpr/primops.cc',
|
||||
'libexpr/search-path.cc',
|
||||
'libexpr/trivial.cc',
|
||||
'libexpr/expr-print.cc',
|
||||
'libexpr/value/context.cc',
|
||||
'libexpr/value/print.cc',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user