about summary refs log tree commit diff
path: root/src/libexpr/parser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/parser.cc')
-rw-r--r--src/libexpr/parser.cc17
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)