-
Notifications
You must be signed in to change notification settings - Fork 1
/
bash.rb
757 lines (655 loc) · 19 KB
/
bash.rb
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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.14
# from Racc grammer file "".
#
require 'racc/parser.rb'
# $Id$
require './bashlex'
class Bash < Racc::Parser
def load(str)
q = []
lex = Lexer.new(str)
lex.run { |qe| q << qe }
setq q
end
def setq(qs)
@q = qs
self
end
def squote(s)
s[1 ... -1]
end
def next_token
n = @q.shift
n
end
def dolist(kind, car, cdr)
if cdr.is_a?(Hash) and cdr[:type] == kind
{type: kind, values: [car, *cdr[:values]].compact}
elsif car.is_a?(Hash) and car[:type] == kind
# raise RuntimeError, "wtf: #{car.inspect} : #{cdr.inspect}"
{type: kind, values: [*car[:values], cdr]}
else
{type: kind, values: [car, cdr].compact}
end
end
def parse(str)
load(str)
do_parse
end
def next
while true
break if @q[0].nil?
break if @q[0][0] == :EOF
do_parse
break if @result.nil?
yield @result unless @result == "\n"
end
raise StopIteration
end
def each(*a,&b)
if b
begin
self.next { |u| b.call(u) } while true
rescue StopIteration
end
else
units = []
begin
self.next { |u| units << u } while true
rescue StopIteration
end
units.each(*a,&b)
end
end
##### State transition tables begin ###
racc_action_table = [
-26, 13, 65, -26, -26, 65, 22, -26, 42, 25,
65, 46, 121, 36, 90, 8, 18, 24, 19, 49,
35, 34, 20, 30, 31, -26, 13, 21, -26, -26,
38, 64, -26, 41, 40, 65, 69, 39, 73, 74,
8, 18, 38, 19, 71, 41, 40, 20, 72, 39,
-26, 13, 21, -26, -26, 26, 27, -26, 28, 29,
65, 13, 4, 73, 74, 8, 18, 80, 19, 84,
3, 64, 20, 30, 31, 8, 18, 21, 19, 110,
13, 36, 20, 99, 100, 102, 116, 21, 35, 34,
13, -7, 30, 31, 8, 18, 117, 19, 13, -7,
126, 20, 124, 102, 8, 18, 21, 19, 13, -8,
nil, 20, 8, 18, nil, 19, 21, -8, 13, 20,
nil, nil, 8, 18, 21, 19, nil, 65, 13, 20,
nil, nil, 8, 18, 21, 19, nil, 65, 13, 20,
nil, 13, 8, 18, 21, 19, nil, 65, 13, 20,
65, nil, 8, 18, 21, 19, 18, 65, 19, 20,
nil, 13, 20, 18, 21, 19, nil, 21, nil, 20,
nil, 13, nil, nil, 21, 8, 18, nil, 19, nil,
65, 13, 20, nil, nil, 8, 18, 21, 19, nil,
65, 13, 20, nil, nil, 8, 18, 21, 19, nil,
65, 13, 20, nil, nil, 8, 18, 21, 19, nil,
65, 13, 20, nil, nil, 8, 18, 21, 19, nil,
65, nil, 20, nil, nil, 8, 18, 21, 19, nil,
nil, 38, 20, nil, 41, 40, -27, 21, 39, -27,
-27, 38, nil, -27, 41, 40, 61, 61, 39, 60,
60, 61, 62, 62, 60, 61, nil, 62, 60, nil,
nil, 62, 86, 87, 85, 88, 89, 112, 113, 114,
112, 113, 114 ]
racc_action_check = [
93, 93, 115, 93, 93, 70, 1, 93, 13, 2,
93, 19, 115, 98, 70, 93, 93, 2, 93, 22,
98, 98, 93, 7, 7, 94, 94, 93, 94, 94,
12, 42, 94, 12, 12, 94, 44, 12, 75, 75,
94, 94, 37, 94, 47, 37, 37, 94, 48, 37,
95, 95, 94, 95, 95, 5, 5, 95, 5, 5,
95, 0, 0, 76, 76, 95, 95, 59, 95, 64,
0, 84, 95, 77, 77, 0, 0, 95, 0, 101,
8, 8, 0, 91, 91, 91, 109, 0, 8, 8,
26, 26, 78, 78, 8, 8, 111, 8, 73, 26,
123, 8, 122, 122, 26, 26, 8, 26, 27, 27,
nil, 26, 73, 73, nil, 73, 26, 27, 43, 73,
nil, nil, 27, 27, 73, 27, nil, 43, 52, 27,
nil, nil, 43, 43, 27, 43, nil, 52, 53, 43,
nil, 54, 52, 52, 43, 52, nil, 53, 55, 52,
54, nil, 53, 53, 52, 53, 54, 55, 54, 53,
nil, 74, 54, 55, 53, 55, nil, 54, nil, 55,
nil, 96, nil, nil, 55, 74, 74, nil, 74, nil,
96, 97, 74, nil, nil, 96, 96, 74, 96, nil,
97, 118, 96, nil, nil, 97, 97, 96, 97, nil,
118, 119, 97, nil, nil, 118, 118, 97, 118, nil,
119, 120, 118, nil, nil, 119, 119, 118, 119, nil,
120, nil, 119, nil, nil, 120, 120, 119, 120, nil,
nil, 58, 120, nil, 58, 58, 63, 120, 58, 63,
63, 90, nil, 63, 90, 90, 40, 60, 90, 40,
60, 61, 40, 60, 61, 62, nil, 61, 62, nil,
nil, 62, 66, 66, 66, 66, 66, 106, 106, 106,
107, 107, 107 ]
racc_action_pointer = [
58, 6, 5, nil, nil, 45, nil, 8, 77, nil,
nil, nil, 28, 6, nil, nil, nil, nil, nil, 9,
nil, nil, 19, nil, nil, nil, 87, 105, nil, nil,
nil, nil, nil, nil, nil, nil, nil, 40, nil, nil,
244, nil, 28, 115, 17, nil, nil, 19, 18, nil,
nil, nil, 125, 135, 138, 145, nil, nil, 229, 60,
245, 249, 253, 234, 67, nil, 252, nil, nil, nil,
-7, nil, nil, 95, 158, 28, 53, 58, 77, nil,
nil, nil, nil, nil, 68, nil, nil, nil, nil, nil,
239, 57, nil, -2, 23, 48, 168, 178, 9, nil,
nil, 53, nil, nil, nil, nil, 257, 260, nil, 60,
nil, 71, nil, nil, nil, -10, nil, nil, 188, 198,
208, nil, 75, 77, nil, nil, nil, nil ]
racc_action_default = [
-26, -67, -67, -2, -3, -6, -13, -14, -26, -19,
-22, -23, -67, -67, -41, -42, -43, -44, -20, -67,
-20, -20, -67, -1, -4, -5, -26, -26, -20, -20,
-20, -20, -15, -16, -38, -39, -40, -36, -28, -29,
-32, -31, -26, -26, -67, -55, -20, -67, -67, 128,
-11, -12, -26, -26, -26, -26, -24, -37, -36, -67,
-32, -32, -32, -25, -67, -21, -56, -57, -66, -46,
-67, -20, -54, -26, -26, -9, -10, -17, -18, -45,
-30, -33, -34, -35, -26, -20, -20, -20, -20, -20,
-67, -67, -27, -58, -59, -60, -26, -26, -67, -48,
-20, -67, -20, -65, -63, -64, -61, -62, -20, -67,
-50, -67, -20, -20, -20, -67, -49, -20, -26, -26,
-26, -20, -51, -67, -20, -53, -47, -52 ]
racc_goto_table = [
44, 33, 47, 48, 66, 63, 101, 5, 52, 53,
54, 55, 56, 77, 78, 1, 2, 23, 59, 37,
98, 67, 6, nil, nil, nil, 70, nil, nil, nil,
32, nil, nil, 79, 51, nil, nil, 125, 81, 82,
83, nil, nil, nil, nil, nil, nil, 92, 6, 6,
nil, nil, nil, 91, nil, 104, 105, 106, 107, 75,
76, nil, nil, nil, nil, 93, 94, 95, 96, 97,
nil, nil, nil, nil, 6, 6, nil, nil, nil, 104,
105, 51, 109, nil, 111, nil, nil, nil, 115, nil,
nil, 108, 118, 119, 120, 6, 6, nil, nil, 122,
nil, nil, nil, 123, nil, nil, 127 ]
racc_goto_check = [
21, 8, 21, 21, 24, 12, 22, 4, 5, 5,
5, 5, 14, 7, 7, 1, 2, 3, 15, 13,
16, 25, 6, nil, nil, nil, 5, nil, nil, nil,
6, nil, nil, 14, 4, nil, nil, 22, 15, 15,
15, nil, nil, nil, nil, nil, nil, 12, 6, 6,
nil, nil, nil, 21, nil, 24, 24, 24, 24, 4,
4, nil, nil, nil, nil, 5, 5, 5, 5, 5,
nil, nil, nil, nil, 6, 6, nil, nil, nil, 24,
24, 4, 21, nil, 21, nil, nil, nil, 5, nil,
nil, 8, 5, 5, 5, 6, 6, nil, nil, 21,
nil, nil, nil, 21, nil, nil, 21 ]
racc_goto_pointer = [
nil, 15, 16, 15, 7, -20, 22, -41, -7, nil,
nil, nil, -37, 7, -25, -22, -70, nil, nil, nil,
nil, -18, -85, nil, -39, -22 ]
racc_goto_default = [
nil, nil, nil, nil, 50, 43, 68, 7, nil, 9,
10, 11, 12, 58, nil, nil, 57, 14, 15, 16,
17, nil, nil, 45, 103, nil ]
racc_reduce_table = [
0, 0, :racc_error,
2, 32, :_reduce_1,
1, 32, :_reduce_2,
1, 32, :_reduce_3,
1, 34, :_reduce_4,
1, 34, :_reduce_5,
1, 33, :_reduce_none,
2, 33, :_reduce_none,
2, 33, :_reduce_none,
4, 35, :_reduce_9,
4, 35, :_reduce_10,
3, 35, :_reduce_11,
3, 35, :_reduce_12,
1, 35, :_reduce_none,
1, 37, :_reduce_none,
2, 37, :_reduce_15,
2, 37, :_reduce_16,
4, 38, :_reduce_17,
4, 38, :_reduce_18,
1, 38, :_reduce_none,
0, 36, :_reduce_none,
2, 36, :_reduce_21,
1, 40, :_reduce_none,
1, 40, :_reduce_none,
3, 41, :_reduce_24,
3, 41, :_reduce_25,
0, 43, :_reduce_26,
3, 43, :_reduce_27,
1, 44, :_reduce_28,
1, 44, :_reduce_29,
3, 44, :_reduce_30,
1, 44, :_reduce_31,
0, 46, :_reduce_32,
2, 46, :_reduce_33,
2, 46, :_reduce_34,
2, 46, :_reduce_35,
0, 45, :_reduce_36,
1, 45, :_reduce_none,
1, 39, :_reduce_38,
1, 39, :_reduce_39,
1, 39, :_reduce_40,
1, 42, :_reduce_none,
1, 42, :_reduce_none,
1, 42, :_reduce_none,
1, 42, :_reduce_none,
2, 47, :_reduce_45,
3, 51, :_reduce_46,
10, 48, :_reduce_47,
5, 49, :_reduce_48,
7, 49, :_reduce_49,
6, 49, :_reduce_50,
4, 53, :_reduce_51,
6, 53, :_reduce_52,
5, 53, :_reduce_53,
3, 50, :_reduce_54,
1, 52, :_reduce_none,
2, 52, :_reduce_56,
2, 54, :_reduce_57,
3, 56, :_reduce_58,
3, 56, :_reduce_59,
3, 56, :_reduce_60,
4, 55, :_reduce_61,
4, 55, :_reduce_62,
4, 55, :_reduce_63,
4, 55, :_reduce_64,
4, 55, :_reduce_65,
1, 55, :_reduce_none ]
racc_reduce_n = 67
racc_shift_n = 128
racc_token_table = {
false => 0,
:error => 1,
:WORD => 2,
:ASGNWORD => 3,
:EOF => 4,
:BACKTICK => 5,
:DQUOTE => 6,
:ENDDQUOTE => 7,
:VAR => 8,
:SQUOTE => 9,
"&" => 10,
";" => 11,
"\n" => 12,
"&&" => 13,
"||" => 14,
"|" => 15,
"|&" => 16,
"!" => 17,
"(" => 18,
")" => 19,
"for" => 20,
"in" => 21,
"do" => 22,
"done" => 23,
"if" => 24,
"then" => 25,
"fi" => 26,
"else" => 27,
"elif" => 28,
"{" => 29,
"}" => 30 }
racc_nt_base = 31
racc_use_result_var = true
Racc_arg = [
racc_action_table,
racc_action_check,
racc_action_default,
racc_action_pointer,
racc_goto_table,
racc_goto_check,
racc_goto_default,
racc_goto_pointer,
racc_nt_base,
racc_reduce_table,
racc_token_table,
racc_shift_n,
racc_reduce_n,
racc_use_result_var ]
Racc_token_to_s_table = [
"$end",
"error",
"WORD",
"ASGNWORD",
"EOF",
"BACKTICK",
"DQUOTE",
"ENDDQUOTE",
"VAR",
"SQUOTE",
"\"&\"",
"\";\"",
"\"\\n\"",
"\"&&\"",
"\"||\"",
"\"|\"",
"\"|&\"",
"\"!\"",
"\"(\"",
"\")\"",
"\"for\"",
"\"in\"",
"\"do\"",
"\"done\"",
"\"if\"",
"\"then\"",
"\"fi\"",
"\"else\"",
"\"elif\"",
"\"{\"",
"\"}\"",
"$start",
"inputunit",
"simple_list",
"simple_list_terminator",
"simple_list1",
"newline_list",
"pipeline_command",
"pipeline",
"list_terminator",
"command",
"simple_command",
"shell_command",
"assignations",
"simple_command_element",
"simple_command_elements",
"quoted",
"word_list",
"for_command",
"if_command",
"group_command",
"subshell",
"compound_list",
"elif_clause",
"list",
"list1",
"list0" ]
Racc_debug_parser = true
##### State transition tables end #####
# reduce 0 omitted
def _reduce_1(val, _values, result)
@result = val[0]; yyaccept
result
end
def _reduce_2(val, _values, result)
result = :xx; yyaccept
result
end
def _reduce_3(val, _values, result)
yyerror
result
end
def _reduce_4(val, _values, result)
result = :xx
result
end
def _reduce_5(val, _values, result)
result = :yy
result
end
# reduce 6 omitted
# reduce 7 omitted
# reduce 8 omitted
def _reduce_9(val, _values, result)
result = {type: :flow, op: val[1], car: val[0], cdr: val[3]}
result
end
def _reduce_10(val, _values, result)
result = {type: :flow, op: val[1], car: val[0], cdr: val[3]}
result
end
def _reduce_11(val, _values, result)
result = dolist(:list, {type: :bg, value: val[0]}, val[3])
result
end
def _reduce_12(val, _values, result)
result = dolist(:list, val[0], val[3])
result
end
# reduce 13 omitted
# reduce 14 omitted
def _reduce_15(val, _values, result)
result = {type: :not, value: val[1]}
result
end
def _reduce_16(val, _values, result)
result = {type: :exec, asgn: [], car: "false", cdr: []}
result
end
def _reduce_17(val, _values, result)
result = dolist(:pipe, val[0], val[3])
result
end
def _reduce_18(val, _values, result)
result = dolist(:pipe, {type: :wrap_stderr, value: val[0]}, val[3])
result
end
# reduce 19 omitted
# reduce 20 omitted
def _reduce_21(val, _values, result)
result = :xx
result
end
# reduce 22 omitted
# reduce 23 omitted
def _reduce_24(val, _values, result)
result = {type: :exec, asgn: val[0], car: val[1], cdr: val[2]}
result
end
def _reduce_25(val, _values, result)
result = {type: :let, asgn: [{type: :assign, key: val[0], value: val[1]}, *val[2]]}
result
end
def _reduce_26(val, _values, result)
result = []
result
end
def _reduce_27(val, _values, result)
result = [{type: :assign, key: val[0], value: val[1]}, *val[2]]
result
end
def _reduce_28(val, _values, result)
result = {type: :lit, value: val[0]}
result
end
def _reduce_29(val, _values, result)
result = {type: :lit, value: squote(val[0])}
result
end
def _reduce_30(val, _values, result)
result = {type: :str, values: val[1]}
result
end
def _reduce_31(val, _values, result)
result = {type: :backtick, value: Bash.new.setq(val[0]).each}
result
end
def _reduce_32(val, _values, result)
result = []
result
end
def _reduce_33(val, _values, result)
result = [{type: :backtick, value: Bash.new.setq(val[0]).each}, *val[1]]
result
end
def _reduce_34(val, _values, result)
result = [{type: :lit, value: val[0]}, *val[1]]
result
end
def _reduce_35(val, _values, result)
result = [{type: :var, value: val[0][1..-1]}, *val[1]]
result
end
def _reduce_36(val, _values, result)
result = []
result
end
# reduce 37 omitted
def _reduce_38(val, _values, result)
result = :xx
result
end
def _reduce_39(val, _values, result)
result = :zz
result
end
def _reduce_40(val, _values, result)
result = :yy
result
end
# reduce 41 omitted
# reduce 42 omitted
# reduce 43 omitted
# reduce 44 omitted
def _reduce_45(val, _values, result)
result = [val[0], *val[1]]
result
end
def _reduce_46(val, _values, result)
result = {type: :fork, value: val[1]}
result
end
def _reduce_47(val, _values, result)
result = {type: :for, var: val[1], list: val[4], value: val[8]}
result
end
def _reduce_48(val, _values, result)
result = {type: :if, cond: val[1], then: val[3]}
result
end
def _reduce_49(val, _values, result)
result = {type: :if, cond: val[1], then: val[3], else: val[5] }
result
end
def _reduce_50(val, _values, result)
result = {type: :if, cond: val[1], then: val[3], else: val[4] }
result
end
def _reduce_51(val, _values, result)
result = {type: :if, cond: val[1], then: val[3]}
result
end
def _reduce_52(val, _values, result)
result = {type: :if, cond: val[1], then: val[3], else: val[5] }
result
end
def _reduce_53(val, _values, result)
result = {type: :if, cond: val[1], then: val[3], else: val[4] }
result
end
def _reduce_54(val, _values, result)
result = val[1]
result
end
# reduce 55 omitted
def _reduce_56(val, _values, result)
result = val[1]
result
end
def _reduce_57(val, _values, result)
result = val[1]
result
end
def _reduce_58(val, _values, result)
result = dolist(:list, val[0], val[2])
result
end
def _reduce_59(val, _values, result)
result = dolist(:list, {type: :bg, value: val[0]}, val[2])
result
end
def _reduce_60(val, _values, result)
result = dolist(:list, val[0], val[2])
result
end
def _reduce_61(val, _values, result)
result = {type: :flow, op: val[1], car: val[0], cdr: val[3]}
result
end
def _reduce_62(val, _values, result)
result = {type: :flow, op: val[1], car: val[0], cdr: val[3]}
result
end
def _reduce_63(val, _values, result)
result = dolist(:list, {type: :bg, value: val[0]}, val[3])
result
end
def _reduce_64(val, _values, result)
result = dolist(:list, val[0], val[3])
result
end
def _reduce_65(val, _values, result)
result = dolist(:list, val[0], val[3])
result
end
# reduce 66 omitted
def _reduce_none(val, _values, result)
val[0]
end
end # class Bash
def unparse(exp)
case exp
when Array, Enumerator
exp.map{|x| unparse(x)}.join(' ')
when Hash
case exp[:type]
when :lit
"\"#{exp[:value]}\""
when :exec
(
exp[:asgn].map{|e| unparse(e)} + # list of "assign"s
[exp[:car][:value]] +
exp[:cdr].map{|e| unparse(e)} # list of "lit/backtick"s
).join(' ')
when :not
"! " + unparse(exp[:value])
when :var
"${#{exp[:value]}}"
when :str
exp[:values].map{|e| unparse(e)}.join
when :assign
exp[:key] + exp[:value]
when :list
exp[:values].reject{|x| x =~ /^\s*$/}.map{|e| unparse(e)}.join(" ; ")
when :pipe
exp[:values].map{|e| unparse(e)}.join(" | ")
when :simple
unparse(exp[:value])
when :backtick
"$( #{unparse(exp[:value])} )"
when :fork
"(#{unparse(exp[:value])})"
when :for
"for #{exp[:var]} in #{exp[:list].map{|x| unparse(x)}.join(' ')} do ; #{unparse exp[:value]} ; done"
when :let
exp[:asgn].map{|e| unparse(e)}.join(" ")
else
raise NotImplementedError, exp.inspect
end
when NilClass
""
else
raise NotImplementedError, exp.inspect
end
end
if $PROGRAM_NAME == __FILE__
require 'pp'
parser = Bash.new
program = <<-EOF
#!/bin/sh
cat | shuf | head
special
z=0 n=0
( a ; b ) | ( c
d )
for i in `ls *.txt` ; do
echo "Foo $i has $(get_bucks $i) \\$"
echo $(get_bucks $i)
echo bar | POSIXLY_CORRECT=1 grep --color=auto 'a'
! test -d "$i"
done # This is a comment
exit 0
EOF
program = "a --arg value | b | c"
parser.load(program)
parser.each do |parsed|
pp parsed
puts unparse( parsed )
puts "--"
end
end