about summary refs log tree commit diff stats
path: root/029tools.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-01 00:13:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-01 00:13:45 -0700
commit5fdd8e96adcf6f572888078caee62adbee1906a4 (patch)
tree9830b11fd18424e80b8a9bfd0bbfc50bea56bde6 /029tools.cc
parent56fe4cfb38f4dc5dceb6751ffae8ff4809893ccb (diff)
downloadmu-5fdd8e96adcf6f572888078caee62adbee1906a4.tar.gz
2225
Diffstat (limited to '029tools.cc')
-rw-r--r--029tools.cc48
1 files changed, 30 insertions, 18 deletions
diff --git a/029tools.cc b/029tools.cc
index 0011c6e0..e09b9d7a 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -10,21 +10,25 @@ recipe main [
 TRACE,
 :(before "End Primitive Recipe Numbers")
 Recipe_ordinal["trace"] = TRACE;
-:(before "End Primitive Recipe Implementations")
+:(before "End Primitive Recipe Checks")
 case TRACE: {
-  if (SIZE(current_instruction().ingredients) < 3) {
-    raise << current_recipe_name() << ": 'trace' takes three or more ingredients rather than '" << current_instruction().to_string() << "'\n" << end();
+  if (SIZE(inst.ingredients) < 3) {
+    raise << Recipe[r].name << ": 'trace' takes three or more ingredients rather than '" << inst.to_string() << "'\n" << end();
     break;
   }
-  if (!scalar(ingredients.at(0))) {
-    raise << current_recipe_name() << ": first ingredient of 'trace' should be a number (depth), but got " << current_instruction().ingredients.at(0).original_string << '\n' << end();
+  if (!is_mu_number(inst.ingredients.at(0))) {
+    raise << Recipe[r].name << ": first ingredient of 'trace' should be a number (depth), but got " << inst.ingredients.at(0).original_string << '\n' << end();
     break;
   }
-  long long int depth = ingredients.at(0).at(0);
-  if (!is_literal_string(current_instruction().ingredients.at(1))) {
-    raise << current_recipe_name() << ": second ingredient of 'trace' should be a literal string (label), but got " << current_instruction().ingredients.at(1).original_string << '\n' << end();
+  if (!is_literal_string(inst.ingredients.at(1))) {
+    raise << Recipe[r].name << ": second ingredient of 'trace' should be a literal string (label), but got " << inst.ingredients.at(1).original_string << '\n' << end();
     break;
   }
+  break;
+}
+:(before "End Primitive Recipe Implementations")
+case TRACE: {
+  long long int depth = ingredients.at(0).at(0);
   string label = current_instruction().ingredients.at(1).name;
   ostringstream out;
   for (long long int i = 2; i < SIZE(current_instruction().ingredients); ++i) {
@@ -175,20 +179,24 @@ recipe main [
 ASSERT,
 :(before "End Primitive Recipe Numbers")
 Recipe_ordinal["assert"] = ASSERT;
-:(before "End Primitive Recipe Implementations")
+:(before "End Primitive Recipe Checks")
 case ASSERT: {
-  if (SIZE(ingredients) != 2) {
-    raise << current_recipe_name() << ": 'assert' takes exactly two ingredients rather than '" << current_instruction().to_string() << "'\n" << end();
+  if (SIZE(inst.ingredients) != 2) {
+    raise << Recipe[r].name << ": 'assert' takes exactly two ingredients rather than '" << inst.to_string() << "'\n" << end();
     break;
   }
-  if (!scalar(ingredients.at(0))) {
-    raise << current_recipe_name() << ": 'assert' requires a boolean for its first ingredient, but got " << current_instruction().ingredients.at(0).original_string << '\n' << end();
+  if (!is_mu_scalar(inst.ingredients.at(0))) {
+    raise << Recipe[r].name << ": 'assert' requires a boolean for its first ingredient, but got " << inst.ingredients.at(0).original_string << '\n' << end();
     break;
   }
-  if (!scalar(ingredients.at(1))) {
-    raise << current_recipe_name() << ": 'assert' requires a literal string for its second ingredient, but got " << current_instruction().ingredients.at(1).original_string << '\n' << end();
+  if (!is_literal_string(inst.ingredients.at(1))) {
+    raise << Recipe[r].name << ": 'assert' requires a literal string for its second ingredient, but got " << inst.ingredients.at(1).original_string << '\n' << end();
     break;
   }
+  break;
+}
+:(before "End Primitive Recipe Implementations")
+case ASSERT: {
   if (!ingredients.at(0).at(0)) {
     raise << current_instruction().ingredients.at(1).name << '\n' << end();
   }
@@ -236,12 +244,16 @@ case _EXIT: {
 _SYSTEM,
 :(before "End Primitive Recipe Numbers")
 Recipe_ordinal["$system"] = _SYSTEM;
-:(before "End Primitive Recipe Implementations")
+:(before "End Primitive Recipe Checks")
 case _SYSTEM: {
-  if (current_instruction().ingredients.empty()) {
-    raise << current_recipe_name() << ": '$system' requires exactly one ingredient, but got none\n" << end();
+  if (inst.ingredients.empty()) {
+    raise << Recipe[r].name << ": '$system' requires exactly one ingredient, but got none\n" << end();
     break;
   }
+  break;
+}
+:(before "End Primitive Recipe Implementations")
+case _SYSTEM: {
   int status = system(current_instruction().ingredients.at(0).name.c_str());
   products.resize(1);
   products.at(0).push_back(status);
1589558f'>^
3a538211 ^


3c67fedb ^
9edabeaa ^



795f5244 ^
166e3c0d ^



9edabeaa ^


b24eb476 ^
9edabeaa ^

e00d4854 ^
9edabeaa ^



1ead3562 ^
9edabeaa ^




1ead3562 ^
086acf39 ^
9edabeaa ^



1ead3562 ^
9edabeaa ^
086acf39 ^
9edabeaa ^





086acf39 ^
43b866d1 ^
9edabeaa ^
bb7142db ^
4082acd2 ^
9edabeaa ^


3a538211 ^
5f98a10c ^
3a538211 ^
795f5244 ^
166e3c0d ^
5f98a10c ^
166e3c0d ^

3a538211 ^
5f98a10c ^

3a538211 ^



5f98a10c ^
3a538211 ^
795f5244 ^
166e3c0d ^
5f98a10c ^
166e3c0d ^

3a538211 ^
5f98a10c ^

3a538211 ^



e00d4854 ^
3a538211 ^
795f5244 ^
166e3c0d ^
e00d4854 ^
166e3c0d ^

3a538211 ^
e00d4854 ^
3a538211 ^
e00d4854 ^
3a538211 ^






795f5244 ^
166e3c0d ^



3a538211 ^













795f5244 ^
166e3c0d ^



3a538211 ^

77cdc6d0 ^
3a538211 ^


61286c8d ^


795f5244 ^
61286c8d ^













3a538211 ^


5f98a10c ^
1ead3562 ^
bc643692 ^
3a538211 ^
5f98a10c ^
3a538211 ^



795f5244 ^
5fdd8e96 ^
3a538211 ^
5fdd8e96 ^
acc4792d ^
3a538211 ^

5fdd8e96 ^
1b76245c ^
3a538211 ^

5fdd8e96 ^
1b76245c ^
3a538211 ^

5fdd8e96 ^



3a538211 ^
1b76245c ^
3a538211 ^








795f5244 ^
166e3c0d ^



3a538211 ^

b24eb476 ^
3a538211 ^
cdd6fd09 ^
3a538211 ^





b24eb476 ^
cdd6fd09 ^
3a538211 ^
4082acd2 ^
3a538211 ^


c55e49b6 ^
3a538211 ^





795f5244 ^
166e3c0d ^



3a538211 ^








795f5244 ^
5fdd8e96 ^
3a538211 ^
5f98a10c ^
1b76245c ^
3a538211 ^

5fdd8e96 ^



aa088845 ^
cfb142b9 ^
3a538211 ^



3a538211 ^


795f5244 ^
166e3c0d ^



3a538211 ^




601ff75b ^



















b24eb476 ^
601ff75b ^

07a64183 ^
601ff75b ^

0ce24b26 ^

















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