summary refs log tree commit diff
path: root/maintainers
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2006-09-11 16:18:07 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2006-09-11 16:18:07 +0000
commit4b249f3b6f1beaa2300d9ee2afc8ca2468acc55b (patch)
tree82da088c4c6f149d13cfa98f6af3a4d184a10a3d /maintainers
parent811910342a1a58ee36a89a8facf534efb9cdb1f1 (diff)
downloadnixpkgs-4b249f3b6f1beaa2300d9ee2afc8ca2468acc55b.tar
nixpkgs-4b249f3b6f1beaa2300d9ee2afc8ca2468acc55b.tar.gz
nixpkgs-4b249f3b6f1beaa2300d9ee2afc8ca2468acc55b.tar.bz2
nixpkgs-4b249f3b6f1beaa2300d9ee2afc8ca2468acc55b.tar.lz
nixpkgs-4b249f3b6f1beaa2300d9ee2afc8ca2468acc55b.tar.xz
nixpkgs-4b249f3b6f1beaa2300d9ee2afc8ca2468acc55b.tar.zst
nixpkgs-4b249f3b6f1beaa2300d9ee2afc8ca2468acc55b.zip
* Support grouping of attributes into sections by using "###"
  comments.

svn path=/nixpkgs/trunk/; revision=6493
Diffstat (limited to 'maintainers')
-rw-r--r--maintainers/scripts/sort-attrs.str37
1 files changed, 27 insertions, 10 deletions
diff --git a/maintainers/scripts/sort-attrs.str b/maintainers/scripts/sort-attrs.str
index 611521b0b4a..621b67ec16f 100644
--- a/maintainers/scripts/sort-attrs.str
+++ b/maintainers/scripts/sort-attrs.str
@@ -24,9 +24,19 @@ strategies
 
   no-wsp = !appl(prod([], cf(opt(layout())), no-attrs()), [])
 
-  
+
 rules
 
+  list-sep(s): [] -> []
+  list-sep(s): [x | xs] -> [[x | before] | <list-sep(s)> [split | after]]
+    where
+      <split-fetch-keep(s)> xs => (before, split, after)
+  list-sep(s): [x | xs] -> [[x | xs]]
+    where
+      <not(split-fetch-keep(s))> xs
+
+  
+
   sort-attrs:
     appl(p@prod(_, _, attrs([term(cons("Attrs"))])),
       [ lit("{")
@@ -36,18 +46,28 @@ rules
       , lit("}")
       ]
     ) ->
-    appl(p, [lit("{"), <no-wsp>, appl(p2, attrs'), ws2, lit("}")])
+    appl(p, [lit("{"), <no-wsp>, appl(p2, <concat> attrs'), ws2, lit("}")])
     where
       <debug> "found it";
-      <group> [ws1 | attrs] => groups;
-      <qsort(compare-attrs)> groups => attrs';
+      <attach-wsp> [ws1 | attrs] => withWSP;
+      <list-sep(starts-section)> withWSP => groups;
+      <length; debug> groups;
+      <map( \[x | xs] -> [x | <qsort(compare-attrs)> xs]\ )> groups => attrs';
       <debug> "did it"
 
 
-  group: [a, b | cs] -> [(a, b) | <group> cs]
-  group: [] -> []
+  attach-wsp: [a, b | cs] -> [(a, b) | <attach-wsp> cs]
+  attach-wsp: [] -> []
+
+
+  starts-section: x@(appl(prod([cf(layout())], cf(opt(layout())), no-attrs()), cs), attr) -> x
+    where <debug; starts-section'> cs
+
+  starts-section': [35, 35, 35 | cs] -> 1
+  starts-section': [c | cs] -> <starts-section'> cs
+    where <not(?35)> c
+
 
-  
   compare-attrs:
     x@
     ( (_, appl(p1@prod(_, _, attrs([term(cons("Bind"))])), [id1 | xs1]))
@@ -55,9 +75,6 @@ rules
     )
     -> x
     where
-      <debug> "foo";
-      <debug> id1;
-      <debug> id2;
       <string-lt> (id1, id2)