onion 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,53 @@
1
+ module Onion
2
+ grammar CircuitLists
3
+ include Common
4
+
5
+ rule circuit_list
6
+ circuit_list_entry+ {
7
+ def circuits
8
+ circuits = []
9
+ self.elements.each do |circuit|
10
+ if circuit.respond_to? :p
11
+ to_process = [circuit.p.first]
12
+ counter = 1
13
+ circuit.p.rest.elements.each do |e|
14
+ to_process << e.LongName
15
+ end
16
+ routers = []
17
+ to_process.each do |router|
18
+ if router.respond_to? :n
19
+ routers << Router.new(router.n.text_value.strip, router.f.text_value.strip, nil)
20
+ else
21
+ routers << Router.new(nil, nil, nil)
22
+ end
23
+ end
24
+ circuits << Circuit.new(circuit.id.text_value.strip, routers)
25
+ else
26
+ circuits << Circuit.new(circuit.id.text_value.strip, [])
27
+ end
28
+ end
29
+ return circuits
30
+ end
31
+ }
32
+ end
33
+
34
+ rule circuit_list_entry
35
+ id:CircuitID SP s:CircStatus SP p:Path SP "PURPOSE=" purp:Purpose "\n" /
36
+ id:CircuitID SP s:CircStatus SP p:Path "\n" /
37
+ id:CircuitID SP s:CircStatus "\n"
38
+ end
39
+
40
+ rule Path
41
+ first:LongName rest:("," LongName)*
42
+ end
43
+
44
+ rule CircStatus
45
+ "LAUNCHED" / "BUILT" / "EXTENDED" / "FAILED" / "CLOSED"
46
+ end
47
+
48
+ rule Purpose
49
+ "GENERAL" / "CONTROLER"
50
+ end
51
+
52
+ end
53
+ end
@@ -0,0 +1,1692 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ module Onion
5
+ module Common
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root ||= :Year
10
+ end
11
+
12
+ module Year0
13
+ end
14
+
15
+ def _nt_Year
16
+ start_index = index
17
+ if node_cache[:Year].has_key?(index)
18
+ cached = node_cache[:Year][index]
19
+ if cached
20
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
21
+ @index = cached.interval.end
22
+ end
23
+ return cached
24
+ end
25
+
26
+ i0, s0 = index, []
27
+ if has_terminal?('\G[0-9]', true, index)
28
+ r1 = true
29
+ @index += 1
30
+ else
31
+ r1 = nil
32
+ end
33
+ s0 << r1
34
+ if r1
35
+ if has_terminal?('\G[0-9]', true, index)
36
+ r2 = true
37
+ @index += 1
38
+ else
39
+ r2 = nil
40
+ end
41
+ s0 << r2
42
+ if r2
43
+ if has_terminal?('\G[0-9]', true, index)
44
+ r3 = true
45
+ @index += 1
46
+ else
47
+ r3 = nil
48
+ end
49
+ s0 << r3
50
+ if r3
51
+ if has_terminal?('\G[0-9]', true, index)
52
+ r4 = true
53
+ @index += 1
54
+ else
55
+ r4 = nil
56
+ end
57
+ s0 << r4
58
+ end
59
+ end
60
+ end
61
+ if s0.last
62
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
63
+ r0.extend(Year0)
64
+ else
65
+ @index = i0
66
+ r0 = nil
67
+ end
68
+
69
+ node_cache[:Year][start_index] = r0
70
+
71
+ r0
72
+ end
73
+
74
+ module Month0
75
+ end
76
+
77
+ module Month1
78
+ end
79
+
80
+ def _nt_Month
81
+ start_index = index
82
+ if node_cache[:Month].has_key?(index)
83
+ cached = node_cache[:Month][index]
84
+ if cached
85
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
86
+ @index = cached.interval.end
87
+ end
88
+ return cached
89
+ end
90
+
91
+ i0 = index
92
+ i1, s1 = index, []
93
+ if has_terminal?('\G[0]', true, index)
94
+ r2 = true
95
+ @index += 1
96
+ else
97
+ r2 = nil
98
+ end
99
+ s1 << r2
100
+ if r2
101
+ if has_terminal?('\G[1-9]', true, index)
102
+ r3 = true
103
+ @index += 1
104
+ else
105
+ r3 = nil
106
+ end
107
+ s1 << r3
108
+ end
109
+ if s1.last
110
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
111
+ r1.extend(Month0)
112
+ else
113
+ @index = i1
114
+ r1 = nil
115
+ end
116
+ if r1
117
+ r0 = r1
118
+ else
119
+ i4, s4 = index, []
120
+ if has_terminal?('\G[1]', true, index)
121
+ r5 = true
122
+ @index += 1
123
+ else
124
+ r5 = nil
125
+ end
126
+ s4 << r5
127
+ if r5
128
+ if has_terminal?('\G[0-2]', true, index)
129
+ r6 = true
130
+ @index += 1
131
+ else
132
+ r6 = nil
133
+ end
134
+ s4 << r6
135
+ end
136
+ if s4.last
137
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
138
+ r4.extend(Month1)
139
+ else
140
+ @index = i4
141
+ r4 = nil
142
+ end
143
+ if r4
144
+ r0 = r4
145
+ else
146
+ @index = i0
147
+ r0 = nil
148
+ end
149
+ end
150
+
151
+ node_cache[:Month][start_index] = r0
152
+
153
+ r0
154
+ end
155
+
156
+ module Day0
157
+ end
158
+
159
+ module Day1
160
+ end
161
+
162
+ def _nt_Day
163
+ start_index = index
164
+ if node_cache[:Day].has_key?(index)
165
+ cached = node_cache[:Day][index]
166
+ if cached
167
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
168
+ @index = cached.interval.end
169
+ end
170
+ return cached
171
+ end
172
+
173
+ i0 = index
174
+ i1, s1 = index, []
175
+ if has_terminal?('\G[0-2]', true, index)
176
+ r2 = true
177
+ @index += 1
178
+ else
179
+ r2 = nil
180
+ end
181
+ s1 << r2
182
+ if r2
183
+ if has_terminal?('\G[0-9]', true, index)
184
+ r3 = true
185
+ @index += 1
186
+ else
187
+ r3 = nil
188
+ end
189
+ s1 << r3
190
+ end
191
+ if s1.last
192
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
193
+ r1.extend(Day0)
194
+ else
195
+ @index = i1
196
+ r1 = nil
197
+ end
198
+ if r1
199
+ r0 = r1
200
+ else
201
+ i4, s4 = index, []
202
+ if has_terminal?('\G[3]', true, index)
203
+ r5 = true
204
+ @index += 1
205
+ else
206
+ r5 = nil
207
+ end
208
+ s4 << r5
209
+ if r5
210
+ if has_terminal?('\G[0-1]', true, index)
211
+ r6 = true
212
+ @index += 1
213
+ else
214
+ r6 = nil
215
+ end
216
+ s4 << r6
217
+ end
218
+ if s4.last
219
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
220
+ r4.extend(Day1)
221
+ else
222
+ @index = i4
223
+ r4 = nil
224
+ end
225
+ if r4
226
+ r0 = r4
227
+ else
228
+ @index = i0
229
+ r0 = nil
230
+ end
231
+ end
232
+
233
+ node_cache[:Day][start_index] = r0
234
+
235
+ r0
236
+ end
237
+
238
+ module Hour0
239
+ end
240
+
241
+ module Hour1
242
+ end
243
+
244
+ module Hour2
245
+ end
246
+
247
+ def _nt_Hour
248
+ start_index = index
249
+ if node_cache[:Hour].has_key?(index)
250
+ cached = node_cache[:Hour][index]
251
+ if cached
252
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
253
+ @index = cached.interval.end
254
+ end
255
+ return cached
256
+ end
257
+
258
+ i0 = index
259
+ i1, s1 = index, []
260
+ if has_terminal?('\G[0]', true, index)
261
+ r2 = true
262
+ @index += 1
263
+ else
264
+ r2 = nil
265
+ end
266
+ s1 << r2
267
+ if r2
268
+ if has_terminal?('\G[1-9]', true, index)
269
+ r3 = true
270
+ @index += 1
271
+ else
272
+ r3 = nil
273
+ end
274
+ s1 << r3
275
+ end
276
+ if s1.last
277
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
278
+ r1.extend(Hour0)
279
+ else
280
+ @index = i1
281
+ r1 = nil
282
+ end
283
+ if r1
284
+ r0 = r1
285
+ else
286
+ i4, s4 = index, []
287
+ if has_terminal?('\G[1]', true, index)
288
+ r5 = true
289
+ @index += 1
290
+ else
291
+ r5 = nil
292
+ end
293
+ s4 << r5
294
+ if r5
295
+ if has_terminal?('\G[0-9]', true, index)
296
+ r6 = true
297
+ @index += 1
298
+ else
299
+ r6 = nil
300
+ end
301
+ s4 << r6
302
+ end
303
+ if s4.last
304
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
305
+ r4.extend(Hour1)
306
+ else
307
+ @index = i4
308
+ r4 = nil
309
+ end
310
+ if r4
311
+ r0 = r4
312
+ else
313
+ i7, s7 = index, []
314
+ if has_terminal?('\G[2]', true, index)
315
+ r8 = true
316
+ @index += 1
317
+ else
318
+ r8 = nil
319
+ end
320
+ s7 << r8
321
+ if r8
322
+ if has_terminal?('\G[0-4]', true, index)
323
+ r9 = true
324
+ @index += 1
325
+ else
326
+ r9 = nil
327
+ end
328
+ s7 << r9
329
+ end
330
+ if s7.last
331
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
332
+ r7.extend(Hour2)
333
+ else
334
+ @index = i7
335
+ r7 = nil
336
+ end
337
+ if r7
338
+ r0 = r7
339
+ else
340
+ @index = i0
341
+ r0 = nil
342
+ end
343
+ end
344
+ end
345
+
346
+ node_cache[:Hour][start_index] = r0
347
+
348
+ r0
349
+ end
350
+
351
+ module Minute0
352
+ end
353
+
354
+ module Minute1
355
+ end
356
+
357
+ def _nt_Minute
358
+ start_index = index
359
+ if node_cache[:Minute].has_key?(index)
360
+ cached = node_cache[:Minute][index]
361
+ if cached
362
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
363
+ @index = cached.interval.end
364
+ end
365
+ return cached
366
+ end
367
+
368
+ i0 = index
369
+ i1, s1 = index, []
370
+ if has_terminal?('\G[0]', true, index)
371
+ r2 = true
372
+ @index += 1
373
+ else
374
+ r2 = nil
375
+ end
376
+ s1 << r2
377
+ if r2
378
+ if has_terminal?('\G[0-9]', true, index)
379
+ r3 = true
380
+ @index += 1
381
+ else
382
+ r3 = nil
383
+ end
384
+ s1 << r3
385
+ end
386
+ if s1.last
387
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
388
+ r1.extend(Minute0)
389
+ else
390
+ @index = i1
391
+ r1 = nil
392
+ end
393
+ if r1
394
+ r0 = r1
395
+ else
396
+ i4, s4 = index, []
397
+ if has_terminal?('\G[1-5]', true, index)
398
+ r5 = true
399
+ @index += 1
400
+ else
401
+ r5 = nil
402
+ end
403
+ s4 << r5
404
+ if r5
405
+ if has_terminal?('\G[0-9]', true, index)
406
+ r6 = true
407
+ @index += 1
408
+ else
409
+ r6 = nil
410
+ end
411
+ s4 << r6
412
+ end
413
+ if s4.last
414
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
415
+ r4.extend(Minute1)
416
+ else
417
+ @index = i4
418
+ r4 = nil
419
+ end
420
+ if r4
421
+ r0 = r4
422
+ else
423
+ @index = i0
424
+ r0 = nil
425
+ end
426
+ end
427
+
428
+ node_cache[:Minute][start_index] = r0
429
+
430
+ r0
431
+ end
432
+
433
+ module Second0
434
+ end
435
+
436
+ module Second1
437
+ end
438
+
439
+ def _nt_Second
440
+ start_index = index
441
+ if node_cache[:Second].has_key?(index)
442
+ cached = node_cache[:Second][index]
443
+ if cached
444
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
445
+ @index = cached.interval.end
446
+ end
447
+ return cached
448
+ end
449
+
450
+ i0 = index
451
+ i1, s1 = index, []
452
+ if has_terminal?('\G[0]', true, index)
453
+ r2 = true
454
+ @index += 1
455
+ else
456
+ r2 = nil
457
+ end
458
+ s1 << r2
459
+ if r2
460
+ if has_terminal?('\G[0-9]', true, index)
461
+ r3 = true
462
+ @index += 1
463
+ else
464
+ r3 = nil
465
+ end
466
+ s1 << r3
467
+ end
468
+ if s1.last
469
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
470
+ r1.extend(Second0)
471
+ else
472
+ @index = i1
473
+ r1 = nil
474
+ end
475
+ if r1
476
+ r0 = r1
477
+ else
478
+ i4, s4 = index, []
479
+ if has_terminal?('\G[1-5]', true, index)
480
+ r5 = true
481
+ @index += 1
482
+ else
483
+ r5 = nil
484
+ end
485
+ s4 << r5
486
+ if r5
487
+ if has_terminal?('\G[0-9]', true, index)
488
+ r6 = true
489
+ @index += 1
490
+ else
491
+ r6 = nil
492
+ end
493
+ s4 << r6
494
+ end
495
+ if s4.last
496
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
497
+ r4.extend(Second1)
498
+ else
499
+ @index = i4
500
+ r4 = nil
501
+ end
502
+ if r4
503
+ r0 = r4
504
+ else
505
+ @index = i0
506
+ r0 = nil
507
+ end
508
+ end
509
+
510
+ node_cache[:Second][start_index] = r0
511
+
512
+ r0
513
+ end
514
+
515
+ module DateTime0
516
+ def Year
517
+ elements[0]
518
+ end
519
+
520
+ def Month
521
+ elements[2]
522
+ end
523
+
524
+ def Day
525
+ elements[4]
526
+ end
527
+
528
+ def Hour
529
+ elements[6]
530
+ end
531
+
532
+ def Minute
533
+ elements[8]
534
+ end
535
+
536
+ def Second
537
+ elements[10]
538
+ end
539
+ end
540
+
541
+ def _nt_DateTime
542
+ start_index = index
543
+ if node_cache[:DateTime].has_key?(index)
544
+ cached = node_cache[:DateTime][index]
545
+ if cached
546
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
547
+ @index = cached.interval.end
548
+ end
549
+ return cached
550
+ end
551
+
552
+ i0, s0 = index, []
553
+ r1 = _nt_Year
554
+ s0 << r1
555
+ if r1
556
+ if has_terminal?("-", false, index)
557
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
558
+ @index += 1
559
+ else
560
+ terminal_parse_failure("-")
561
+ r2 = nil
562
+ end
563
+ s0 << r2
564
+ if r2
565
+ r3 = _nt_Month
566
+ s0 << r3
567
+ if r3
568
+ if has_terminal?("-", false, index)
569
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
570
+ @index += 1
571
+ else
572
+ terminal_parse_failure("-")
573
+ r4 = nil
574
+ end
575
+ s0 << r4
576
+ if r4
577
+ r5 = _nt_Day
578
+ s0 << r5
579
+ if r5
580
+ if has_terminal?(" ", false, index)
581
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
582
+ @index += 1
583
+ else
584
+ terminal_parse_failure(" ")
585
+ r6 = nil
586
+ end
587
+ s0 << r6
588
+ if r6
589
+ r7 = _nt_Hour
590
+ s0 << r7
591
+ if r7
592
+ if has_terminal?(":", false, index)
593
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
594
+ @index += 1
595
+ else
596
+ terminal_parse_failure(":")
597
+ r8 = nil
598
+ end
599
+ s0 << r8
600
+ if r8
601
+ r9 = _nt_Minute
602
+ s0 << r9
603
+ if r9
604
+ if has_terminal?(":", false, index)
605
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
606
+ @index += 1
607
+ else
608
+ terminal_parse_failure(":")
609
+ r10 = nil
610
+ end
611
+ s0 << r10
612
+ if r10
613
+ r11 = _nt_Second
614
+ s0 << r11
615
+ end
616
+ end
617
+ end
618
+ end
619
+ end
620
+ end
621
+ end
622
+ end
623
+ end
624
+ end
625
+ if s0.last
626
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
627
+ r0.extend(DateTime0)
628
+ else
629
+ @index = i0
630
+ r0 = nil
631
+ end
632
+
633
+ node_cache[:DateTime][start_index] = r0
634
+
635
+ r0
636
+ end
637
+
638
+ def _nt_Base64Char
639
+ start_index = index
640
+ if node_cache[:Base64Char].has_key?(index)
641
+ cached = node_cache[:Base64Char][index]
642
+ if cached
643
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
644
+ @index = cached.interval.end
645
+ end
646
+ return cached
647
+ end
648
+
649
+ if has_terminal?('\G[A-Za-z0-9+/]', true, index)
650
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
651
+ @index += 1
652
+ else
653
+ r0 = nil
654
+ end
655
+
656
+ node_cache[:Base64Char][start_index] = r0
657
+
658
+ r0
659
+ end
660
+
661
+ def _nt_Base64Hash
662
+ start_index = index
663
+ if node_cache[:Base64Hash].has_key?(index)
664
+ cached = node_cache[:Base64Hash][index]
665
+ if cached
666
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
667
+ @index = cached.interval.end
668
+ end
669
+ return cached
670
+ end
671
+
672
+ s0, i0 = [], index
673
+ loop do
674
+ r1 = _nt_Base64Char
675
+ if r1
676
+ s0 << r1
677
+ else
678
+ break
679
+ end
680
+ end
681
+ if s0.empty?
682
+ @index = i0
683
+ r0 = nil
684
+ else
685
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
686
+ end
687
+
688
+ node_cache[:Base64Hash][start_index] = r0
689
+
690
+ r0
691
+ end
692
+
693
+ module IPv4Byte0
694
+ end
695
+
696
+ module IPv4Byte1
697
+ end
698
+
699
+ module IPv4Byte2
700
+ end
701
+
702
+ module IPv4Byte3
703
+ end
704
+
705
+ def _nt_IPv4Byte
706
+ start_index = index
707
+ if node_cache[:IPv4Byte].has_key?(index)
708
+ cached = node_cache[:IPv4Byte][index]
709
+ if cached
710
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
711
+ @index = cached.interval.end
712
+ end
713
+ return cached
714
+ end
715
+
716
+ i0 = index
717
+ i1, s1 = index, []
718
+ if has_terminal?('\G[2]', true, index)
719
+ r2 = true
720
+ @index += 1
721
+ else
722
+ r2 = nil
723
+ end
724
+ s1 << r2
725
+ if r2
726
+ if has_terminal?('\G[5]', true, index)
727
+ r3 = true
728
+ @index += 1
729
+ else
730
+ r3 = nil
731
+ end
732
+ s1 << r3
733
+ if r3
734
+ if has_terminal?('\G[0-5]', true, index)
735
+ r4 = true
736
+ @index += 1
737
+ else
738
+ r4 = nil
739
+ end
740
+ s1 << r4
741
+ end
742
+ end
743
+ if s1.last
744
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
745
+ r1.extend(IPv4Byte0)
746
+ else
747
+ @index = i1
748
+ r1 = nil
749
+ end
750
+ if r1
751
+ r0 = r1
752
+ else
753
+ i5, s5 = index, []
754
+ if has_terminal?('\G[2]', true, index)
755
+ r6 = true
756
+ @index += 1
757
+ else
758
+ r6 = nil
759
+ end
760
+ s5 << r6
761
+ if r6
762
+ if has_terminal?('\G[0-4]', true, index)
763
+ r7 = true
764
+ @index += 1
765
+ else
766
+ r7 = nil
767
+ end
768
+ s5 << r7
769
+ if r7
770
+ if has_terminal?('\G[0-9]', true, index)
771
+ r8 = true
772
+ @index += 1
773
+ else
774
+ r8 = nil
775
+ end
776
+ s5 << r8
777
+ end
778
+ end
779
+ if s5.last
780
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
781
+ r5.extend(IPv4Byte1)
782
+ else
783
+ @index = i5
784
+ r5 = nil
785
+ end
786
+ if r5
787
+ r0 = r5
788
+ else
789
+ i9, s9 = index, []
790
+ if has_terminal?('\G[1]', true, index)
791
+ r10 = true
792
+ @index += 1
793
+ else
794
+ r10 = nil
795
+ end
796
+ s9 << r10
797
+ if r10
798
+ if has_terminal?('\G[0-9]', true, index)
799
+ r11 = true
800
+ @index += 1
801
+ else
802
+ r11 = nil
803
+ end
804
+ s9 << r11
805
+ if r11
806
+ if has_terminal?('\G[0-9]', true, index)
807
+ r12 = true
808
+ @index += 1
809
+ else
810
+ r12 = nil
811
+ end
812
+ s9 << r12
813
+ end
814
+ end
815
+ if s9.last
816
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
817
+ r9.extend(IPv4Byte2)
818
+ else
819
+ @index = i9
820
+ r9 = nil
821
+ end
822
+ if r9
823
+ r0 = r9
824
+ else
825
+ i13, s13 = index, []
826
+ if has_terminal?('\G[1-9]', true, index)
827
+ r14 = true
828
+ @index += 1
829
+ else
830
+ r14 = nil
831
+ end
832
+ s13 << r14
833
+ if r14
834
+ if has_terminal?('\G[0-9]', true, index)
835
+ r15 = true
836
+ @index += 1
837
+ else
838
+ r15 = nil
839
+ end
840
+ s13 << r15
841
+ end
842
+ if s13.last
843
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
844
+ r13.extend(IPv4Byte3)
845
+ else
846
+ @index = i13
847
+ r13 = nil
848
+ end
849
+ if r13
850
+ r0 = r13
851
+ else
852
+ if has_terminal?('\G[0-9]', true, index)
853
+ r16 = true
854
+ @index += 1
855
+ else
856
+ r16 = nil
857
+ end
858
+ if r16
859
+ r0 = r16
860
+ else
861
+ @index = i0
862
+ r0 = nil
863
+ end
864
+ end
865
+ end
866
+ end
867
+ end
868
+
869
+ node_cache[:IPv4Byte][start_index] = r0
870
+
871
+ r0
872
+ end
873
+
874
+ module IPv4Address0
875
+ def IPv4Byte1
876
+ elements[0]
877
+ end
878
+
879
+ def IPv4Byte2
880
+ elements[2]
881
+ end
882
+
883
+ def IPv4Byte3
884
+ elements[4]
885
+ end
886
+
887
+ def IPv4Byte4
888
+ elements[6]
889
+ end
890
+ end
891
+
892
+ def _nt_IPv4Address
893
+ start_index = index
894
+ if node_cache[:IPv4Address].has_key?(index)
895
+ cached = node_cache[:IPv4Address][index]
896
+ if cached
897
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
898
+ @index = cached.interval.end
899
+ end
900
+ return cached
901
+ end
902
+
903
+ i0, s0 = index, []
904
+ r1 = _nt_IPv4Byte
905
+ s0 << r1
906
+ if r1
907
+ if has_terminal?(".", false, index)
908
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
909
+ @index += 1
910
+ else
911
+ terminal_parse_failure(".")
912
+ r2 = nil
913
+ end
914
+ s0 << r2
915
+ if r2
916
+ r3 = _nt_IPv4Byte
917
+ s0 << r3
918
+ if r3
919
+ if has_terminal?(".", false, index)
920
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
921
+ @index += 1
922
+ else
923
+ terminal_parse_failure(".")
924
+ r4 = nil
925
+ end
926
+ s0 << r4
927
+ if r4
928
+ r5 = _nt_IPv4Byte
929
+ s0 << r5
930
+ if r5
931
+ if has_terminal?(".", false, index)
932
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
933
+ @index += 1
934
+ else
935
+ terminal_parse_failure(".")
936
+ r6 = nil
937
+ end
938
+ s0 << r6
939
+ if r6
940
+ r7 = _nt_IPv4Byte
941
+ s0 << r7
942
+ end
943
+ end
944
+ end
945
+ end
946
+ end
947
+ end
948
+ if s0.last
949
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
950
+ r0.extend(IPv4Address0)
951
+ else
952
+ @index = i0
953
+ r0 = nil
954
+ end
955
+
956
+ node_cache[:IPv4Address][start_index] = r0
957
+
958
+ r0
959
+ end
960
+
961
+ def _nt_IP
962
+ start_index = index
963
+ if node_cache[:IP].has_key?(index)
964
+ cached = node_cache[:IP][index]
965
+ if cached
966
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
967
+ @index = cached.interval.end
968
+ end
969
+ return cached
970
+ end
971
+
972
+ r0 = _nt_IPv4Address
973
+
974
+ node_cache[:IP][start_index] = r0
975
+
976
+ r0
977
+ end
978
+
979
+ def _nt_Hostname
980
+ start_index = index
981
+ if node_cache[:Hostname].has_key?(index)
982
+ cached = node_cache[:Hostname][index]
983
+ if cached
984
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
985
+ @index = cached.interval.end
986
+ end
987
+ return cached
988
+ end
989
+
990
+ s0, i0 = [], index
991
+ loop do
992
+ if has_terminal?('\G[a-zA-Z\\.\\-]', true, index)
993
+ r1 = true
994
+ @index += 1
995
+ else
996
+ r1 = nil
997
+ end
998
+ if r1
999
+ s0 << r1
1000
+ else
1001
+ break
1002
+ end
1003
+ end
1004
+ if s0.empty?
1005
+ @index = i0
1006
+ r0 = nil
1007
+ else
1008
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1009
+ end
1010
+
1011
+ node_cache[:Hostname][start_index] = r0
1012
+
1013
+ r0
1014
+ end
1015
+
1016
+ def _nt_Address
1017
+ start_index = index
1018
+ if node_cache[:Address].has_key?(index)
1019
+ cached = node_cache[:Address][index]
1020
+ if cached
1021
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1022
+ @index = cached.interval.end
1023
+ end
1024
+ return cached
1025
+ end
1026
+
1027
+ i0 = index
1028
+ r1 = _nt_Hostname
1029
+ if r1
1030
+ r0 = r1
1031
+ else
1032
+ r2 = _nt_IP
1033
+ if r2
1034
+ r0 = r2
1035
+ else
1036
+ @index = i0
1037
+ r0 = nil
1038
+ end
1039
+ end
1040
+
1041
+ node_cache[:Address][start_index] = r0
1042
+
1043
+ r0
1044
+ end
1045
+
1046
+ def _nt_Port
1047
+ start_index = index
1048
+ if node_cache[:Port].has_key?(index)
1049
+ cached = node_cache[:Port][index]
1050
+ if cached
1051
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1052
+ @index = cached.interval.end
1053
+ end
1054
+ return cached
1055
+ end
1056
+
1057
+ s0, i0 = [], index
1058
+ loop do
1059
+ if has_terminal?('\G[0-9]', true, index)
1060
+ r1 = true
1061
+ @index += 1
1062
+ else
1063
+ r1 = nil
1064
+ end
1065
+ if r1
1066
+ s0 << r1
1067
+ else
1068
+ break
1069
+ end
1070
+ end
1071
+ if s0.empty?
1072
+ @index = i0
1073
+ r0 = nil
1074
+ else
1075
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1076
+ end
1077
+
1078
+ node_cache[:Port][start_index] = r0
1079
+
1080
+ r0
1081
+ end
1082
+
1083
+ def _nt_ORPort
1084
+ start_index = index
1085
+ if node_cache[:ORPort].has_key?(index)
1086
+ cached = node_cache[:ORPort][index]
1087
+ if cached
1088
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1089
+ @index = cached.interval.end
1090
+ end
1091
+ return cached
1092
+ end
1093
+
1094
+ r0 = _nt_Port
1095
+
1096
+ node_cache[:ORPort][start_index] = r0
1097
+
1098
+ r0
1099
+ end
1100
+
1101
+ def _nt_DirPort
1102
+ start_index = index
1103
+ if node_cache[:DirPort].has_key?(index)
1104
+ cached = node_cache[:DirPort][index]
1105
+ if cached
1106
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1107
+ @index = cached.interval.end
1108
+ end
1109
+ return cached
1110
+ end
1111
+
1112
+ r0 = _nt_Port
1113
+
1114
+ node_cache[:DirPort][start_index] = r0
1115
+
1116
+ r0
1117
+ end
1118
+
1119
+ def _nt_SP
1120
+ start_index = index
1121
+ if node_cache[:SP].has_key?(index)
1122
+ cached = node_cache[:SP][index]
1123
+ if cached
1124
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1125
+ @index = cached.interval.end
1126
+ end
1127
+ return cached
1128
+ end
1129
+
1130
+ if has_terminal?(" ", false, index)
1131
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
1132
+ @index += 1
1133
+ else
1134
+ terminal_parse_failure(" ")
1135
+ r0 = nil
1136
+ end
1137
+
1138
+ node_cache[:SP][start_index] = r0
1139
+
1140
+ r0
1141
+ end
1142
+
1143
+ def _nt_NL
1144
+ start_index = index
1145
+ if node_cache[:NL].has_key?(index)
1146
+ cached = node_cache[:NL][index]
1147
+ if cached
1148
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1149
+ @index = cached.interval.end
1150
+ end
1151
+ return cached
1152
+ end
1153
+
1154
+ if has_terminal?("\r\n", false, index)
1155
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 2))
1156
+ @index += 2
1157
+ else
1158
+ terminal_parse_failure("\r\n")
1159
+ r0 = nil
1160
+ end
1161
+
1162
+ node_cache[:NL][start_index] = r0
1163
+
1164
+ r0
1165
+ end
1166
+
1167
+ def _nt_ALPHA
1168
+ start_index = index
1169
+ if node_cache[:ALPHA].has_key?(index)
1170
+ cached = node_cache[:ALPHA][index]
1171
+ if cached
1172
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1173
+ @index = cached.interval.end
1174
+ end
1175
+ return cached
1176
+ end
1177
+
1178
+ i0 = index
1179
+ if has_terminal?('\G[A-Z]', true, index)
1180
+ r1 = true
1181
+ @index += 1
1182
+ else
1183
+ r1 = nil
1184
+ end
1185
+ if r1
1186
+ r0 = r1
1187
+ else
1188
+ if has_terminal?('\G[a-z]', true, index)
1189
+ r2 = true
1190
+ @index += 1
1191
+ else
1192
+ r2 = nil
1193
+ end
1194
+ if r2
1195
+ r0 = r2
1196
+ else
1197
+ @index = i0
1198
+ r0 = nil
1199
+ end
1200
+ end
1201
+
1202
+ node_cache[:ALPHA][start_index] = r0
1203
+
1204
+ r0
1205
+ end
1206
+
1207
+ def _nt_DIGIT
1208
+ start_index = index
1209
+ if node_cache[:DIGIT].has_key?(index)
1210
+ cached = node_cache[:DIGIT][index]
1211
+ if cached
1212
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1213
+ @index = cached.interval.end
1214
+ end
1215
+ return cached
1216
+ end
1217
+
1218
+ if has_terminal?('\G[0-9]', true, index)
1219
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
1220
+ @index += 1
1221
+ else
1222
+ r0 = nil
1223
+ end
1224
+
1225
+ node_cache[:DIGIT][start_index] = r0
1226
+
1227
+ r0
1228
+ end
1229
+
1230
+ def _nt_HEXDIG
1231
+ start_index = index
1232
+ if node_cache[:HEXDIG].has_key?(index)
1233
+ cached = node_cache[:HEXDIG][index]
1234
+ if cached
1235
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1236
+ @index = cached.interval.end
1237
+ end
1238
+ return cached
1239
+ end
1240
+
1241
+ i0 = index
1242
+ r1 = _nt_DIGIT
1243
+ if r1
1244
+ r0 = r1
1245
+ else
1246
+ if has_terminal?("A", false, index)
1247
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
1248
+ @index += 1
1249
+ else
1250
+ terminal_parse_failure("A")
1251
+ r2 = nil
1252
+ end
1253
+ if r2
1254
+ r0 = r2
1255
+ else
1256
+ if has_terminal?("B", false, index)
1257
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1258
+ @index += 1
1259
+ else
1260
+ terminal_parse_failure("B")
1261
+ r3 = nil
1262
+ end
1263
+ if r3
1264
+ r0 = r3
1265
+ else
1266
+ if has_terminal?("C", false, index)
1267
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
1268
+ @index += 1
1269
+ else
1270
+ terminal_parse_failure("C")
1271
+ r4 = nil
1272
+ end
1273
+ if r4
1274
+ r0 = r4
1275
+ else
1276
+ if has_terminal?("D", false, index)
1277
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
1278
+ @index += 1
1279
+ else
1280
+ terminal_parse_failure("D")
1281
+ r5 = nil
1282
+ end
1283
+ if r5
1284
+ r0 = r5
1285
+ else
1286
+ if has_terminal?("E", false, index)
1287
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
1288
+ @index += 1
1289
+ else
1290
+ terminal_parse_failure("E")
1291
+ r6 = nil
1292
+ end
1293
+ if r6
1294
+ r0 = r6
1295
+ else
1296
+ if has_terminal?("F", false, index)
1297
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
1298
+ @index += 1
1299
+ else
1300
+ terminal_parse_failure("F")
1301
+ r7 = nil
1302
+ end
1303
+ if r7
1304
+ r0 = r7
1305
+ else
1306
+ @index = i0
1307
+ r0 = nil
1308
+ end
1309
+ end
1310
+ end
1311
+ end
1312
+ end
1313
+ end
1314
+ end
1315
+
1316
+ node_cache[:HEXDIG][start_index] = r0
1317
+
1318
+ r0
1319
+ end
1320
+
1321
+ def _nt_IDChar
1322
+ start_index = index
1323
+ if node_cache[:IDChar].has_key?(index)
1324
+ cached = node_cache[:IDChar][index]
1325
+ if cached
1326
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1327
+ @index = cached.interval.end
1328
+ end
1329
+ return cached
1330
+ end
1331
+
1332
+ i0 = index
1333
+ r1 = _nt_ALPHA
1334
+ if r1
1335
+ r0 = r1
1336
+ else
1337
+ r2 = _nt_DIGIT
1338
+ if r2
1339
+ r0 = r2
1340
+ else
1341
+ @index = i0
1342
+ r0 = nil
1343
+ end
1344
+ end
1345
+
1346
+ node_cache[:IDChar][start_index] = r0
1347
+
1348
+ r0
1349
+ end
1350
+
1351
+ def _nt_NicknameChar
1352
+ start_index = index
1353
+ if node_cache[:NicknameChar].has_key?(index)
1354
+ cached = node_cache[:NicknameChar][index]
1355
+ if cached
1356
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1357
+ @index = cached.interval.end
1358
+ end
1359
+ return cached
1360
+ end
1361
+
1362
+ i0 = index
1363
+ if has_terminal?('\G[A-Z]', true, index)
1364
+ r1 = true
1365
+ @index += 1
1366
+ else
1367
+ r1 = nil
1368
+ end
1369
+ if r1
1370
+ r0 = r1
1371
+ else
1372
+ if has_terminal?('\G[a-z]', true, index)
1373
+ r2 = true
1374
+ @index += 1
1375
+ else
1376
+ r2 = nil
1377
+ end
1378
+ if r2
1379
+ r0 = r2
1380
+ else
1381
+ if has_terminal?('\G[0-9]', true, index)
1382
+ r3 = true
1383
+ @index += 1
1384
+ else
1385
+ r3 = nil
1386
+ end
1387
+ if r3
1388
+ r0 = r3
1389
+ else
1390
+ @index = i0
1391
+ r0 = nil
1392
+ end
1393
+ end
1394
+ end
1395
+
1396
+ node_cache[:NicknameChar][start_index] = r0
1397
+
1398
+ r0
1399
+ end
1400
+
1401
+ def _nt_Nickname
1402
+ start_index = index
1403
+ if node_cache[:Nickname].has_key?(index)
1404
+ cached = node_cache[:Nickname][index]
1405
+ if cached
1406
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1407
+ @index = cached.interval.end
1408
+ end
1409
+ return cached
1410
+ end
1411
+
1412
+ s0, i0 = [], index
1413
+ loop do
1414
+ r1 = _nt_NicknameChar
1415
+ if r1
1416
+ s0 << r1
1417
+ else
1418
+ break
1419
+ end
1420
+ if s0.size == 19
1421
+ break
1422
+ end
1423
+ end
1424
+ if s0.size < 1
1425
+ @index = i0
1426
+ r0 = nil
1427
+ else
1428
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1429
+ end
1430
+
1431
+ node_cache[:Nickname][start_index] = r0
1432
+
1433
+ r0
1434
+ end
1435
+
1436
+ module Fingerprint0
1437
+ end
1438
+
1439
+ def _nt_Fingerprint
1440
+ start_index = index
1441
+ if node_cache[:Fingerprint].has_key?(index)
1442
+ cached = node_cache[:Fingerprint][index]
1443
+ if cached
1444
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1445
+ @index = cached.interval.end
1446
+ end
1447
+ return cached
1448
+ end
1449
+
1450
+ i0, s0 = index, []
1451
+ if has_terminal?("$", false, index)
1452
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
1453
+ @index += 1
1454
+ else
1455
+ terminal_parse_failure("$")
1456
+ r1 = nil
1457
+ end
1458
+ s0 << r1
1459
+ if r1
1460
+ s2, i2 = [], index
1461
+ loop do
1462
+ r3 = _nt_HEXDIG
1463
+ if r3
1464
+ s2 << r3
1465
+ else
1466
+ break
1467
+ end
1468
+ if s2.size == 40
1469
+ break
1470
+ end
1471
+ end
1472
+ if s2.size < 40
1473
+ @index = i2
1474
+ r2 = nil
1475
+ else
1476
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1477
+ end
1478
+ s0 << r2
1479
+ end
1480
+ if s0.last
1481
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1482
+ r0.extend(Fingerprint0)
1483
+ else
1484
+ @index = i0
1485
+ r0 = nil
1486
+ end
1487
+
1488
+ node_cache[:Fingerprint][start_index] = r0
1489
+
1490
+ r0
1491
+ end
1492
+
1493
+ def _nt_ServerID
1494
+ start_index = index
1495
+ if node_cache[:ServerID].has_key?(index)
1496
+ cached = node_cache[:ServerID][index]
1497
+ if cached
1498
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1499
+ @index = cached.interval.end
1500
+ end
1501
+ return cached
1502
+ end
1503
+
1504
+ i0 = index
1505
+ r1 = _nt_Nickname
1506
+ if r1
1507
+ r0 = r1
1508
+ else
1509
+ r2 = _nt_Fingerprint
1510
+ if r2
1511
+ r0 = r2
1512
+ else
1513
+ @index = i0
1514
+ r0 = nil
1515
+ end
1516
+ end
1517
+
1518
+ node_cache[:ServerID][start_index] = r0
1519
+
1520
+ r0
1521
+ end
1522
+
1523
+ module LongName0
1524
+ def f
1525
+ elements[0]
1526
+ end
1527
+
1528
+ def n
1529
+ elements[2]
1530
+ end
1531
+ end
1532
+
1533
+ def _nt_LongName
1534
+ start_index = index
1535
+ if node_cache[:LongName].has_key?(index)
1536
+ cached = node_cache[:LongName][index]
1537
+ if cached
1538
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1539
+ @index = cached.interval.end
1540
+ end
1541
+ return cached
1542
+ end
1543
+
1544
+ i0 = index
1545
+ i1, s1 = index, []
1546
+ r2 = _nt_Fingerprint
1547
+ s1 << r2
1548
+ if r2
1549
+ if has_terminal?("=", false, index)
1550
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
1551
+ @index += 1
1552
+ else
1553
+ terminal_parse_failure("=")
1554
+ r3 = nil
1555
+ end
1556
+ s1 << r3
1557
+ if r3
1558
+ r4 = _nt_Nickname
1559
+ s1 << r4
1560
+ end
1561
+ end
1562
+ if s1.last
1563
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1564
+ r1.extend(LongName0)
1565
+ else
1566
+ @index = i1
1567
+ r1 = nil
1568
+ end
1569
+ if r1
1570
+ r0 = r1
1571
+ else
1572
+ r5 = _nt_Fingerprint
1573
+ if r5
1574
+ r0 = r5
1575
+ else
1576
+ @index = i0
1577
+ r0 = nil
1578
+ end
1579
+ end
1580
+
1581
+ node_cache[:LongName][start_index] = r0
1582
+
1583
+ r0
1584
+ end
1585
+
1586
+ def _nt_ServerSpec
1587
+ start_index = index
1588
+ if node_cache[:ServerSpec].has_key?(index)
1589
+ cached = node_cache[:ServerSpec][index]
1590
+ if cached
1591
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1592
+ @index = cached.interval.end
1593
+ end
1594
+ return cached
1595
+ end
1596
+
1597
+ i0 = index
1598
+ r1 = _nt_LongName
1599
+ if r1
1600
+ r0 = r1
1601
+ else
1602
+ r2 = _nt_Nickname
1603
+ if r2
1604
+ r0 = r2
1605
+ else
1606
+ @index = i0
1607
+ r0 = nil
1608
+ end
1609
+ end
1610
+
1611
+ node_cache[:ServerSpec][start_index] = r0
1612
+
1613
+ r0
1614
+ end
1615
+
1616
+ def _nt_StreamID
1617
+ start_index = index
1618
+ if node_cache[:StreamID].has_key?(index)
1619
+ cached = node_cache[:StreamID][index]
1620
+ if cached
1621
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1622
+ @index = cached.interval.end
1623
+ end
1624
+ return cached
1625
+ end
1626
+
1627
+ s0, i0 = [], index
1628
+ loop do
1629
+ r1 = _nt_IDChar
1630
+ if r1
1631
+ s0 << r1
1632
+ else
1633
+ break
1634
+ end
1635
+ if s0.size == 16
1636
+ break
1637
+ end
1638
+ end
1639
+ if s0.size < 1
1640
+ @index = i0
1641
+ r0 = nil
1642
+ else
1643
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1644
+ end
1645
+
1646
+ node_cache[:StreamID][start_index] = r0
1647
+
1648
+ r0
1649
+ end
1650
+
1651
+ def _nt_CircuitID
1652
+ start_index = index
1653
+ if node_cache[:CircuitID].has_key?(index)
1654
+ cached = node_cache[:CircuitID][index]
1655
+ if cached
1656
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1657
+ @index = cached.interval.end
1658
+ end
1659
+ return cached
1660
+ end
1661
+
1662
+ s0, i0 = [], index
1663
+ loop do
1664
+ r1 = _nt_IDChar
1665
+ if r1
1666
+ s0 << r1
1667
+ else
1668
+ break
1669
+ end
1670
+ if s0.size == 16
1671
+ break
1672
+ end
1673
+ end
1674
+ if s0.size < 1
1675
+ @index = i0
1676
+ r0 = nil
1677
+ else
1678
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1679
+ end
1680
+
1681
+ node_cache[:CircuitID][start_index] = r0
1682
+
1683
+ r0
1684
+ end
1685
+
1686
+ end
1687
+
1688
+ class CommonParser < Treetop::Runtime::CompiledParser
1689
+ include Common
1690
+ end
1691
+
1692
+ end