diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-26 10:00:31 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-26 16:59:52 +0200 |
commit | d3268a5bf2e89ed32515933d0aa09c16f35e3b1d (patch) | |
tree | 1e4a1429cbd412f1b7321e10e2760bb2e757df4a /doc/concepts | |
parent | 1bf8196856c631640659e0a70d900ed7950a5e30 (diff) | |
download | justbuild-d3268a5bf2e89ed32515933d0aa09c16f35e3b1d.tar.gz |
Add quasiquote expression
Diffstat (limited to 'doc/concepts')
-rw-r--r-- | doc/concepts/expressions.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/concepts/expressions.md b/doc/concepts/expressions.md index c5d120e4..aaea3d27 100644 --- a/doc/concepts/expressions.md +++ b/doc/concepts/expressions.md @@ -79,6 +79,27 @@ evaluation. The value is the value of the key `"$1"` uninterpreted, if present, and `null` otherwise. +##### Quasi-Quoting: ``"`"`` + +The value is the value of the key `"$1"` uninterpreted but replacing +all outermost maps having a key `"type"` with the value either +`","` or `",@"` in the following way. + - If the value for the key `"type"` is `","`, the value for the + key `"$1"` (or `null` if there is no key `"$1"`) is evaluated + and the map is replaced by the value of that evaluation. + - If the value for the key `"type"` is `",@"` it is an error if + that map is not an entry of a literal list. The value for the + key `"$1"` (or `[]` if there is no key `"$1"`) is evaluated; + the result of that evaluation has to be a list. The entries of + that list (i.e., the list obtained by evaluating the value for + `"$1"`) are inserted (not the list itself) into the surrounding + list replacing that map. +For example, ``{"type": "`", "$1": [1, 2, {"type": ",@", "$1": [3, 4]}]}`` +evaluates to `[1, 2, 3, 4]` while +``{"type": "`", "$1": [1, 2, {"type": ",", "$1": [3, 4]}]}`` +evaluates to `[1, 2, [3, 4]]`. + + ##### Sequential binding: `"let*"` The key `"bindings"` (default `[]`) has to be (syntactically) a |