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
---
source: brush-parser/src/parser/tests/mod.rs
expression: "ParseResult { input, result: &result }"
---
ParseResult(
input: "\n\n#!/usr/bin/env bash\n\nfor f in A B C; do\n\n # sdfsdf\n echo \"${f@L}\" >&2\n\n done\n\n",
result: Program(
complete_commands: [
CompoundList([
CompoundListItem(AndOrList(
first: Pipeline(
seq: [
Compound(ForClause(ForClauseCommand(
variable_name: "f",
values: Some([
Word(
value: "A",
loc: Some(SourceSpan(
start: SourcePosition(
index: 32,
line: 5,
column: 10,
),
end: SourcePosition(
index: 33,
line: 5,
column: 11,
),
)),
),
Word(
value: "B",
loc: Some(SourceSpan(
start: SourcePosition(
index: 34,
line: 5,
column: 12,
),
end: SourcePosition(
index: 35,
line: 5,
column: 13,
),
)),
),
Word(
value: "C",
loc: Some(SourceSpan(
start: SourcePosition(
index: 36,
line: 5,
column: 14,
),
end: SourcePosition(
index: 37,
line: 5,
column: 15,
),
)),
),
]),
body: DoGroupCommand(
list: CompoundList([
CompoundListItem(AndOrList(
first: Pipeline(
seq: [
Simple(SimpleCommand(
word_or_name: Some(Word(
value: "echo",
loc: Some(SourceSpan(
start: SourcePosition(
index: 60,
line: 8,
column: 5,
),
end: SourcePosition(
index: 64,
line: 8,
column: 9,
),
)),
)),
suffix: Some(CommandSuffix([
Word(Word(
value: "\"${f@L}\"",
loc: Some(SourceSpan(
start: SourcePosition(
index: 65,
line: 8,
column: 10,
),
end: SourcePosition(
index: 73,
line: 8,
column: 18,
),
)),
)),
IoRedirect(File(None, DuplicateOutput, Duplicate(Word(
value: "2",
loc: Some(SourceSpan(
start: SourcePosition(
index: 76,
line: 8,
column: 21,
),
end: SourcePosition(
index: 77,
line: 8,
column: 22,
),
)),
)))),
])),
)),
],
),
), Sequence),
]),
loc: SourceSpan(
start: SourcePosition(
index: 39,
line: 5,
column: 17,
),
end: SourcePosition(
index: 86,
line: 10,
column: 8,
),
),
),
loc: SourceSpan(
start: SourcePosition(
index: 23,
line: 5,
column: 1,
),
end: SourcePosition(
index: 86,
line: 10,
column: 8,
),
),
)), None),
],
),
), Sequence),
]),
],
),
)