* Support grouping of attributes into sections by using "###"
comments. svn path=/nixpkgs/trunk/; revision=6493
This commit is contained in:
parent
811910342a
commit
4b249f3b6f
@ -27,6 +27,16 @@ strategies
|
|||||||
|
|
||||||
rules
|
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:
|
sort-attrs:
|
||||||
appl(p@prod(_, _, attrs([term(cons("Attrs"))])),
|
appl(p@prod(_, _, attrs([term(cons("Attrs"))])),
|
||||||
[ lit("{")
|
[ lit("{")
|
||||||
@ -36,16 +46,26 @@ rules
|
|||||||
, lit("}")
|
, lit("}")
|
||||||
]
|
]
|
||||||
) ->
|
) ->
|
||||||
appl(p, [lit("{"), <no-wsp>, appl(p2, attrs'), ws2, lit("}")])
|
appl(p, [lit("{"), <no-wsp>, appl(p2, <concat> attrs'), ws2, lit("}")])
|
||||||
where
|
where
|
||||||
<debug> "found it";
|
<debug> "found it";
|
||||||
<group> [ws1 | attrs] => groups;
|
<attach-wsp> [ws1 | attrs] => withWSP;
|
||||||
<qsort(compare-attrs)> groups => attrs';
|
<list-sep(starts-section)> withWSP => groups;
|
||||||
|
<length; debug> groups;
|
||||||
|
<map( \[x | xs] -> [x | <qsort(compare-attrs)> xs]\ )> groups => attrs';
|
||||||
<debug> "did it"
|
<debug> "did it"
|
||||||
|
|
||||||
|
|
||||||
group: [a, b | cs] -> [(a, b) | <group> cs]
|
attach-wsp: [a, b | cs] -> [(a, b) | <attach-wsp> cs]
|
||||||
group: [] -> []
|
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:
|
compare-attrs:
|
||||||
@ -55,9 +75,6 @@ rules
|
|||||||
)
|
)
|
||||||
-> x
|
-> x
|
||||||
where
|
where
|
||||||
<debug> "foo";
|
|
||||||
<debug> id1;
|
|
||||||
<debug> id2;
|
|
||||||
<string-lt> (id1, id2)
|
<string-lt> (id1, id2)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user