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