diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-10-26T22·54+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-10-26T22·54+0000 |
commit | 5fe9222b36ad49d74c84edb04d6bc4a7d844be01 (patch) | |
tree | e46926a3d60274e5b2dc9e6090df2804986292b0 /src/libexpr/parser.cc | |
parent | eb8284ddaa66448d369647f68cb9f89b93a187de (diff) |
* Don't use ATmake / ATmatch anymore, nor the ATMatcher class.
Instead we generate data bindings (build and match functions) for the constructors specified in `constructors.def'. In particular this removes the conversions between AFuns and strings, and Nix expression evaluation now seems 3 to 4 times faster.
Diffstat (limited to 'src/libexpr/parser.cc')
-rw-r--r-- | src/libexpr/parser.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/libexpr/parser.cc b/src/libexpr/parser.cc index 763faacf7be3..a0a6c01df762 100644 --- a/src/libexpr/parser.cc +++ b/src/libexpr/parser.cc @@ -7,6 +7,7 @@ #include "aterm.hh" #include "parser.hh" +#include "constructors.hh" struct ParseData @@ -45,28 +46,24 @@ void parseError(ParseData * data, char * error, int line, int column) ATerm fixAttrs(int recursive, ATermList as) { - ATMatcher m; ATermList bs = ATempty, cs = ATempty; ATermList * is = recursive ? &cs : &bs; for (ATermIterator i(as); i; ++i) { ATermList names; Expr src; ATerm pos; - if (atMatch(m, *i) >> "Inherit" >> src >> names >> pos) { - bool fromScope = atMatch(m, src) >> "Scope"; + if (matchInherit(*i, src, names, pos)) { + bool fromScope = matchScope(src); for (ATermIterator j(names); j; ++j) { - Expr rhs = fromScope - ? ATmake("Var(<term>)", *j) - : ATmake("Select(<term>, <term>)", src, *j); - *is = ATinsert(*is, ATmake("Bind(<term>, <term>, <term>)", - *j, rhs, pos)); + Expr rhs = fromScope ? makeVar(*j) : makeSelect(src, *j); + *is = ATinsert(*is, makeBind(*j, rhs, pos)); } } else bs = ATinsert(bs, *i); } if (recursive) - return ATmake("Rec(<term>, <term>)", bs, cs); + return makeRec(bs, cs); else - return ATmake("Attrs(<term>)", bs); + return makeAttrs(bs); } const char * getPath(ParseData * data) |