summaryrefslogtreecommitdiff
path: root/CC/auto/EXPRESSIONS
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-09-19 18:33:11 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-10-10 17:28:26 +0200
commit874a53375042792720ad426686b25512c29aa6ba (patch)
treedda104e3558017adf6bc806fda3619d308106598 /CC/auto/EXPRESSIONS
parent6f404766c89fb48c4fc871d2ccb273bc5d5b2e5e (diff)
downloadrules-cc-874a53375042792720ad426686b25512c29aa6ba.tar.gz
rules: New rule for config header generation
Diffstat (limited to 'CC/auto/EXPRESSIONS')
-rw-r--r--CC/auto/EXPRESSIONS32
1 files changed, 32 insertions, 0 deletions
diff --git a/CC/auto/EXPRESSIONS b/CC/auto/EXPRESSIONS
new file mode 100644
index 0000000..ac19f7a
--- /dev/null
+++ b/CC/auto/EXPRESSIONS
@@ -0,0 +1,32 @@
+{ "last_list_entry":
+ { "vars": ["list"]
+ , "expression":
+ { "type": "foldl"
+ , "range": {"type": "var", "name": "list"}
+ , "start": null
+ , "body": {"type": "var", "name": "_"}
+ }
+ }
+, "first_list_entry":
+ { "vars": ["list"]
+ , "imports": {"last": "last_list_entry"}
+ , "expression":
+ { "type": "let*"
+ , "bindings":
+ [ [ "list"
+ , { "type": "foldl"
+ , "range": {"type": "var", "name": "list", "default": []}
+ , "start": null
+ , "body":
+ { "type": "if"
+ , "cond": {"type": "var", "name": "$1"}
+ , "then": {"type": "var", "name": "$1"}
+ , "else": [{"type": "var", "name": "_"}]
+ }
+ }
+ ]
+ ]
+ , "body": {"type": "CALL_EXPRESSION", "name": "last"}
+ }
+ }
+}