-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathin2.test.yaml
377 lines (322 loc) · 12.8 KB
/
in2.test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
empty:
template: ''
rendered: ''
compiled: ''
literal:
template: 'Hello world'
rendered: 'Hello world'
compiled: |
# literal 1:1-1:12
##################################################################################
# Hello world
# ^~~~~~~~~~^
##################################################################################
render([[Hello world]])
variable substitution:
definitions: [FOO=foo-val]
template: '@FOO@'
rendered: foo-val
compiled: |
# reference 1:2-1:5
##################################################################################
# @FOO@
# ^~^
##################################################################################
render("${FOO}")
empty at-range means empty variable substitution:
template: 'foo@ @bar'
rendered: foobar
compiled: |
# reference 1:5-1:8
##################################################################################
# foo@ @bar
# ^~^
##################################################################################
render("${}")
variable substitution in name:
definitions: [FOO_bar=foo-val, BAR=bar]
template: '@FOO_${BAR}@'
rendered: foo-val
compiled: |
# reference 1:2-1:12
##################################################################################
# @FOO_${BAR}@
# ^~~~~~~~~^
##################################################################################
render("${FOO_${BAR}}")
variable substitution error with invalid name:
template: |
@cmake_policy(SET CMP0010 NEW)@
@FOO_${BAR@
render error: |
syntax error, .* expecting }.*
literal at:
template: 'Hello @@ world'
rendered: 'Hello @ world'
compiled: |
# literal 1:1-1:7
##################################################################################
# Hello @@ world
# ^~~~~^
##################################################################################
render([[Hello ]])
# @@ -> @ 1:8-1:8
##################################################################################
# Hello @@ world
# ^
##################################################################################
render("@")
# literal 1:9-1:15
##################################################################################
# Hello @@ world
# ^~~~~^
##################################################################################
render([[ world]])
explicit render:
template: '@render("foo")'
rendered: foo
compiled: |
# commands 1:2-1:15
##################################################################################
# @render("foo")
# ^~~~~~~~~~~~^
##################################################################################
render("foo")
explicit render err:
template: '@render("foo\n"'
compiled: |
# commands 1:2-1:16
##################################################################################
# @render("foo\n"
# ^~~~~~~~~~~~~^
##################################################################################
render("foo\n"
render error: |
Parse error. Function missing ending ")". End of file reached.
explicit render with variable:
definitions: [FOO=foo-val]
template: '@render("${FOO}\n")'
compiled: |
# commands 1:2-1:20
##################################################################################
# @render("${FOO}\n")
# ^~~~~~~~~~~~~~~~~^
##################################################################################
render("${FOO}\n")
rendered: |
foo-val
if_else filter:
definitions: [TRUTHY=ON, FALSY=OFF]
template: '@TRUTHY | if_else(1 0)@@FALSY | if_else(1 0)@'
rendered: 10
compiled: |
# pipeline init 1:2-1:9
##################################################################################
# @TRUTHY | if_else(1 0)@@FALSY | if_else(1 0)@
# ^~~~~~^
##################################################################################
set(IT "${TRUTHY}")
# pipeline filter 1:11-1:23
##################################################################################
# @TRUTHY | if_else(1 0)@@FALSY | if_else(1 0)@
# ^~~~~~~~~~~^
##################################################################################
in2_pipeline_filter_if_else(1 0)
# pipeline output 1:23-1:23
##################################################################################
# @TRUTHY | if_else(1 0)@@FALSY | if_else(1 0)@
# ^
##################################################################################
render("${IT}")
# pipeline init 1:25-1:31
##################################################################################
# @TRUTHY | if_else(1 0)@@FALSY | if_else(1 0)@
# ^~~~~^
##################################################################################
set(IT "${FALSY}")
# pipeline filter 1:33-1:45
##################################################################################
# @TRUTHY | if_else(1 0)@@FALSY | if_else(1 0)@
# ^~~~~~~~~~~^
##################################################################################
in2_pipeline_filter_if_else(1 0)
# pipeline output 1:45-1:45
##################################################################################
# @TRUTHY | if_else(1 0)@@FALSY | if_else(1 0)@
# ^
##################################################################################
render("${IT}")
string_literal filter:
definitions: [ "HI=hello\nworld\\" ]
template: |
@HI | string_literal()@@HI | string_literal(RAW)@
rendered: |
"hello\nworld\\"R"(hello
world\)"
compiled: |
# pipeline init 1:2-1:5
##################################################################################
# @HI | string_literal()@@HI | string_literal(RAW)@
# ^~^
##################################################################################
set(IT "${HI}")
# pipeline filter 1:7-1:23
##################################################################################
# @HI | string_literal()@@HI | string_literal(RAW)@
# ^~~~~~~~~~~~~~~^
##################################################################################
in2_pipeline_filter_string_literal()
# pipeline output 1:23-1:23
##################################################################################
# @HI | string_literal()@@HI | string_literal(RAW)@
# ^
##################################################################################
render("${IT}")
# pipeline init 1:25-1:28
##################################################################################
# @HI | string_literal()@@HI | string_literal(RAW)@
# ^~^
##################################################################################
set(IT "${HI}")
# pipeline filter 1:30-1:49
##################################################################################
# @HI | string_literal()@@HI | string_literal(RAW)@
# ^~~~~~~~~~~~~~~~~~^
##################################################################################
in2_pipeline_filter_string_literal(RAW)
# pipeline output 1:49-1:49
##################################################################################
# @HI | string_literal()@@HI | string_literal(RAW)@
# ^
##################################################################################
render("${IT}")
string JSON filter:
definitions:
- |
OBJ={"a": {"b": [ {"d": 77} ]}}
template: |
@OBJ | string(JSON GET a b 0 d)@
@OBJ | string(JSON TYPE a b 0 d)@
@OBJ | string(JSON LENGTH a b)@
rendered: |
77
NUMBER
1
compiled: |
# pipeline init 1:2-1:6
##################################################################################
# @OBJ | string(JSON GET a b 0 d)@
# ^~~^
##################################################################################
set(IT "${OBJ}")
# pipeline filter 1:8-1:32
##################################################################################
# @OBJ | string(JSON GET a b 0 d)@
# ^~~~~~~~~~~~~~~~~~~~~~~^
##################################################################################
in2_pipeline_filter_string(JSON GET a b 0 d)
string JSON LIST filter:
definitions:
- |
ARR=[{"a": 1}, {}, {"a": 3}, "not an object"]
template: |
@ARR | string(JSON LIST [] a)@
@ARR | string(JSON LIST [] a) |foreach| if_else(${IT} two) |endforeach| join(" ")@
rendered: |
1;1-a-NOTFOUND;3;3-a-NOTFOUND
1 two 3 two
compiled: ''
string REGEX REPLACE filter:
definitions:
- HI=hello world
template: |
@HI | string(REGEX REPLACE "([a-z]+) ([a-z]+)" [[\2, \1]])@
rendered: |
world, hello
compiled: ''
string filter with empty pipeline init:
template: |
@|set("hello
world") | string_literal()@
rendered: |
"hello\n world"
compiled: |
# pipeline init 1:2-1:2
##################################################################################
# @|set("hello
# ^
##################################################################################
set(IT "${}")
# pipeline filter 1:3-2:16
##################################################################################
# @|set("hello
# ^~~~~~~~~~~
#~~~~~~~~~~~~~~~v
# world") | string_literal()@
##################################################################################
in2_pipeline_filter_set("hello
world")
# pipeline filter 2:18-2:34
##################################################################################
# world") | string_literal()@
# ^~~~~~~~~~~~~~~^
##################################################################################
in2_pipeline_filter_string_literal()
foreach filter:
definitions: [BOOLY=ON;OFF;OFF;ON]
template: '@BOOLY |foreach| if_else(1 0) |endforeach| join("-")@'
rendered: '1-0-0-1'
compiled: |
# pipeline init 1:2-1:8
##################################################################################
# @BOOLY |foreach| if_else(1 0) |endforeach| join("-")@
# ^~~~~^
##################################################################################
set(IT "${BOOLY}")
# pipeline foreach 1:9-1:16
##################################################################################
# @BOOLY |foreach| if_else(1 0) |endforeach| join("-")@
# ^~~~~~^
##################################################################################
set(foreach_IT_0)
foreach(IT ${IT})
# pipeline filter 1:18-1:31
##################################################################################
# @BOOLY |foreach| if_else(1 0) |endforeach| join("-")@
# ^~~~~~~~~~~~^
##################################################################################
in2_pipeline_filter_if_else(1 0)
# pipeline endforeach 1:32-1:42
##################################################################################
# @BOOLY |foreach| if_else(1 0) |endforeach| join("-")@
# ^~~~~~~~~^
##################################################################################
list(APPEND foreach_IT_1 "${IT}")
endforeach()
set(IT "${foreach_IT_1}")
# pipeline filter 1:44-1:53
##################################################################################
# @BOOLY |foreach| if_else(1 0) |endforeach| join("-")@
# ^~~~~~~~^
##################################################################################
in2_pipeline_filter_join("-")
# pipeline output 1:53-1:53
##################################################################################
# @BOOLY |foreach| if_else(1 0) |endforeach| join("-")@
# ^
##################################################################################
render("${IT}")
foreach filter nesting error:
definitions: [BOOLY=ON\;OFF\;OFF\;ON]
template: '@BOOLY |foreach|foreach| if_else(1 0) |endforeach| join("-")@'
render error: |
Flow control statements are not properly nested.
zipped lists pipeline filter:
definitions: [BOOLY=ON;OFF;OFF;ON, STRINGY=a;b;c]
template: |
@
foreach(b s IN ZIP_LISTS BOOLY STRINGY)
@@s | string_literal()@: @b | if_else(1 0)@, @
endforeach()
rendered: '"a": 1, "b": 0, "c": 0, "": 1, '
compiled: ''