OILS / spec / testdata / config / osh-hay.osh View on Github | oilshell.org

34 lines, 19 significant
1shopt --set oil:upgrade
2
3hay define Foo/TASK
4
5
6Foo {
7 a = 'x'
8
9 # aliases not allowed oil:upgrade
10 # alias ll='ls -l'
11 # ll _test
12
13 # Dynamic parsing allowed in OSH, not Oil
14 b[1]=1
15
16 echo `echo backticks`
17 eval 'echo eval'
18
19 # At parse time, all the lines must be contiguous
20
21 TASK {
22 echo `echo task backticks`
23 eval 'echo task eval'
24 }
25}
26
27const children = _hay()->children[0]->children
28
29for child in (children) {
30 echo "TYPE $[child->type]"
31 if (child->type === 'TASK') {
32 echo "CODE $[child->code_str]___"
33 }
34}