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,127 @@
1
+ module Onion
2
+ grammar Common
3
+ rule Year
4
+ [0-9] [0-9] [0-9] [0-9]
5
+ end
6
+
7
+ rule Month
8
+ [0] [1-9] / [1] [0-2]
9
+ end
10
+
11
+ rule Day
12
+ [0-2] [0-9] / [3] [0-1]
13
+ end
14
+
15
+ rule Hour
16
+ [0] [1-9] / [1] [0-9] / [2] [0-4]
17
+ end
18
+
19
+ rule Minute
20
+ [0] [0-9] / [1-5] [0-9]
21
+ end
22
+
23
+ rule Second
24
+ [0] [0-9] / [1-5] [0-9]
25
+ end
26
+
27
+ rule DateTime
28
+ Year "-" Month "-" Day " " Hour ":" Minute ":" Second
29
+ end
30
+
31
+ rule Base64Char
32
+ [A-Za-z0-9+/]
33
+ end
34
+
35
+ rule Base64Hash
36
+ Base64Char+
37
+ end
38
+
39
+ rule IPv4Byte
40
+ [2] [5] [0-5] / [2] [0-4] [0-9] / [1] [0-9] [0-9] / [1-9] [0-9] / [0-9]
41
+ end
42
+
43
+ rule IPv4Address
44
+ IPv4Byte "." IPv4Byte "." IPv4Byte "." IPv4Byte
45
+ end
46
+
47
+ rule IP
48
+ IPv4Address
49
+ end
50
+
51
+ rule Hostname
52
+ [a-zA-Z\.\-]+ # TODO: Wow this is a garbage production....
53
+ end
54
+
55
+ rule Address
56
+ Hostname / IP
57
+ end
58
+
59
+ rule Port
60
+ [0-9]+
61
+ end
62
+
63
+ rule ORPort
64
+ Port
65
+ end
66
+
67
+ rule DirPort
68
+ Port
69
+ end
70
+
71
+ rule SP
72
+ " "
73
+ end
74
+
75
+ rule NL
76
+ "\r\n"
77
+ end
78
+
79
+ rule ALPHA
80
+ [A-Z] / [a-z]
81
+ end
82
+
83
+ rule DIGIT
84
+ [0-9]
85
+ end
86
+
87
+ rule HEXDIG
88
+ DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
89
+ end
90
+
91
+ rule IDChar
92
+ ALPHA / DIGIT
93
+ end
94
+
95
+ rule NicknameChar
96
+ [A-Z] / [a-z] / [0-9]
97
+ end
98
+
99
+ rule Nickname
100
+ NicknameChar 1..19
101
+ end
102
+
103
+ rule Fingerprint
104
+ "$" HEXDIG 40..40
105
+ end
106
+
107
+ rule ServerID
108
+ Nickname / Fingerprint
109
+ end
110
+
111
+ rule LongName
112
+ f:Fingerprint "=" n:Nickname / Fingerprint
113
+ end
114
+
115
+ rule ServerSpec
116
+ LongName / Nickname
117
+ end
118
+
119
+ rule StreamID
120
+ IDChar 1..16
121
+ end
122
+
123
+ rule CircuitID
124
+ IDChar 1..16
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,1035 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ module Onion
5
+ module RouterStatuses
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root ||= :router_statuses
10
+ end
11
+
12
+ include Common
13
+
14
+ module RouterStatuses0
15
+ def routers
16
+ routers = []
17
+ self.elements.each do |entry|
18
+ unless entry.extension_modules.join.include?("Error")
19
+ if entry.extra_info.elements != []
20
+ entry.extra_info.elements.each do |info|
21
+ # TODO: Is there a better way to differeniate between extra info?
22
+ if info.extension_modules.join.include?("::Status")
23
+ routers << Router.new(entry.r.nick, entry.r.fingerprint, info.flags)
24
+ end
25
+ end
26
+ else
27
+ routers << Router.new(entry.r.nick, entry.r.fingerprint, nil)
28
+ end
29
+ end
30
+ end
31
+ return routers
32
+ end
33
+ end
34
+
35
+ def _nt_router_statuses
36
+ start_index = index
37
+ if node_cache[:router_statuses].has_key?(index)
38
+ cached = node_cache[:router_statuses][index]
39
+ if cached
40
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
41
+ @index = cached.interval.end
42
+ end
43
+ return cached
44
+ end
45
+
46
+ s0, i0 = [], index
47
+ loop do
48
+ i1 = index
49
+ r2 = _nt_getinfo_error_response
50
+ if r2
51
+ r1 = r2
52
+ else
53
+ r3 = _nt_router_status
54
+ if r3
55
+ r1 = r3
56
+ else
57
+ @index = i1
58
+ r1 = nil
59
+ end
60
+ end
61
+ if r1
62
+ s0 << r1
63
+ else
64
+ break
65
+ end
66
+ end
67
+ if s0.empty?
68
+ @index = i0
69
+ r0 = nil
70
+ else
71
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
72
+ r0.extend(RouterStatuses0)
73
+ end
74
+
75
+ node_cache[:router_statuses][start_index] = r0
76
+
77
+ r0
78
+ end
79
+
80
+ module GetinfoErrorResponse0
81
+ def NL
82
+ elements[2]
83
+ end
84
+ end
85
+
86
+ def _nt_getinfo_error_response
87
+ start_index = index
88
+ if node_cache[:getinfo_error_response].has_key?(index)
89
+ cached = node_cache[:getinfo_error_response][index]
90
+ if cached
91
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
92
+ @index = cached.interval.end
93
+ end
94
+ return cached
95
+ end
96
+
97
+ i0, s0 = index, []
98
+ if has_terminal?("552", false, index)
99
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
100
+ @index += 3
101
+ else
102
+ terminal_parse_failure("552")
103
+ r1 = nil
104
+ end
105
+ s0 << r1
106
+ if r1
107
+ s2, i2 = [], index
108
+ loop do
109
+ if has_terminal?('\G[ /0-9a-zA-Z\\-=,"]', true, index)
110
+ r3 = true
111
+ @index += 1
112
+ else
113
+ r3 = nil
114
+ end
115
+ if r3
116
+ s2 << r3
117
+ else
118
+ break
119
+ end
120
+ end
121
+ if s2.empty?
122
+ @index = i2
123
+ r2 = nil
124
+ else
125
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
126
+ end
127
+ s0 << r2
128
+ if r2
129
+ r4 = _nt_NL
130
+ s0 << r4
131
+ end
132
+ end
133
+ if s0.last
134
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
135
+ r0.extend(GetinfoErrorResponse0)
136
+ else
137
+ @index = i0
138
+ r0 = nil
139
+ end
140
+
141
+ node_cache[:getinfo_error_response][start_index] = r0
142
+
143
+ r0
144
+ end
145
+
146
+ def _nt_command_ack
147
+ start_index = index
148
+ if node_cache[:command_ack].has_key?(index)
149
+ cached = node_cache[:command_ack][index]
150
+ if cached
151
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
152
+ @index = cached.interval.end
153
+ end
154
+ return cached
155
+ end
156
+
157
+ if has_terminal?("250 OK\r\n", false, index)
158
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 8))
159
+ @index += 8
160
+ else
161
+ terminal_parse_failure("250 OK\r\n")
162
+ r0 = nil
163
+ end
164
+
165
+ node_cache[:command_ack][start_index] = r0
166
+
167
+ r0
168
+ end
169
+
170
+ module ResponseStart0
171
+ end
172
+
173
+ def _nt_response_start
174
+ start_index = index
175
+ if node_cache[:response_start].has_key?(index)
176
+ cached = node_cache[:response_start][index]
177
+ if cached
178
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
179
+ @index = cached.interval.end
180
+ end
181
+ return cached
182
+ end
183
+
184
+ i0, s0 = index, []
185
+ if has_terminal?("250+", false, index)
186
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
187
+ @index += 4
188
+ else
189
+ terminal_parse_failure("250+")
190
+ r1 = nil
191
+ end
192
+ s0 << r1
193
+ if r1
194
+ s2, i2 = [], index
195
+ loop do
196
+ if has_terminal?('\G[/0-9a-zA-Z]', true, index)
197
+ r3 = true
198
+ @index += 1
199
+ else
200
+ r3 = nil
201
+ end
202
+ if r3
203
+ s2 << r3
204
+ else
205
+ break
206
+ end
207
+ end
208
+ if s2.empty?
209
+ @index = i2
210
+ r2 = nil
211
+ else
212
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
213
+ end
214
+ s0 << r2
215
+ if r2
216
+ if has_terminal?("=\r\n", false, index)
217
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
218
+ @index += 3
219
+ else
220
+ terminal_parse_failure("=\r\n")
221
+ r4 = nil
222
+ end
223
+ s0 << r4
224
+ end
225
+ end
226
+ if s0.last
227
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
228
+ r0.extend(ResponseStart0)
229
+ else
230
+ @index = i0
231
+ r0 = nil
232
+ end
233
+
234
+ node_cache[:response_start][start_index] = r0
235
+
236
+ r0
237
+ end
238
+
239
+ def _nt_response_end
240
+ start_index = index
241
+ if node_cache[:response_end].has_key?(index)
242
+ cached = node_cache[:response_end][index]
243
+ if cached
244
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
245
+ @index = cached.interval.end
246
+ end
247
+ return cached
248
+ end
249
+
250
+ if has_terminal?(".\r\n", false, index)
251
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 3))
252
+ @index += 3
253
+ else
254
+ terminal_parse_failure(".\r\n")
255
+ r0 = nil
256
+ end
257
+
258
+ node_cache[:response_end][start_index] = r0
259
+
260
+ r0
261
+ end
262
+
263
+ module RouterStatus0
264
+ def response_start
265
+ elements[0]
266
+ end
267
+
268
+ def r
269
+ elements[1]
270
+ end
271
+
272
+ def extra_info
273
+ elements[2]
274
+ end
275
+
276
+ def response_end
277
+ elements[3]
278
+ end
279
+
280
+ def command_ack
281
+ elements[4]
282
+ end
283
+ end
284
+
285
+ def _nt_router_status
286
+ start_index = index
287
+ if node_cache[:router_status].has_key?(index)
288
+ cached = node_cache[:router_status][index]
289
+ if cached
290
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
291
+ @index = cached.interval.end
292
+ end
293
+ return cached
294
+ end
295
+
296
+ i0, s0 = index, []
297
+ r1 = _nt_response_start
298
+ s0 << r1
299
+ if r1
300
+ r2 = _nt_router
301
+ s0 << r2
302
+ if r2
303
+ s3, i3 = [], index
304
+ loop do
305
+ r4 = _nt_extra_info
306
+ if r4
307
+ s3 << r4
308
+ else
309
+ break
310
+ end
311
+ end
312
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
313
+ s0 << r3
314
+ if r3
315
+ r5 = _nt_response_end
316
+ s0 << r5
317
+ if r5
318
+ r6 = _nt_command_ack
319
+ s0 << r6
320
+ end
321
+ end
322
+ end
323
+ end
324
+ if s0.last
325
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
326
+ r0.extend(RouterStatus0)
327
+ else
328
+ @index = i0
329
+ r0 = nil
330
+ end
331
+
332
+ node_cache[:router_status][start_index] = r0
333
+
334
+ r0
335
+ end
336
+
337
+ module Router0
338
+ def SP1
339
+ elements[1]
340
+ end
341
+
342
+ def n
343
+ elements[2]
344
+ end
345
+
346
+ def SP2
347
+ elements[3]
348
+ end
349
+
350
+ def f
351
+ elements[4]
352
+ end
353
+
354
+ def SP3
355
+ elements[5]
356
+ end
357
+
358
+ def Digest
359
+ elements[6]
360
+ end
361
+
362
+ def SP4
363
+ elements[7]
364
+ end
365
+
366
+ def Publication
367
+ elements[8]
368
+ end
369
+
370
+ def SP5
371
+ elements[9]
372
+ end
373
+
374
+ def IP
375
+ elements[10]
376
+ end
377
+
378
+ def SP6
379
+ elements[11]
380
+ end
381
+
382
+ def ORPort
383
+ elements[12]
384
+ end
385
+
386
+ def SP7
387
+ elements[13]
388
+ end
389
+
390
+ def DirPort
391
+ elements[14]
392
+ end
393
+
394
+ def NL
395
+ elements[15]
396
+ end
397
+ end
398
+
399
+ module Router1
400
+ def nick
401
+ n.text_value.strip
402
+ end
403
+
404
+ def fingerprint
405
+ f.text_value.strip
406
+ end
407
+ end
408
+
409
+ def _nt_router
410
+ start_index = index
411
+ if node_cache[:router].has_key?(index)
412
+ cached = node_cache[:router][index]
413
+ if cached
414
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
415
+ @index = cached.interval.end
416
+ end
417
+ return cached
418
+ end
419
+
420
+ i0, s0 = index, []
421
+ if has_terminal?("r", false, index)
422
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
423
+ @index += 1
424
+ else
425
+ terminal_parse_failure("r")
426
+ r1 = nil
427
+ end
428
+ s0 << r1
429
+ if r1
430
+ r2 = _nt_SP
431
+ s0 << r2
432
+ if r2
433
+ r3 = _nt_Nickname
434
+ s0 << r3
435
+ if r3
436
+ r4 = _nt_SP
437
+ s0 << r4
438
+ if r4
439
+ r5 = _nt_Identity
440
+ s0 << r5
441
+ if r5
442
+ r6 = _nt_SP
443
+ s0 << r6
444
+ if r6
445
+ r7 = _nt_Digest
446
+ s0 << r7
447
+ if r7
448
+ r8 = _nt_SP
449
+ s0 << r8
450
+ if r8
451
+ r9 = _nt_Publication
452
+ s0 << r9
453
+ if r9
454
+ r10 = _nt_SP
455
+ s0 << r10
456
+ if r10
457
+ r11 = _nt_IP
458
+ s0 << r11
459
+ if r11
460
+ r12 = _nt_SP
461
+ s0 << r12
462
+ if r12
463
+ r13 = _nt_ORPort
464
+ s0 << r13
465
+ if r13
466
+ r14 = _nt_SP
467
+ s0 << r14
468
+ if r14
469
+ r15 = _nt_DirPort
470
+ s0 << r15
471
+ if r15
472
+ r16 = _nt_NL
473
+ s0 << r16
474
+ end
475
+ end
476
+ end
477
+ end
478
+ end
479
+ end
480
+ end
481
+ end
482
+ end
483
+ end
484
+ end
485
+ end
486
+ end
487
+ end
488
+ end
489
+ if s0.last
490
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
491
+ r0.extend(Router0)
492
+ r0.extend(Router1)
493
+ else
494
+ @index = i0
495
+ r0 = nil
496
+ end
497
+
498
+ node_cache[:router][start_index] = r0
499
+
500
+ r0
501
+ end
502
+
503
+ def _nt_Identity
504
+ start_index = index
505
+ if node_cache[:Identity].has_key?(index)
506
+ cached = node_cache[:Identity][index]
507
+ if cached
508
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
509
+ @index = cached.interval.end
510
+ end
511
+ return cached
512
+ end
513
+
514
+ r0 = _nt_Base64Hash
515
+
516
+ node_cache[:Identity][start_index] = r0
517
+
518
+ r0
519
+ end
520
+
521
+ def _nt_Digest
522
+ start_index = index
523
+ if node_cache[:Digest].has_key?(index)
524
+ cached = node_cache[:Digest][index]
525
+ if cached
526
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
527
+ @index = cached.interval.end
528
+ end
529
+ return cached
530
+ end
531
+
532
+ r0 = _nt_Base64Hash
533
+
534
+ node_cache[:Digest][start_index] = r0
535
+
536
+ r0
537
+ end
538
+
539
+ def _nt_Publication
540
+ start_index = index
541
+ if node_cache[:Publication].has_key?(index)
542
+ cached = node_cache[:Publication][index]
543
+ if cached
544
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
545
+ @index = cached.interval.end
546
+ end
547
+ return cached
548
+ end
549
+
550
+ r0 = _nt_DateTime
551
+
552
+ node_cache[:Publication][start_index] = r0
553
+
554
+ r0
555
+ end
556
+
557
+ def _nt_extra_info
558
+ start_index = index
559
+ if node_cache[:extra_info].has_key?(index)
560
+ cached = node_cache[:extra_info][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
+ i0 = index
569
+ r1 = _nt_status
570
+ if r1
571
+ r0 = r1
572
+ else
573
+ r2 = _nt_bandwidth
574
+ if r2
575
+ r0 = r2
576
+ else
577
+ r3 = _nt_policy
578
+ if r3
579
+ r0 = r3
580
+ else
581
+ @index = i0
582
+ r0 = nil
583
+ end
584
+ end
585
+ end
586
+
587
+ node_cache[:extra_info][start_index] = r0
588
+
589
+ r0
590
+ end
591
+
592
+ module Status0
593
+ def SP
594
+ elements[0]
595
+ end
596
+
597
+ def flag
598
+ elements[1]
599
+ end
600
+ end
601
+
602
+ module Status1
603
+ def NL
604
+ elements[2]
605
+ end
606
+ end
607
+
608
+ module Status2
609
+ def flags
610
+ results = []
611
+ self.elements[1].elements.each do |e|
612
+ if e.respond_to? :flag
613
+ results << e.flag.text_value
614
+ end
615
+ end
616
+ return results
617
+ end
618
+ end
619
+
620
+ def _nt_status
621
+ start_index = index
622
+ if node_cache[:status].has_key?(index)
623
+ cached = node_cache[:status][index]
624
+ if cached
625
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
626
+ @index = cached.interval.end
627
+ end
628
+ return cached
629
+ end
630
+
631
+ i0, s0 = index, []
632
+ if has_terminal?("s", false, index)
633
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
634
+ @index += 1
635
+ else
636
+ terminal_parse_failure("s")
637
+ r1 = nil
638
+ end
639
+ s0 << r1
640
+ if r1
641
+ s2, i2 = [], index
642
+ loop do
643
+ i3, s3 = index, []
644
+ r4 = _nt_SP
645
+ s3 << r4
646
+ if r4
647
+ r5 = _nt_status_flag
648
+ s3 << r5
649
+ end
650
+ if s3.last
651
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
652
+ r3.extend(Status0)
653
+ else
654
+ @index = i3
655
+ r3 = nil
656
+ end
657
+ if r3
658
+ s2 << r3
659
+ else
660
+ break
661
+ end
662
+ end
663
+ if s2.empty?
664
+ @index = i2
665
+ r2 = nil
666
+ else
667
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
668
+ end
669
+ s0 << r2
670
+ if r2
671
+ r6 = _nt_NL
672
+ s0 << r6
673
+ end
674
+ end
675
+ if s0.last
676
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
677
+ r0.extend(Status1)
678
+ r0.extend(Status2)
679
+ else
680
+ @index = i0
681
+ r0 = nil
682
+ end
683
+
684
+ node_cache[:status][start_index] = r0
685
+
686
+ r0
687
+ end
688
+
689
+ def _nt_status_flag
690
+ start_index = index
691
+ if node_cache[:status_flag].has_key?(index)
692
+ cached = node_cache[:status_flag][index]
693
+ if cached
694
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
695
+ @index = cached.interval.end
696
+ end
697
+ return cached
698
+ end
699
+
700
+ i0 = index
701
+ r1 = _nt_documented_status_flag
702
+ if r1
703
+ r0 = r1
704
+ else
705
+ r2 = _nt_undocumented_status_flag
706
+ if r2
707
+ r0 = r2
708
+ else
709
+ @index = i0
710
+ r0 = nil
711
+ end
712
+ end
713
+
714
+ node_cache[:status_flag][start_index] = r0
715
+
716
+ r0
717
+ end
718
+
719
+ def _nt_documented_status_flag
720
+ start_index = index
721
+ if node_cache[:documented_status_flag].has_key?(index)
722
+ cached = node_cache[:documented_status_flag][index]
723
+ if cached
724
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
725
+ @index = cached.interval.end
726
+ end
727
+ return cached
728
+ end
729
+
730
+ i0 = index
731
+ if has_terminal?("Authority", false, index)
732
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 9))
733
+ @index += 9
734
+ else
735
+ terminal_parse_failure("Authority")
736
+ r1 = nil
737
+ end
738
+ if r1
739
+ r0 = r1
740
+ else
741
+ if has_terminal?("BadExit", false, index)
742
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 7))
743
+ @index += 7
744
+ else
745
+ terminal_parse_failure("BadExit")
746
+ r2 = nil
747
+ end
748
+ if r2
749
+ r0 = r2
750
+ else
751
+ if has_terminal?("BadDirectory", false, index)
752
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 12))
753
+ @index += 12
754
+ else
755
+ terminal_parse_failure("BadDirectory")
756
+ r3 = nil
757
+ end
758
+ if r3
759
+ r0 = r3
760
+ else
761
+ if has_terminal?("Exit", false, index)
762
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 4))
763
+ @index += 4
764
+ else
765
+ terminal_parse_failure("Exit")
766
+ r4 = nil
767
+ end
768
+ if r4
769
+ r0 = r4
770
+ else
771
+ if has_terminal?("Fast", false, index)
772
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
773
+ @index += 4
774
+ else
775
+ terminal_parse_failure("Fast")
776
+ r5 = nil
777
+ end
778
+ if r5
779
+ r0 = r5
780
+ else
781
+ if has_terminal?("Guard", false, index)
782
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 5))
783
+ @index += 5
784
+ else
785
+ terminal_parse_failure("Guard")
786
+ r6 = nil
787
+ end
788
+ if r6
789
+ r0 = r6
790
+ else
791
+ if has_terminal?("Named", false, index)
792
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 5))
793
+ @index += 5
794
+ else
795
+ terminal_parse_failure("Named")
796
+ r7 = nil
797
+ end
798
+ if r7
799
+ r0 = r7
800
+ else
801
+ if has_terminal?("Stable", false, index)
802
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 6))
803
+ @index += 6
804
+ else
805
+ terminal_parse_failure("Stable")
806
+ r8 = nil
807
+ end
808
+ if r8
809
+ r0 = r8
810
+ else
811
+ if has_terminal?("Running", false, index)
812
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 7))
813
+ @index += 7
814
+ else
815
+ terminal_parse_failure("Running")
816
+ r9 = nil
817
+ end
818
+ if r9
819
+ r0 = r9
820
+ else
821
+ if has_terminal?("Valid", false, index)
822
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 5))
823
+ @index += 5
824
+ else
825
+ terminal_parse_failure("Valid")
826
+ r10 = nil
827
+ end
828
+ if r10
829
+ r0 = r10
830
+ else
831
+ if has_terminal?("V2Dir", false, index)
832
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 5))
833
+ @index += 5
834
+ else
835
+ terminal_parse_failure("V2Dir")
836
+ r11 = nil
837
+ end
838
+ if r11
839
+ r0 = r11
840
+ else
841
+ @index = i0
842
+ r0 = nil
843
+ end
844
+ end
845
+ end
846
+ end
847
+ end
848
+ end
849
+ end
850
+ end
851
+ end
852
+ end
853
+ end
854
+
855
+ node_cache[:documented_status_flag][start_index] = r0
856
+
857
+ r0
858
+ end
859
+
860
+ def _nt_undocumented_status_flag
861
+ start_index = index
862
+ if node_cache[:undocumented_status_flag].has_key?(index)
863
+ cached = node_cache[:undocumented_status_flag][index]
864
+ if cached
865
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
866
+ @index = cached.interval.end
867
+ end
868
+ return cached
869
+ end
870
+
871
+ s0, i0 = [], index
872
+ loop do
873
+ if has_terminal?('\G[a-zA-Z]', true, index)
874
+ r1 = true
875
+ @index += 1
876
+ else
877
+ r1 = nil
878
+ end
879
+ if r1
880
+ s0 << r1
881
+ else
882
+ break
883
+ end
884
+ end
885
+ if s0.empty?
886
+ @index = i0
887
+ r0 = nil
888
+ else
889
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
890
+ end
891
+
892
+ node_cache[:undocumented_status_flag][start_index] = r0
893
+
894
+ r0
895
+ end
896
+
897
+ module Bandwidth0
898
+ def NL
899
+ elements[2]
900
+ end
901
+ end
902
+
903
+ def _nt_bandwidth
904
+ start_index = index
905
+ if node_cache[:bandwidth].has_key?(index)
906
+ cached = node_cache[:bandwidth][index]
907
+ if cached
908
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
909
+ @index = cached.interval.end
910
+ end
911
+ return cached
912
+ end
913
+
914
+ i0, s0 = index, []
915
+ if has_terminal?("w", false, index)
916
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
917
+ @index += 1
918
+ else
919
+ terminal_parse_failure("w")
920
+ r1 = nil
921
+ end
922
+ s0 << r1
923
+ if r1
924
+ s2, i2 = [], index
925
+ loop do
926
+ if has_terminal?('\G[ /0-9a-zA-Z\\-=]', true, index)
927
+ r3 = true
928
+ @index += 1
929
+ else
930
+ r3 = nil
931
+ end
932
+ if r3
933
+ s2 << r3
934
+ else
935
+ break
936
+ end
937
+ end
938
+ if s2.empty?
939
+ @index = i2
940
+ r2 = nil
941
+ else
942
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
943
+ end
944
+ s0 << r2
945
+ if r2
946
+ r4 = _nt_NL
947
+ s0 << r4
948
+ end
949
+ end
950
+ if s0.last
951
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
952
+ r0.extend(Bandwidth0)
953
+ else
954
+ @index = i0
955
+ r0 = nil
956
+ end
957
+
958
+ node_cache[:bandwidth][start_index] = r0
959
+
960
+ r0
961
+ end
962
+
963
+ module Policy0
964
+ def NL
965
+ elements[2]
966
+ end
967
+ end
968
+
969
+ def _nt_policy
970
+ start_index = index
971
+ if node_cache[:policy].has_key?(index)
972
+ cached = node_cache[:policy][index]
973
+ if cached
974
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
975
+ @index = cached.interval.end
976
+ end
977
+ return cached
978
+ end
979
+
980
+ i0, s0 = index, []
981
+ if has_terminal?("p", false, index)
982
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
983
+ @index += 1
984
+ else
985
+ terminal_parse_failure("p")
986
+ r1 = nil
987
+ end
988
+ s0 << r1
989
+ if r1
990
+ s2, i2 = [], index
991
+ loop do
992
+ if has_terminal?('\G[ /0-9a-zA-Z\\-=,]', true, index)
993
+ r3 = true
994
+ @index += 1
995
+ else
996
+ r3 = nil
997
+ end
998
+ if r3
999
+ s2 << r3
1000
+ else
1001
+ break
1002
+ end
1003
+ end
1004
+ if s2.empty?
1005
+ @index = i2
1006
+ r2 = nil
1007
+ else
1008
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1009
+ end
1010
+ s0 << r2
1011
+ if r2
1012
+ r4 = _nt_NL
1013
+ s0 << r4
1014
+ end
1015
+ end
1016
+ if s0.last
1017
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1018
+ r0.extend(Policy0)
1019
+ else
1020
+ @index = i0
1021
+ r0 = nil
1022
+ end
1023
+
1024
+ node_cache[:policy][start_index] = r0
1025
+
1026
+ r0
1027
+ end
1028
+
1029
+ end
1030
+
1031
+ class RouterStatusesParser < Treetop::Runtime::CompiledParser
1032
+ include RouterStatuses
1033
+ end
1034
+
1035
+ end