fig 0.1.73 → 0.1.75

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/Changes +75 -0
  2. data/lib/fig.rb +1 -1
  3. data/lib/fig/command.rb +36 -12
  4. data/lib/fig/command/action.rb +1 -1
  5. data/lib/fig/command/action/dump_package_definition_parsed.rb +4 -6
  6. data/lib/fig/command/action/run_command_statement.rb +3 -2
  7. data/lib/fig/command/options.rb +12 -3
  8. data/lib/fig/command/options/parser.rb +2 -0
  9. data/lib/fig/command/package_loader.rb +1 -0
  10. data/lib/fig/config_file_error.rb +1 -1
  11. data/lib/fig/grammar/base.rb +214 -0
  12. data/lib/fig/grammar/base.treetop +29 -0
  13. data/lib/fig/grammar/v0.rb +1493 -0
  14. data/lib/fig/grammar/v0.treetop +167 -0
  15. data/lib/fig/grammar/v1.rb +1478 -0
  16. data/lib/fig/grammar/v1.treetop +174 -0
  17. data/lib/fig/grammar/version.rb +144 -0
  18. data/lib/fig/grammar/version.treetop +22 -0
  19. data/lib/fig/grammar/version_identification.rb +113 -0
  20. data/lib/fig/grammar/version_identification.treetop +27 -0
  21. data/lib/fig/log4r_config_error.rb +1 -1
  22. data/lib/fig/no_such_package_config_error.rb +1 -1
  23. data/lib/fig/not_found_error.rb +7 -0
  24. data/lib/fig/operating_system.rb +31 -20
  25. data/lib/fig/package.rb +8 -3
  26. data/lib/fig/package_definition_text_assembler.rb +88 -0
  27. data/lib/fig/package_descriptor_parse_error.rb +1 -1
  28. data/lib/fig/parser.rb +115 -29
  29. data/lib/fig/parser_package_build_state.rb +38 -11
  30. data/lib/fig/repository.rb +5 -8
  31. data/lib/fig/repository_package_publisher.rb +114 -96
  32. data/lib/fig/runtime_environment.rb +42 -14
  33. data/lib/fig/statement.rb +133 -0
  34. data/lib/fig/statement/archive.rb +6 -4
  35. data/lib/fig/statement/asset.rb +28 -34
  36. data/lib/fig/statement/command.rb +6 -2
  37. data/lib/fig/statement/configuration.rb +4 -12
  38. data/lib/fig/statement/grammar_version.rb +22 -0
  39. data/lib/fig/statement/include.rb +5 -6
  40. data/lib/fig/statement/override.rb +6 -3
  41. data/lib/fig/statement/path.rb +12 -2
  42. data/lib/fig/statement/resource.rb +8 -8
  43. data/lib/fig/statement/retrieve.rb +11 -3
  44. data/lib/fig/statement/set.rb +12 -2
  45. data/lib/fig/unparser.rb +127 -0
  46. data/lib/fig/unparser/v0.rb +84 -0
  47. data/lib/fig/unparser/v1.rb +77 -0
  48. data/lib/fig/url.rb +7 -0
  49. metadata +139 -25
  50. data/lib/fig/grammar.treetop +0 -147
@@ -0,0 +1,29 @@
1
+ # Treetop (http://treetop.rubyforge.org/) grammar for common definitions.
2
+
3
+ require 'treetop'
4
+
5
+ module Fig
6
+ module Grammar
7
+ grammar Base
8
+ rule ws
9
+ [ \n\r\t]+
10
+ end
11
+
12
+ rule optional_ws
13
+ [ \n\r\t]*
14
+ end
15
+
16
+ rule comment
17
+ '#' [^\n]* "\n"
18
+ end
19
+
20
+ rule ws_or_comment
21
+ ws / comment
22
+ end
23
+
24
+ rule optional_ws_or_comment
25
+ ws_or_comment*
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,1493 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ # Treetop (http://treetop.rubyforge.org/) grammar for package definitions from
5
+ # the early days.
6
+
7
+ # Some aspects of this grammar are significantly dumber than they could be
8
+ # because:
9
+ #
10
+ # * We want to treat statements as identically as possible to their
11
+ # command-line equivalents.
12
+ # * Treetop parse errors are pretty inscrutable at times and we can make
13
+ # error messages clearer by validating a lot of the terminals ourselves.
14
+
15
+ require 'treetop'
16
+
17
+ require 'fig/grammar/base'
18
+ require 'fig/grammar/version'
19
+
20
+ module Fig
21
+ module Grammar
22
+ module V0
23
+ include Treetop::Runtime
24
+
25
+ def root
26
+ @root ||= :package
27
+ end
28
+
29
+ include Fig::Grammar::Base
30
+
31
+ include Fig::Grammar::Version
32
+
33
+ module Package0
34
+ def optional_ws1
35
+ elements[0]
36
+ end
37
+
38
+ def grammar_version
39
+ elements[1]
40
+ end
41
+
42
+ def statements
43
+ elements[3]
44
+ end
45
+
46
+ def optional_ws2
47
+ elements[4]
48
+ end
49
+ end
50
+
51
+ module Package1
52
+ def to_package(directory, build_state)
53
+ return build_state.new_package_statement(
54
+ directory, grammar_version, statements
55
+ )
56
+ end
57
+ end
58
+
59
+ def _nt_package
60
+ start_index = index
61
+ if node_cache[:package].has_key?(index)
62
+ cached = node_cache[:package][index]
63
+ if cached
64
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
65
+ @index = cached.interval.end
66
+ end
67
+ return cached
68
+ end
69
+
70
+ i0, s0 = index, []
71
+ r1 = _nt_optional_ws
72
+ s0 << r1
73
+ if r1
74
+ r3 = _nt_grammar_version
75
+ if r3
76
+ r2 = r3
77
+ else
78
+ r2 = instantiate_node(SyntaxNode,input, index...index)
79
+ end
80
+ s0 << r2
81
+ if r2
82
+ s4, i4 = [], index
83
+ loop do
84
+ r5 = _nt_ws
85
+ if r5
86
+ s4 << r5
87
+ else
88
+ break
89
+ end
90
+ end
91
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
92
+ s0 << r4
93
+ if r4
94
+ s6, i6 = [], index
95
+ loop do
96
+ r7 = _nt_package_statement
97
+ if r7
98
+ s6 << r7
99
+ else
100
+ break
101
+ end
102
+ end
103
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
104
+ s0 << r6
105
+ if r6
106
+ r8 = _nt_optional_ws
107
+ s0 << r8
108
+ end
109
+ end
110
+ end
111
+ end
112
+ if s0.last
113
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
114
+ r0.extend(Package0)
115
+ r0.extend(Package1)
116
+ else
117
+ @index = i0
118
+ r0 = nil
119
+ end
120
+
121
+ node_cache[:package][start_index] = r0
122
+
123
+ r0
124
+ end
125
+
126
+ def _nt_package_statement
127
+ start_index = index
128
+ if node_cache[:package_statement].has_key?(index)
129
+ cached = node_cache[:package_statement][index]
130
+ if cached
131
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
132
+ @index = cached.interval.end
133
+ end
134
+ return cached
135
+ end
136
+
137
+ i0 = index
138
+ r1 = _nt_archive
139
+ if r1
140
+ r0 = r1
141
+ else
142
+ r2 = _nt_resource
143
+ if r2
144
+ r0 = r2
145
+ else
146
+ r3 = _nt_retrieve
147
+ if r3
148
+ r0 = r3
149
+ else
150
+ r4 = _nt_config
151
+ if r4
152
+ r0 = r4
153
+ else
154
+ @index = i0
155
+ r0 = nil
156
+ end
157
+ end
158
+ end
159
+ end
160
+
161
+ node_cache[:package_statement][start_index] = r0
162
+
163
+ r0
164
+ end
165
+
166
+ module Archive0
167
+ def statement_start
168
+ elements[0]
169
+ end
170
+
171
+ def url
172
+ elements[2]
173
+ end
174
+ end
175
+
176
+ module Archive1
177
+ def to_package_statement(build_state)
178
+ return build_state.new_asset_statement(
179
+ Statement::Archive, statement_start, url.url
180
+ )
181
+ end
182
+ end
183
+
184
+ def _nt_archive
185
+ start_index = index
186
+ if node_cache[:archive].has_key?(index)
187
+ cached = node_cache[:archive][index]
188
+ if cached
189
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
190
+ @index = cached.interval.end
191
+ end
192
+ return cached
193
+ end
194
+
195
+ i0, s0 = index, []
196
+ if has_terminal?('archive', false, index)
197
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
198
+ @index += 7
199
+ else
200
+ terminal_parse_failure('archive')
201
+ r1 = nil
202
+ end
203
+ s0 << r1
204
+ if r1
205
+ s2, i2 = [], index
206
+ loop do
207
+ r3 = _nt_ws
208
+ if r3
209
+ s2 << r3
210
+ else
211
+ break
212
+ end
213
+ end
214
+ if s2.empty?
215
+ @index = i2
216
+ r2 = nil
217
+ else
218
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
219
+ end
220
+ s0 << r2
221
+ if r2
222
+ r4 = _nt_asset_url
223
+ s0 << r4
224
+ end
225
+ end
226
+ if s0.last
227
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
228
+ r0.extend(Archive0)
229
+ r0.extend(Archive1)
230
+ else
231
+ @index = i0
232
+ r0 = nil
233
+ end
234
+
235
+ node_cache[:archive][start_index] = r0
236
+
237
+ r0
238
+ end
239
+
240
+ module Resource0
241
+ def statement_start
242
+ elements[0]
243
+ end
244
+
245
+ def url
246
+ elements[2]
247
+ end
248
+ end
249
+
250
+ module Resource1
251
+ def to_package_statement(build_state)
252
+ return build_state.new_asset_statement(
253
+ Statement::Resource, statement_start, url.url
254
+ )
255
+ end
256
+ end
257
+
258
+ def _nt_resource
259
+ start_index = index
260
+ if node_cache[:resource].has_key?(index)
261
+ cached = node_cache[:resource][index]
262
+ if cached
263
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
264
+ @index = cached.interval.end
265
+ end
266
+ return cached
267
+ end
268
+
269
+ i0, s0 = index, []
270
+ if has_terminal?('resource', false, index)
271
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 8))
272
+ @index += 8
273
+ else
274
+ terminal_parse_failure('resource')
275
+ r1 = nil
276
+ end
277
+ s0 << r1
278
+ if r1
279
+ s2, i2 = [], index
280
+ loop do
281
+ r3 = _nt_ws
282
+ if r3
283
+ s2 << r3
284
+ else
285
+ break
286
+ end
287
+ end
288
+ if s2.empty?
289
+ @index = i2
290
+ r2 = nil
291
+ else
292
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
293
+ end
294
+ s0 << r2
295
+ if r2
296
+ r4 = _nt_asset_url
297
+ s0 << r4
298
+ end
299
+ end
300
+ if s0.last
301
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
302
+ r0.extend(Resource0)
303
+ r0.extend(Resource1)
304
+ else
305
+ @index = i0
306
+ r0 = nil
307
+ end
308
+
309
+ node_cache[:resource][start_index] = r0
310
+
311
+ r0
312
+ end
313
+
314
+ module AssetUrl0
315
+ def url
316
+ elements[0]
317
+ end
318
+
319
+ def ws
320
+ elements[1]
321
+ end
322
+ end
323
+
324
+ module AssetUrl1
325
+ def url
326
+ elements[1]
327
+ end
328
+
329
+ def ws
330
+ elements[3]
331
+ end
332
+ end
333
+
334
+ def _nt_asset_url
335
+ start_index = index
336
+ if node_cache[:asset_url].has_key?(index)
337
+ cached = node_cache[:asset_url][index]
338
+ if cached
339
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
340
+ @index = cached.interval.end
341
+ end
342
+ return cached
343
+ end
344
+
345
+ i0 = index
346
+ i1, s1 = index, []
347
+ s2, i2 = [], index
348
+ loop do
349
+ if has_terminal?('\G[^@\'"<>|\\s]', true, index)
350
+ r3 = true
351
+ @index += 1
352
+ else
353
+ r3 = nil
354
+ end
355
+ if r3
356
+ s2 << r3
357
+ else
358
+ break
359
+ end
360
+ end
361
+ if s2.empty?
362
+ @index = i2
363
+ r2 = nil
364
+ else
365
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
366
+ end
367
+ s1 << r2
368
+ if r2
369
+ r4 = _nt_ws
370
+ s1 << r4
371
+ end
372
+ if s1.last
373
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
374
+ r1.extend(AssetUrl0)
375
+ else
376
+ @index = i1
377
+ r1 = nil
378
+ end
379
+ if r1
380
+ r0 = r1
381
+ else
382
+ i5, s5 = index, []
383
+ if has_terminal?('"', false, index)
384
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
385
+ @index += 1
386
+ else
387
+ terminal_parse_failure('"')
388
+ r6 = nil
389
+ end
390
+ s5 << r6
391
+ if r6
392
+ s7, i7 = [], index
393
+ loop do
394
+ if has_terminal?('\G[^@\'"<>|*?\\[\\]{}\\s]', true, index)
395
+ r8 = true
396
+ @index += 1
397
+ else
398
+ r8 = nil
399
+ end
400
+ if r8
401
+ s7 << r8
402
+ else
403
+ break
404
+ end
405
+ end
406
+ if s7.empty?
407
+ @index = i7
408
+ r7 = nil
409
+ else
410
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
411
+ end
412
+ s5 << r7
413
+ if r7
414
+ if has_terminal?('"', false, index)
415
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
416
+ @index += 1
417
+ else
418
+ terminal_parse_failure('"')
419
+ r9 = nil
420
+ end
421
+ s5 << r9
422
+ if r9
423
+ r10 = _nt_ws
424
+ s5 << r10
425
+ end
426
+ end
427
+ end
428
+ if s5.last
429
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
430
+ r5.extend(AssetUrl1)
431
+ else
432
+ @index = i5
433
+ r5 = nil
434
+ end
435
+ if r5
436
+ r0 = r5
437
+ else
438
+ @index = i0
439
+ r0 = nil
440
+ end
441
+ end
442
+
443
+ node_cache[:asset_url][start_index] = r0
444
+
445
+ r0
446
+ end
447
+
448
+ module Retrieve0
449
+ def statement_start
450
+ elements[0]
451
+ end
452
+
453
+ def var
454
+ elements[2]
455
+ end
456
+
457
+ def path
458
+ elements[4]
459
+ end
460
+
461
+ end
462
+
463
+ module Retrieve1
464
+ def to_package_statement(build_state)
465
+ return build_state.new_retrieve_statement(statement_start, var, path)
466
+ end
467
+ end
468
+
469
+ def _nt_retrieve
470
+ start_index = index
471
+ if node_cache[:retrieve].has_key?(index)
472
+ cached = node_cache[:retrieve][index]
473
+ if cached
474
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
475
+ @index = cached.interval.end
476
+ end
477
+ return cached
478
+ end
479
+
480
+ i0, s0 = index, []
481
+ if has_terminal?('retrieve', false, index)
482
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 8))
483
+ @index += 8
484
+ else
485
+ terminal_parse_failure('retrieve')
486
+ r1 = nil
487
+ end
488
+ s0 << r1
489
+ if r1
490
+ s2, i2 = [], index
491
+ loop do
492
+ r3 = _nt_ws
493
+ if r3
494
+ s2 << r3
495
+ else
496
+ break
497
+ end
498
+ end
499
+ if s2.empty?
500
+ @index = i2
501
+ r2 = nil
502
+ else
503
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
504
+ end
505
+ s0 << r2
506
+ if r2
507
+ r4 = _nt_environment_variable_name
508
+ s0 << r4
509
+ if r4
510
+ if has_terminal?('->', false, index)
511
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
512
+ @index += 2
513
+ else
514
+ terminal_parse_failure('->')
515
+ r5 = nil
516
+ end
517
+ s0 << r5
518
+ if r5
519
+ r6 = _nt_retrieve_path
520
+ s0 << r6
521
+ if r6
522
+ s7, i7 = [], index
523
+ loop do
524
+ r8 = _nt_ws
525
+ if r8
526
+ s7 << r8
527
+ else
528
+ break
529
+ end
530
+ end
531
+ if s7.empty?
532
+ @index = i7
533
+ r7 = nil
534
+ else
535
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
536
+ end
537
+ s0 << r7
538
+ end
539
+ end
540
+ end
541
+ end
542
+ end
543
+ if s0.last
544
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
545
+ r0.extend(Retrieve0)
546
+ r0.extend(Retrieve1)
547
+ else
548
+ @index = i0
549
+ r0 = nil
550
+ end
551
+
552
+ node_cache[:retrieve][start_index] = r0
553
+
554
+ r0
555
+ end
556
+
557
+ def _nt_retrieve_path
558
+ start_index = index
559
+ if node_cache[:retrieve_path].has_key?(index)
560
+ cached = node_cache[:retrieve_path][index]
561
+ if cached
562
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
563
+ @index = cached.interval.end
564
+ end
565
+ return cached
566
+ end
567
+
568
+ s0, i0 = [], index
569
+ loop do
570
+ if has_terminal?('\G[a-zA-Z0-9_/.\\[\\]-]', true, index)
571
+ r1 = true
572
+ @index += 1
573
+ else
574
+ r1 = nil
575
+ end
576
+ if r1
577
+ s0 << r1
578
+ else
579
+ break
580
+ end
581
+ end
582
+ if s0.empty?
583
+ @index = i0
584
+ r0 = nil
585
+ else
586
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
587
+ end
588
+
589
+ node_cache[:retrieve_path][start_index] = r0
590
+
591
+ r0
592
+ end
593
+
594
+ module Config0
595
+ def statement_start
596
+ elements[0]
597
+ end
598
+
599
+ def config_name
600
+ elements[2]
601
+ end
602
+
603
+ def statements
604
+ elements[4]
605
+ end
606
+
607
+ end
608
+
609
+ module Config1
610
+ def to_package_statement(build_state)
611
+ return build_state.new_configuration_statement(
612
+ statement_start, config_name, statements
613
+ )
614
+ end
615
+ end
616
+
617
+ def _nt_config
618
+ start_index = index
619
+ if node_cache[:config].has_key?(index)
620
+ cached = node_cache[:config][index]
621
+ if cached
622
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
623
+ @index = cached.interval.end
624
+ end
625
+ return cached
626
+ end
627
+
628
+ i0, s0 = index, []
629
+ if has_terminal?('config', false, index)
630
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
631
+ @index += 6
632
+ else
633
+ terminal_parse_failure('config')
634
+ r1 = nil
635
+ end
636
+ s0 << r1
637
+ if r1
638
+ s2, i2 = [], index
639
+ loop do
640
+ r3 = _nt_ws
641
+ if r3
642
+ s2 << r3
643
+ else
644
+ break
645
+ end
646
+ end
647
+ if s2.empty?
648
+ @index = i2
649
+ r2 = nil
650
+ else
651
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
652
+ end
653
+ s0 << r2
654
+ if r2
655
+ r4 = _nt_config_name
656
+ s0 << r4
657
+ if r4
658
+ s5, i5 = [], index
659
+ loop do
660
+ r6 = _nt_ws
661
+ if r6
662
+ s5 << r6
663
+ else
664
+ break
665
+ end
666
+ end
667
+ if s5.empty?
668
+ @index = i5
669
+ r5 = nil
670
+ else
671
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
672
+ end
673
+ s0 << r5
674
+ if r5
675
+ s7, i7 = [], index
676
+ loop do
677
+ r8 = _nt_config_statement
678
+ if r8
679
+ s7 << r8
680
+ else
681
+ break
682
+ end
683
+ end
684
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
685
+ s0 << r7
686
+ if r7
687
+ if has_terminal?('end', false, index)
688
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 3))
689
+ @index += 3
690
+ else
691
+ terminal_parse_failure('end')
692
+ r9 = nil
693
+ end
694
+ s0 << r9
695
+ if r9
696
+ s10, i10 = [], index
697
+ loop do
698
+ r11 = _nt_ws
699
+ if r11
700
+ s10 << r11
701
+ else
702
+ break
703
+ end
704
+ end
705
+ if s10.empty?
706
+ @index = i10
707
+ r10 = nil
708
+ else
709
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
710
+ end
711
+ s0 << r10
712
+ end
713
+ end
714
+ end
715
+ end
716
+ end
717
+ end
718
+ if s0.last
719
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
720
+ r0.extend(Config0)
721
+ r0.extend(Config1)
722
+ else
723
+ @index = i0
724
+ r0 = nil
725
+ end
726
+
727
+ node_cache[:config][start_index] = r0
728
+
729
+ r0
730
+ end
731
+
732
+ def _nt_config_name
733
+ start_index = index
734
+ if node_cache[:config_name].has_key?(index)
735
+ cached = node_cache[:config_name][index]
736
+ if cached
737
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
738
+ @index = cached.interval.end
739
+ end
740
+ return cached
741
+ end
742
+
743
+ s0, i0 = [], index
744
+ loop do
745
+ if has_terminal?('\G[a-zA-Z0-9_.-]', true, index)
746
+ r1 = true
747
+ @index += 1
748
+ else
749
+ r1 = nil
750
+ end
751
+ if r1
752
+ s0 << r1
753
+ else
754
+ break
755
+ end
756
+ end
757
+ if s0.empty?
758
+ @index = i0
759
+ r0 = nil
760
+ else
761
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
762
+ end
763
+
764
+ node_cache[:config_name][start_index] = r0
765
+
766
+ r0
767
+ end
768
+
769
+ def _nt_config_statement
770
+ start_index = index
771
+ if node_cache[:config_statement].has_key?(index)
772
+ cached = node_cache[:config_statement][index]
773
+ if cached
774
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
775
+ @index = cached.interval.end
776
+ end
777
+ return cached
778
+ end
779
+
780
+ i0 = index
781
+ r1 = _nt_override
782
+ if r1
783
+ r0 = r1
784
+ else
785
+ r2 = _nt_include
786
+ if r2
787
+ r0 = r2
788
+ else
789
+ r3 = _nt_command
790
+ if r3
791
+ r0 = r3
792
+ else
793
+ r4 = _nt_path
794
+ if r4
795
+ r0 = r4
796
+ else
797
+ r5 = _nt_set
798
+ if r5
799
+ r0 = r5
800
+ else
801
+ @index = i0
802
+ r0 = nil
803
+ end
804
+ end
805
+ end
806
+ end
807
+ end
808
+
809
+ node_cache[:config_statement][start_index] = r0
810
+
811
+ r0
812
+ end
813
+
814
+ module Include0
815
+ def statement_start
816
+ elements[0]
817
+ end
818
+
819
+ def descriptor_string
820
+ elements[2]
821
+ end
822
+
823
+ end
824
+
825
+ module Include1
826
+ def to_config_statement(build_state)
827
+ return build_state.new_include_statement(
828
+ statement_start, descriptor_string
829
+ )
830
+ end
831
+ end
832
+
833
+ def _nt_include
834
+ start_index = index
835
+ if node_cache[:include].has_key?(index)
836
+ cached = node_cache[:include][index]
837
+ if cached
838
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
839
+ @index = cached.interval.end
840
+ end
841
+ return cached
842
+ end
843
+
844
+ i0, s0 = index, []
845
+ if has_terminal?('include', false, index)
846
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
847
+ @index += 7
848
+ else
849
+ terminal_parse_failure('include')
850
+ r1 = nil
851
+ end
852
+ s0 << r1
853
+ if r1
854
+ s2, i2 = [], index
855
+ loop do
856
+ r3 = _nt_ws
857
+ if r3
858
+ s2 << r3
859
+ else
860
+ break
861
+ end
862
+ end
863
+ if s2.empty?
864
+ @index = i2
865
+ r2 = nil
866
+ else
867
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
868
+ end
869
+ s0 << r2
870
+ if r2
871
+ r4 = _nt_descriptor_string
872
+ s0 << r4
873
+ if r4
874
+ s5, i5 = [], index
875
+ loop do
876
+ r6 = _nt_ws
877
+ if r6
878
+ s5 << r6
879
+ else
880
+ break
881
+ end
882
+ end
883
+ if s5.empty?
884
+ @index = i5
885
+ r5 = nil
886
+ else
887
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
888
+ end
889
+ s0 << r5
890
+ end
891
+ end
892
+ end
893
+ if s0.last
894
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
895
+ r0.extend(Include0)
896
+ r0.extend(Include1)
897
+ else
898
+ @index = i0
899
+ r0 = nil
900
+ end
901
+
902
+ node_cache[:include][start_index] = r0
903
+
904
+ r0
905
+ end
906
+
907
+ module Override0
908
+ def statement_start
909
+ elements[0]
910
+ end
911
+
912
+ def descriptor_string
913
+ elements[2]
914
+ end
915
+
916
+ end
917
+
918
+ module Override1
919
+ def to_config_statement(build_state)
920
+ return build_state.new_override_statement(
921
+ statement_start, descriptor_string
922
+ )
923
+ end
924
+ end
925
+
926
+ def _nt_override
927
+ start_index = index
928
+ if node_cache[:override].has_key?(index)
929
+ cached = node_cache[:override][index]
930
+ if cached
931
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
932
+ @index = cached.interval.end
933
+ end
934
+ return cached
935
+ end
936
+
937
+ i0, s0 = index, []
938
+ if has_terminal?('override', false, index)
939
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 8))
940
+ @index += 8
941
+ else
942
+ terminal_parse_failure('override')
943
+ r1 = nil
944
+ end
945
+ s0 << r1
946
+ if r1
947
+ s2, i2 = [], index
948
+ loop do
949
+ r3 = _nt_ws
950
+ if r3
951
+ s2 << r3
952
+ else
953
+ break
954
+ end
955
+ end
956
+ if s2.empty?
957
+ @index = i2
958
+ r2 = nil
959
+ else
960
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
961
+ end
962
+ s0 << r2
963
+ if r2
964
+ r4 = _nt_descriptor_string
965
+ s0 << r4
966
+ if r4
967
+ s5, i5 = [], index
968
+ loop do
969
+ r6 = _nt_ws
970
+ if r6
971
+ s5 << r6
972
+ else
973
+ break
974
+ end
975
+ end
976
+ if s5.empty?
977
+ @index = i5
978
+ r5 = nil
979
+ else
980
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
981
+ end
982
+ s0 << r5
983
+ end
984
+ end
985
+ end
986
+ if s0.last
987
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
988
+ r0.extend(Override0)
989
+ r0.extend(Override1)
990
+ else
991
+ @index = i0
992
+ r0 = nil
993
+ end
994
+
995
+ node_cache[:override][start_index] = r0
996
+
997
+ r0
998
+ end
999
+
1000
+ module Path0
1001
+ def statement_start
1002
+ elements[0]
1003
+ end
1004
+
1005
+ def name_value
1006
+ elements[2]
1007
+ end
1008
+
1009
+ end
1010
+
1011
+ module Path1
1012
+ def to_config_statement(build_state)
1013
+ return build_state.new_environment_variable_statement(
1014
+ Statement::Path, statement_start, name_value
1015
+ )
1016
+ end
1017
+ end
1018
+
1019
+ def _nt_path
1020
+ start_index = index
1021
+ if node_cache[:path].has_key?(index)
1022
+ cached = node_cache[:path][index]
1023
+ if cached
1024
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1025
+ @index = cached.interval.end
1026
+ end
1027
+ return cached
1028
+ end
1029
+
1030
+ i0, s0 = index, []
1031
+ i1 = index
1032
+ if has_terminal?('add', false, index)
1033
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 3))
1034
+ @index += 3
1035
+ else
1036
+ terminal_parse_failure('add')
1037
+ r2 = nil
1038
+ end
1039
+ if r2
1040
+ r1 = r2
1041
+ else
1042
+ if has_terminal?('append', false, index)
1043
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 6))
1044
+ @index += 6
1045
+ else
1046
+ terminal_parse_failure('append')
1047
+ r3 = nil
1048
+ end
1049
+ if r3
1050
+ r1 = r3
1051
+ else
1052
+ if has_terminal?('path', false, index)
1053
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 4))
1054
+ @index += 4
1055
+ else
1056
+ terminal_parse_failure('path')
1057
+ r4 = nil
1058
+ end
1059
+ if r4
1060
+ r1 = r4
1061
+ else
1062
+ @index = i1
1063
+ r1 = nil
1064
+ end
1065
+ end
1066
+ end
1067
+ s0 << r1
1068
+ if r1
1069
+ s5, i5 = [], index
1070
+ loop do
1071
+ r6 = _nt_ws
1072
+ if r6
1073
+ s5 << r6
1074
+ else
1075
+ break
1076
+ end
1077
+ end
1078
+ if s5.empty?
1079
+ @index = i5
1080
+ r5 = nil
1081
+ else
1082
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1083
+ end
1084
+ s0 << r5
1085
+ if r5
1086
+ s7, i7 = [], index
1087
+ loop do
1088
+ if has_terminal?('\G[\\S]', true, index)
1089
+ r8 = true
1090
+ @index += 1
1091
+ else
1092
+ r8 = nil
1093
+ end
1094
+ if r8
1095
+ s7 << r8
1096
+ else
1097
+ break
1098
+ end
1099
+ end
1100
+ if s7.empty?
1101
+ @index = i7
1102
+ r7 = nil
1103
+ else
1104
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
1105
+ end
1106
+ s0 << r7
1107
+ if r7
1108
+ s9, i9 = [], index
1109
+ loop do
1110
+ r10 = _nt_ws
1111
+ if r10
1112
+ s9 << r10
1113
+ else
1114
+ break
1115
+ end
1116
+ end
1117
+ if s9.empty?
1118
+ @index = i9
1119
+ r9 = nil
1120
+ else
1121
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
1122
+ end
1123
+ s0 << r9
1124
+ end
1125
+ end
1126
+ end
1127
+ if s0.last
1128
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1129
+ r0.extend(Path0)
1130
+ r0.extend(Path1)
1131
+ else
1132
+ @index = i0
1133
+ r0 = nil
1134
+ end
1135
+
1136
+ node_cache[:path][start_index] = r0
1137
+
1138
+ r0
1139
+ end
1140
+
1141
+ def _nt_environment_variable_name
1142
+ start_index = index
1143
+ if node_cache[:environment_variable_name].has_key?(index)
1144
+ cached = node_cache[:environment_variable_name][index]
1145
+ if cached
1146
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1147
+ @index = cached.interval.end
1148
+ end
1149
+ return cached
1150
+ end
1151
+
1152
+ s0, i0 = [], index
1153
+ loop do
1154
+ if has_terminal?('\G[a-zA-Z0-9_]', true, index)
1155
+ r1 = true
1156
+ @index += 1
1157
+ else
1158
+ r1 = nil
1159
+ end
1160
+ if r1
1161
+ s0 << r1
1162
+ else
1163
+ break
1164
+ end
1165
+ end
1166
+ if s0.empty?
1167
+ @index = i0
1168
+ r0 = nil
1169
+ else
1170
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1171
+ end
1172
+
1173
+ node_cache[:environment_variable_name][start_index] = r0
1174
+
1175
+ r0
1176
+ end
1177
+
1178
+ module Set0
1179
+ def statement_start
1180
+ elements[0]
1181
+ end
1182
+
1183
+ def name_value
1184
+ elements[2]
1185
+ end
1186
+
1187
+ end
1188
+
1189
+ module Set1
1190
+ def to_config_statement(build_state)
1191
+ return build_state.new_environment_variable_statement(
1192
+ Statement::Set, statement_start, name_value
1193
+ )
1194
+ end
1195
+ end
1196
+
1197
+ def _nt_set
1198
+ start_index = index
1199
+ if node_cache[:set].has_key?(index)
1200
+ cached = node_cache[:set][index]
1201
+ if cached
1202
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1203
+ @index = cached.interval.end
1204
+ end
1205
+ return cached
1206
+ end
1207
+
1208
+ i0, s0 = index, []
1209
+ if has_terminal?('set', false, index)
1210
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
1211
+ @index += 3
1212
+ else
1213
+ terminal_parse_failure('set')
1214
+ r1 = nil
1215
+ end
1216
+ s0 << r1
1217
+ if r1
1218
+ s2, i2 = [], index
1219
+ loop do
1220
+ r3 = _nt_ws
1221
+ if r3
1222
+ s2 << r3
1223
+ else
1224
+ break
1225
+ end
1226
+ end
1227
+ if s2.empty?
1228
+ @index = i2
1229
+ r2 = nil
1230
+ else
1231
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1232
+ end
1233
+ s0 << r2
1234
+ if r2
1235
+ s4, i4 = [], index
1236
+ loop do
1237
+ if has_terminal?('\G[\\S]', true, index)
1238
+ r5 = true
1239
+ @index += 1
1240
+ else
1241
+ r5 = nil
1242
+ end
1243
+ if r5
1244
+ s4 << r5
1245
+ else
1246
+ break
1247
+ end
1248
+ end
1249
+ if s4.empty?
1250
+ @index = i4
1251
+ r4 = nil
1252
+ else
1253
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1254
+ end
1255
+ s0 << r4
1256
+ if r4
1257
+ s6, i6 = [], index
1258
+ loop do
1259
+ r7 = _nt_ws
1260
+ if r7
1261
+ s6 << r7
1262
+ else
1263
+ break
1264
+ end
1265
+ end
1266
+ if s6.empty?
1267
+ @index = i6
1268
+ r6 = nil
1269
+ else
1270
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
1271
+ end
1272
+ s0 << r6
1273
+ end
1274
+ end
1275
+ end
1276
+ if s0.last
1277
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1278
+ r0.extend(Set0)
1279
+ r0.extend(Set1)
1280
+ else
1281
+ @index = i0
1282
+ r0 = nil
1283
+ end
1284
+
1285
+ node_cache[:set][start_index] = r0
1286
+
1287
+ r0
1288
+ end
1289
+
1290
+ module Command0
1291
+ def statement_start
1292
+ elements[0]
1293
+ end
1294
+
1295
+ def string
1296
+ elements[2]
1297
+ end
1298
+
1299
+ end
1300
+
1301
+ module Command1
1302
+ def to_config_statement(build_state)
1303
+ return build_state.new_command_statement(statement_start, string)
1304
+ end
1305
+ end
1306
+
1307
+ def _nt_command
1308
+ start_index = index
1309
+ if node_cache[:command].has_key?(index)
1310
+ cached = node_cache[:command][index]
1311
+ if cached
1312
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1313
+ @index = cached.interval.end
1314
+ end
1315
+ return cached
1316
+ end
1317
+
1318
+ i0, s0 = index, []
1319
+ if has_terminal?('command', false, index)
1320
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
1321
+ @index += 7
1322
+ else
1323
+ terminal_parse_failure('command')
1324
+ r1 = nil
1325
+ end
1326
+ s0 << r1
1327
+ if r1
1328
+ s2, i2 = [], index
1329
+ loop do
1330
+ r3 = _nt_ws
1331
+ if r3
1332
+ s2 << r3
1333
+ else
1334
+ break
1335
+ end
1336
+ end
1337
+ if s2.empty?
1338
+ @index = i2
1339
+ r2 = nil
1340
+ else
1341
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1342
+ end
1343
+ s0 << r2
1344
+ if r2
1345
+ r4 = _nt_string
1346
+ s0 << r4
1347
+ if r4
1348
+ s5, i5 = [], index
1349
+ loop do
1350
+ r6 = _nt_ws
1351
+ if r6
1352
+ s5 << r6
1353
+ else
1354
+ break
1355
+ end
1356
+ end
1357
+ if s5.empty?
1358
+ @index = i5
1359
+ r5 = nil
1360
+ else
1361
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1362
+ end
1363
+ s0 << r5
1364
+ end
1365
+ end
1366
+ end
1367
+ if s0.last
1368
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1369
+ r0.extend(Command0)
1370
+ r0.extend(Command1)
1371
+ else
1372
+ @index = i0
1373
+ r0 = nil
1374
+ end
1375
+
1376
+ node_cache[:command][start_index] = r0
1377
+
1378
+ r0
1379
+ end
1380
+
1381
+ module String0
1382
+ def value
1383
+ elements[1]
1384
+ end
1385
+
1386
+ end
1387
+
1388
+ def _nt_string
1389
+ start_index = index
1390
+ if node_cache[:string].has_key?(index)
1391
+ cached = node_cache[:string][index]
1392
+ if cached
1393
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1394
+ @index = cached.interval.end
1395
+ end
1396
+ return cached
1397
+ end
1398
+
1399
+ i0, s0 = index, []
1400
+ if has_terminal?('"', false, index)
1401
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
1402
+ @index += 1
1403
+ else
1404
+ terminal_parse_failure('"')
1405
+ r1 = nil
1406
+ end
1407
+ s0 << r1
1408
+ if r1
1409
+ s2, i2 = [], index
1410
+ loop do
1411
+ if has_terminal?('\G[^"]', true, index)
1412
+ r3 = true
1413
+ @index += 1
1414
+ else
1415
+ r3 = nil
1416
+ end
1417
+ if r3
1418
+ s2 << r3
1419
+ else
1420
+ break
1421
+ end
1422
+ end
1423
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1424
+ s0 << r2
1425
+ if r2
1426
+ if has_terminal?('"', false, index)
1427
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
1428
+ @index += 1
1429
+ else
1430
+ terminal_parse_failure('"')
1431
+ r4 = nil
1432
+ end
1433
+ s0 << r4
1434
+ end
1435
+ end
1436
+ if s0.last
1437
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1438
+ r0.extend(String0)
1439
+ else
1440
+ @index = i0
1441
+ r0 = nil
1442
+ end
1443
+
1444
+ node_cache[:string][start_index] = r0
1445
+
1446
+ r0
1447
+ end
1448
+
1449
+ def _nt_descriptor_string
1450
+ start_index = index
1451
+ if node_cache[:descriptor_string].has_key?(index)
1452
+ cached = node_cache[:descriptor_string][index]
1453
+ if cached
1454
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1455
+ @index = cached.interval.end
1456
+ end
1457
+ return cached
1458
+ end
1459
+
1460
+ s0, i0 = [], index
1461
+ loop do
1462
+ if has_terminal?('\G[\\S]', true, index)
1463
+ r1 = true
1464
+ @index += 1
1465
+ else
1466
+ r1 = nil
1467
+ end
1468
+ if r1
1469
+ s0 << r1
1470
+ else
1471
+ break
1472
+ end
1473
+ end
1474
+ if s0.empty?
1475
+ @index = i0
1476
+ r0 = nil
1477
+ else
1478
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1479
+ end
1480
+
1481
+ node_cache[:descriptor_string][start_index] = r0
1482
+
1483
+ r0
1484
+ end
1485
+
1486
+ end
1487
+
1488
+ class V0Parser < Treetop::Runtime::CompiledParser
1489
+ include V0
1490
+ end
1491
+
1492
+ end
1493
+ end