dns-zonefile 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +51 -0
- data/Rakefile +32 -0
- data/TODO +8 -0
- data/doc/example2.com.zone +16 -0
- data/doc/example3.com.zone +24 -0
- data/doc/zonefile.example +45 -0
- data/doc/zonefile.treetop +257 -0
- data/lib/dns/zonefile.rb +16 -0
- data/lib/dns/zonefile_parser.rb +1895 -0
- data/spec/dns/zonefile_spec.rb +141 -0
- data/spec/spec_helper.rb +2 -0
- metadata +72 -0
@@ -0,0 +1,1895 @@
|
|
1
|
+
require 'treetop'
|
2
|
+
|
3
|
+
module DNS
|
4
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
5
|
+
|
6
|
+
|
7
|
+
module ZonefileGrammar # :nodoc:
|
8
|
+
include Treetop::Runtime
|
9
|
+
|
10
|
+
def root
|
11
|
+
@root || :zone
|
12
|
+
end
|
13
|
+
|
14
|
+
module Zone0
|
15
|
+
def soa
|
16
|
+
elements[1]
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
module Zone1
|
22
|
+
def variables
|
23
|
+
@variables ||= begin
|
24
|
+
raw = elements[0].elements.select { |e| e.to_s =~ /^\$/ }
|
25
|
+
variables = {}
|
26
|
+
raw.each do |e|
|
27
|
+
variables[e.name.text_value.to_s] = e.value.text_value.to_s
|
28
|
+
end
|
29
|
+
variables
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def origin
|
34
|
+
soa.origin.host.to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
text_value
|
39
|
+
end
|
40
|
+
|
41
|
+
def rr
|
42
|
+
elements[-1].elements.select { |e| e.to_s !~ /\A\s*(;.*)?\z|\A\z/; }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def _nt_zone
|
47
|
+
start_index = index
|
48
|
+
if node_cache[:zone].has_key?(index)
|
49
|
+
cached = node_cache[:zone][index]
|
50
|
+
@index = cached.interval.end if cached
|
51
|
+
return cached
|
52
|
+
end
|
53
|
+
|
54
|
+
i0, s0 = index, []
|
55
|
+
s1, i1 = [], index
|
56
|
+
loop do
|
57
|
+
i2 = index
|
58
|
+
r3 = _nt_variable
|
59
|
+
if r3
|
60
|
+
r2 = r3
|
61
|
+
else
|
62
|
+
r4 = _nt_space
|
63
|
+
if r4
|
64
|
+
r2 = r4
|
65
|
+
else
|
66
|
+
r5 = _nt_comment
|
67
|
+
if r5
|
68
|
+
r2 = r5
|
69
|
+
else
|
70
|
+
@index = i2
|
71
|
+
r2 = nil
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
if r2
|
76
|
+
s1 << r2
|
77
|
+
else
|
78
|
+
break
|
79
|
+
end
|
80
|
+
end
|
81
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
82
|
+
s0 << r1
|
83
|
+
if r1
|
84
|
+
r6 = _nt_soa
|
85
|
+
s0 << r6
|
86
|
+
if r6
|
87
|
+
s7, i7 = [], index
|
88
|
+
loop do
|
89
|
+
i8 = index
|
90
|
+
r9 = _nt_resource_record
|
91
|
+
if r9
|
92
|
+
r8 = r9
|
93
|
+
else
|
94
|
+
r10 = _nt_comment
|
95
|
+
if r10
|
96
|
+
r8 = r10
|
97
|
+
else
|
98
|
+
r11 = _nt_space
|
99
|
+
if r11
|
100
|
+
r8 = r11
|
101
|
+
else
|
102
|
+
@index = i8
|
103
|
+
r8 = nil
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
if r8
|
108
|
+
s7 << r8
|
109
|
+
else
|
110
|
+
break
|
111
|
+
end
|
112
|
+
end
|
113
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
114
|
+
s0 << r7
|
115
|
+
end
|
116
|
+
end
|
117
|
+
if s0.last
|
118
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
119
|
+
r0.extend(Zone0)
|
120
|
+
r0.extend(Zone1)
|
121
|
+
else
|
122
|
+
@index = i0
|
123
|
+
r0 = nil
|
124
|
+
end
|
125
|
+
|
126
|
+
node_cache[:zone][start_index] = r0
|
127
|
+
|
128
|
+
r0
|
129
|
+
end
|
130
|
+
|
131
|
+
module Variable0
|
132
|
+
def name
|
133
|
+
elements[1]
|
134
|
+
end
|
135
|
+
|
136
|
+
def space
|
137
|
+
elements[2]
|
138
|
+
end
|
139
|
+
|
140
|
+
def value
|
141
|
+
elements[3]
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
module Variable1
|
147
|
+
def to_s
|
148
|
+
"$#{name.text_value.to_s} #{value.text_value.to_s}"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def _nt_variable
|
153
|
+
start_index = index
|
154
|
+
if node_cache[:variable].has_key?(index)
|
155
|
+
cached = node_cache[:variable][index]
|
156
|
+
@index = cached.interval.end if cached
|
157
|
+
return cached
|
158
|
+
end
|
159
|
+
|
160
|
+
i0, s0 = index, []
|
161
|
+
if has_terminal?("$", false, index)
|
162
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
163
|
+
@index += 1
|
164
|
+
else
|
165
|
+
terminal_parse_failure("$")
|
166
|
+
r1 = nil
|
167
|
+
end
|
168
|
+
s0 << r1
|
169
|
+
if r1
|
170
|
+
s2, i2 = [], index
|
171
|
+
loop do
|
172
|
+
if has_terminal?('\G[a-zA-Z0-9]', true, index)
|
173
|
+
r3 = true
|
174
|
+
@index += 1
|
175
|
+
else
|
176
|
+
r3 = nil
|
177
|
+
end
|
178
|
+
if r3
|
179
|
+
s2 << r3
|
180
|
+
else
|
181
|
+
break
|
182
|
+
end
|
183
|
+
end
|
184
|
+
if s2.empty?
|
185
|
+
@index = i2
|
186
|
+
r2 = nil
|
187
|
+
else
|
188
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
189
|
+
end
|
190
|
+
s0 << r2
|
191
|
+
if r2
|
192
|
+
r4 = _nt_space
|
193
|
+
s0 << r4
|
194
|
+
if r4
|
195
|
+
s5, i5 = [], index
|
196
|
+
loop do
|
197
|
+
if has_terminal?('\G[a-zA-Z0-9\\.\\-]', true, index)
|
198
|
+
r6 = true
|
199
|
+
@index += 1
|
200
|
+
else
|
201
|
+
r6 = nil
|
202
|
+
end
|
203
|
+
if r6
|
204
|
+
s5 << r6
|
205
|
+
else
|
206
|
+
break
|
207
|
+
end
|
208
|
+
end
|
209
|
+
if s5.empty?
|
210
|
+
@index = i5
|
211
|
+
r5 = nil
|
212
|
+
else
|
213
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
214
|
+
end
|
215
|
+
s0 << r5
|
216
|
+
if r5
|
217
|
+
r8 = _nt_space
|
218
|
+
if r8
|
219
|
+
r7 = r8
|
220
|
+
else
|
221
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
222
|
+
end
|
223
|
+
s0 << r7
|
224
|
+
if r7
|
225
|
+
r10 = _nt_comment
|
226
|
+
if r10
|
227
|
+
r9 = r10
|
228
|
+
else
|
229
|
+
r9 = instantiate_node(SyntaxNode,input, index...index)
|
230
|
+
end
|
231
|
+
s0 << r9
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
if s0.last
|
238
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
239
|
+
r0.extend(Variable0)
|
240
|
+
r0.extend(Variable1)
|
241
|
+
else
|
242
|
+
@index = i0
|
243
|
+
r0 = nil
|
244
|
+
end
|
245
|
+
|
246
|
+
node_cache[:variable][start_index] = r0
|
247
|
+
|
248
|
+
r0
|
249
|
+
end
|
250
|
+
|
251
|
+
module Soa0
|
252
|
+
def origin
|
253
|
+
elements[0]
|
254
|
+
end
|
255
|
+
|
256
|
+
def space1
|
257
|
+
elements[1]
|
258
|
+
end
|
259
|
+
|
260
|
+
def zone_type
|
261
|
+
elements[2]
|
262
|
+
end
|
263
|
+
|
264
|
+
def space2
|
265
|
+
elements[3]
|
266
|
+
end
|
267
|
+
|
268
|
+
def space3
|
269
|
+
elements[5]
|
270
|
+
end
|
271
|
+
|
272
|
+
def ns
|
273
|
+
elements[6]
|
274
|
+
end
|
275
|
+
|
276
|
+
def space4
|
277
|
+
elements[7]
|
278
|
+
end
|
279
|
+
|
280
|
+
def rp
|
281
|
+
elements[8]
|
282
|
+
end
|
283
|
+
|
284
|
+
def space5
|
285
|
+
elements[9]
|
286
|
+
end
|
287
|
+
|
288
|
+
def serial
|
289
|
+
elements[12]
|
290
|
+
end
|
291
|
+
|
292
|
+
def space6
|
293
|
+
elements[13]
|
294
|
+
end
|
295
|
+
|
296
|
+
def refresh
|
297
|
+
elements[14]
|
298
|
+
end
|
299
|
+
|
300
|
+
def space7
|
301
|
+
elements[15]
|
302
|
+
end
|
303
|
+
|
304
|
+
def retry
|
305
|
+
elements[16]
|
306
|
+
end
|
307
|
+
|
308
|
+
def space8
|
309
|
+
elements[17]
|
310
|
+
end
|
311
|
+
|
312
|
+
def expiry
|
313
|
+
elements[18]
|
314
|
+
end
|
315
|
+
|
316
|
+
def space9
|
317
|
+
elements[19]
|
318
|
+
end
|
319
|
+
|
320
|
+
def ttl
|
321
|
+
elements[20]
|
322
|
+
end
|
323
|
+
|
324
|
+
end
|
325
|
+
|
326
|
+
module Soa1
|
327
|
+
def to_s
|
328
|
+
text_value
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
def _nt_soa
|
333
|
+
start_index = index
|
334
|
+
if node_cache[:soa].has_key?(index)
|
335
|
+
cached = node_cache[:soa][index]
|
336
|
+
@index = cached.interval.end if cached
|
337
|
+
return cached
|
338
|
+
end
|
339
|
+
|
340
|
+
i0, s0 = index, []
|
341
|
+
r1 = _nt_origin
|
342
|
+
s0 << r1
|
343
|
+
if r1
|
344
|
+
r2 = _nt_space
|
345
|
+
s0 << r2
|
346
|
+
if r2
|
347
|
+
r3 = _nt_zone_type
|
348
|
+
s0 << r3
|
349
|
+
if r3
|
350
|
+
r4 = _nt_space
|
351
|
+
s0 << r4
|
352
|
+
if r4
|
353
|
+
if has_terminal?("SOA", false, index)
|
354
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
355
|
+
@index += 3
|
356
|
+
else
|
357
|
+
terminal_parse_failure("SOA")
|
358
|
+
r5 = nil
|
359
|
+
end
|
360
|
+
s0 << r5
|
361
|
+
if r5
|
362
|
+
r6 = _nt_space
|
363
|
+
s0 << r6
|
364
|
+
if r6
|
365
|
+
r7 = _nt_ns
|
366
|
+
s0 << r7
|
367
|
+
if r7
|
368
|
+
r8 = _nt_space
|
369
|
+
s0 << r8
|
370
|
+
if r8
|
371
|
+
r9 = _nt_rp
|
372
|
+
s0 << r9
|
373
|
+
if r9
|
374
|
+
r10 = _nt_space
|
375
|
+
s0 << r10
|
376
|
+
if r10
|
377
|
+
if has_terminal?("(", false, index)
|
378
|
+
r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
379
|
+
@index += 1
|
380
|
+
else
|
381
|
+
terminal_parse_failure("(")
|
382
|
+
r11 = nil
|
383
|
+
end
|
384
|
+
s0 << r11
|
385
|
+
if r11
|
386
|
+
s12, i12 = [], index
|
387
|
+
loop do
|
388
|
+
r13 = _nt_space
|
389
|
+
if r13
|
390
|
+
s12 << r13
|
391
|
+
else
|
392
|
+
break
|
393
|
+
end
|
394
|
+
end
|
395
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
396
|
+
s0 << r12
|
397
|
+
if r12
|
398
|
+
r14 = _nt_serial
|
399
|
+
s0 << r14
|
400
|
+
if r14
|
401
|
+
r15 = _nt_space
|
402
|
+
s0 << r15
|
403
|
+
if r15
|
404
|
+
r16 = _nt_refresh
|
405
|
+
s0 << r16
|
406
|
+
if r16
|
407
|
+
r17 = _nt_space
|
408
|
+
s0 << r17
|
409
|
+
if r17
|
410
|
+
r18 = _nt_retry
|
411
|
+
s0 << r18
|
412
|
+
if r18
|
413
|
+
r19 = _nt_space
|
414
|
+
s0 << r19
|
415
|
+
if r19
|
416
|
+
r20 = _nt_expiry
|
417
|
+
s0 << r20
|
418
|
+
if r20
|
419
|
+
r21 = _nt_space
|
420
|
+
s0 << r21
|
421
|
+
if r21
|
422
|
+
r22 = _nt_ttl
|
423
|
+
s0 << r22
|
424
|
+
if r22
|
425
|
+
s23, i23 = [], index
|
426
|
+
loop do
|
427
|
+
r24 = _nt_space
|
428
|
+
if r24
|
429
|
+
s23 << r24
|
430
|
+
else
|
431
|
+
break
|
432
|
+
end
|
433
|
+
end
|
434
|
+
r23 = instantiate_node(SyntaxNode,input, i23...index, s23)
|
435
|
+
s0 << r23
|
436
|
+
if r23
|
437
|
+
if has_terminal?(")", false, index)
|
438
|
+
r25 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
439
|
+
@index += 1
|
440
|
+
else
|
441
|
+
terminal_parse_failure(")")
|
442
|
+
r25 = nil
|
443
|
+
end
|
444
|
+
s0 << r25
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
end
|
460
|
+
end
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|
464
|
+
end
|
465
|
+
end
|
466
|
+
end
|
467
|
+
if s0.last
|
468
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
469
|
+
r0.extend(Soa0)
|
470
|
+
r0.extend(Soa1)
|
471
|
+
else
|
472
|
+
@index = i0
|
473
|
+
r0 = nil
|
474
|
+
end
|
475
|
+
|
476
|
+
node_cache[:soa][start_index] = r0
|
477
|
+
|
478
|
+
r0
|
479
|
+
end
|
480
|
+
|
481
|
+
module ResourceRecord0
|
482
|
+
def record
|
483
|
+
elements[1]
|
484
|
+
end
|
485
|
+
|
486
|
+
end
|
487
|
+
|
488
|
+
module ResourceRecord1
|
489
|
+
def to_s
|
490
|
+
text_value
|
491
|
+
end
|
492
|
+
|
493
|
+
def record_type
|
494
|
+
record.elements[2].text_value
|
495
|
+
end
|
496
|
+
|
497
|
+
def method_missing(method_name, *args)
|
498
|
+
if record.respond_to?(method_name)
|
499
|
+
record.send(method_name, *args)
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
def respond_to?(method_name)
|
504
|
+
super || record.respond_to?(method_name)
|
505
|
+
end
|
506
|
+
end
|
507
|
+
|
508
|
+
def _nt_resource_record
|
509
|
+
start_index = index
|
510
|
+
if node_cache[:resource_record].has_key?(index)
|
511
|
+
cached = node_cache[:resource_record][index]
|
512
|
+
@index = cached.interval.end if cached
|
513
|
+
return cached
|
514
|
+
end
|
515
|
+
|
516
|
+
i0, s0 = index, []
|
517
|
+
r2 = _nt_space
|
518
|
+
if r2
|
519
|
+
r1 = r2
|
520
|
+
else
|
521
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
522
|
+
end
|
523
|
+
s0 << r1
|
524
|
+
if r1
|
525
|
+
i3 = index
|
526
|
+
r4 = _nt_a_record
|
527
|
+
if r4
|
528
|
+
r3 = r4
|
529
|
+
else
|
530
|
+
r5 = _nt_cname_record
|
531
|
+
if r5
|
532
|
+
r3 = r5
|
533
|
+
else
|
534
|
+
r6 = _nt_mx_record
|
535
|
+
if r6
|
536
|
+
r3 = r6
|
537
|
+
else
|
538
|
+
r7 = _nt_ns_record
|
539
|
+
if r7
|
540
|
+
r3 = r7
|
541
|
+
else
|
542
|
+
@index = i3
|
543
|
+
r3 = nil
|
544
|
+
end
|
545
|
+
end
|
546
|
+
end
|
547
|
+
end
|
548
|
+
s0 << r3
|
549
|
+
if r3
|
550
|
+
r9 = _nt_space
|
551
|
+
if r9
|
552
|
+
r8 = r9
|
553
|
+
else
|
554
|
+
r8 = instantiate_node(SyntaxNode,input, index...index)
|
555
|
+
end
|
556
|
+
s0 << r8
|
557
|
+
if r8
|
558
|
+
r11 = _nt_comment
|
559
|
+
if r11
|
560
|
+
r10 = r11
|
561
|
+
else
|
562
|
+
r10 = instantiate_node(SyntaxNode,input, index...index)
|
563
|
+
end
|
564
|
+
s0 << r10
|
565
|
+
end
|
566
|
+
end
|
567
|
+
end
|
568
|
+
if s0.last
|
569
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
570
|
+
r0.extend(ResourceRecord0)
|
571
|
+
r0.extend(ResourceRecord1)
|
572
|
+
else
|
573
|
+
@index = i0
|
574
|
+
r0 = nil
|
575
|
+
end
|
576
|
+
|
577
|
+
node_cache[:resource_record][start_index] = r0
|
578
|
+
|
579
|
+
r0
|
580
|
+
end
|
581
|
+
|
582
|
+
module ARecord0
|
583
|
+
def host
|
584
|
+
elements[0]
|
585
|
+
end
|
586
|
+
|
587
|
+
def space1
|
588
|
+
elements[1]
|
589
|
+
end
|
590
|
+
|
591
|
+
def space2
|
592
|
+
elements[3]
|
593
|
+
end
|
594
|
+
|
595
|
+
def ip_address
|
596
|
+
elements[4]
|
597
|
+
end
|
598
|
+
end
|
599
|
+
|
600
|
+
module ARecord1
|
601
|
+
def to_s
|
602
|
+
text_value
|
603
|
+
end
|
604
|
+
end
|
605
|
+
|
606
|
+
def _nt_a_record
|
607
|
+
start_index = index
|
608
|
+
if node_cache[:a_record].has_key?(index)
|
609
|
+
cached = node_cache[:a_record][index]
|
610
|
+
@index = cached.interval.end if cached
|
611
|
+
return cached
|
612
|
+
end
|
613
|
+
|
614
|
+
i0, s0 = index, []
|
615
|
+
r1 = _nt_host
|
616
|
+
s0 << r1
|
617
|
+
if r1
|
618
|
+
r2 = _nt_space
|
619
|
+
s0 << r2
|
620
|
+
if r2
|
621
|
+
if has_terminal?("A", false, index)
|
622
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
623
|
+
@index += 1
|
624
|
+
else
|
625
|
+
terminal_parse_failure("A")
|
626
|
+
r3 = nil
|
627
|
+
end
|
628
|
+
s0 << r3
|
629
|
+
if r3
|
630
|
+
r4 = _nt_space
|
631
|
+
s0 << r4
|
632
|
+
if r4
|
633
|
+
r5 = _nt_ip_address
|
634
|
+
s0 << r5
|
635
|
+
end
|
636
|
+
end
|
637
|
+
end
|
638
|
+
end
|
639
|
+
if s0.last
|
640
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
641
|
+
r0.extend(ARecord0)
|
642
|
+
r0.extend(ARecord1)
|
643
|
+
else
|
644
|
+
@index = i0
|
645
|
+
r0 = nil
|
646
|
+
end
|
647
|
+
|
648
|
+
node_cache[:a_record][start_index] = r0
|
649
|
+
|
650
|
+
r0
|
651
|
+
end
|
652
|
+
|
653
|
+
module IpAddress0
|
654
|
+
end
|
655
|
+
|
656
|
+
module IpAddress1
|
657
|
+
def to_s
|
658
|
+
text_value
|
659
|
+
end
|
660
|
+
end
|
661
|
+
|
662
|
+
def _nt_ip_address
|
663
|
+
start_index = index
|
664
|
+
if node_cache[:ip_address].has_key?(index)
|
665
|
+
cached = node_cache[:ip_address][index]
|
666
|
+
@index = cached.interval.end if cached
|
667
|
+
return cached
|
668
|
+
end
|
669
|
+
|
670
|
+
i0, s0 = index, []
|
671
|
+
s1, i1 = [], index
|
672
|
+
loop do
|
673
|
+
if has_terminal?('\G[\\d]', true, index)
|
674
|
+
r2 = true
|
675
|
+
@index += 1
|
676
|
+
else
|
677
|
+
r2 = nil
|
678
|
+
end
|
679
|
+
if r2
|
680
|
+
s1 << r2
|
681
|
+
else
|
682
|
+
break
|
683
|
+
end
|
684
|
+
end
|
685
|
+
if s1.empty?
|
686
|
+
@index = i1
|
687
|
+
r1 = nil
|
688
|
+
else
|
689
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
690
|
+
end
|
691
|
+
s0 << r1
|
692
|
+
if r1
|
693
|
+
if has_terminal?(".", false, index)
|
694
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
695
|
+
@index += 1
|
696
|
+
else
|
697
|
+
terminal_parse_failure(".")
|
698
|
+
r3 = nil
|
699
|
+
end
|
700
|
+
s0 << r3
|
701
|
+
if r3
|
702
|
+
s4, i4 = [], index
|
703
|
+
loop do
|
704
|
+
if has_terminal?('\G[\\d]', true, index)
|
705
|
+
r5 = true
|
706
|
+
@index += 1
|
707
|
+
else
|
708
|
+
r5 = nil
|
709
|
+
end
|
710
|
+
if r5
|
711
|
+
s4 << r5
|
712
|
+
else
|
713
|
+
break
|
714
|
+
end
|
715
|
+
end
|
716
|
+
if s4.empty?
|
717
|
+
@index = i4
|
718
|
+
r4 = nil
|
719
|
+
else
|
720
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
721
|
+
end
|
722
|
+
s0 << r4
|
723
|
+
if r4
|
724
|
+
if has_terminal?(".", false, index)
|
725
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
726
|
+
@index += 1
|
727
|
+
else
|
728
|
+
terminal_parse_failure(".")
|
729
|
+
r6 = nil
|
730
|
+
end
|
731
|
+
s0 << r6
|
732
|
+
if r6
|
733
|
+
s7, i7 = [], index
|
734
|
+
loop do
|
735
|
+
if has_terminal?('\G[\\d]', true, index)
|
736
|
+
r8 = true
|
737
|
+
@index += 1
|
738
|
+
else
|
739
|
+
r8 = nil
|
740
|
+
end
|
741
|
+
if r8
|
742
|
+
s7 << r8
|
743
|
+
else
|
744
|
+
break
|
745
|
+
end
|
746
|
+
end
|
747
|
+
if s7.empty?
|
748
|
+
@index = i7
|
749
|
+
r7 = nil
|
750
|
+
else
|
751
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
752
|
+
end
|
753
|
+
s0 << r7
|
754
|
+
if r7
|
755
|
+
if has_terminal?(".", false, index)
|
756
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
757
|
+
@index += 1
|
758
|
+
else
|
759
|
+
terminal_parse_failure(".")
|
760
|
+
r9 = nil
|
761
|
+
end
|
762
|
+
s0 << r9
|
763
|
+
if r9
|
764
|
+
s10, i10 = [], index
|
765
|
+
loop do
|
766
|
+
if has_terminal?('\G[\\d]', true, index)
|
767
|
+
r11 = true
|
768
|
+
@index += 1
|
769
|
+
else
|
770
|
+
r11 = nil
|
771
|
+
end
|
772
|
+
if r11
|
773
|
+
s10 << r11
|
774
|
+
else
|
775
|
+
break
|
776
|
+
end
|
777
|
+
end
|
778
|
+
if s10.empty?
|
779
|
+
@index = i10
|
780
|
+
r10 = nil
|
781
|
+
else
|
782
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
783
|
+
end
|
784
|
+
s0 << r10
|
785
|
+
end
|
786
|
+
end
|
787
|
+
end
|
788
|
+
end
|
789
|
+
end
|
790
|
+
end
|
791
|
+
if s0.last
|
792
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
793
|
+
r0.extend(IpAddress0)
|
794
|
+
r0.extend(IpAddress1)
|
795
|
+
else
|
796
|
+
@index = i0
|
797
|
+
r0 = nil
|
798
|
+
end
|
799
|
+
|
800
|
+
node_cache[:ip_address][start_index] = r0
|
801
|
+
|
802
|
+
r0
|
803
|
+
end
|
804
|
+
|
805
|
+
module CnameRecord0
|
806
|
+
def alias
|
807
|
+
elements[0]
|
808
|
+
end
|
809
|
+
|
810
|
+
def space1
|
811
|
+
elements[1]
|
812
|
+
end
|
813
|
+
|
814
|
+
def space2
|
815
|
+
elements[3]
|
816
|
+
end
|
817
|
+
|
818
|
+
def host
|
819
|
+
elements[4]
|
820
|
+
end
|
821
|
+
end
|
822
|
+
|
823
|
+
module CnameRecord1
|
824
|
+
def to_s
|
825
|
+
text_value
|
826
|
+
end
|
827
|
+
end
|
828
|
+
|
829
|
+
def _nt_cname_record
|
830
|
+
start_index = index
|
831
|
+
if node_cache[:cname_record].has_key?(index)
|
832
|
+
cached = node_cache[:cname_record][index]
|
833
|
+
@index = cached.interval.end if cached
|
834
|
+
return cached
|
835
|
+
end
|
836
|
+
|
837
|
+
i0, s0 = index, []
|
838
|
+
r1 = _nt_host
|
839
|
+
s0 << r1
|
840
|
+
if r1
|
841
|
+
r2 = _nt_space
|
842
|
+
s0 << r2
|
843
|
+
if r2
|
844
|
+
if has_terminal?("CNAME", false, index)
|
845
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
846
|
+
@index += 5
|
847
|
+
else
|
848
|
+
terminal_parse_failure("CNAME")
|
849
|
+
r3 = nil
|
850
|
+
end
|
851
|
+
s0 << r3
|
852
|
+
if r3
|
853
|
+
r4 = _nt_space
|
854
|
+
s0 << r4
|
855
|
+
if r4
|
856
|
+
r5 = _nt_host
|
857
|
+
s0 << r5
|
858
|
+
end
|
859
|
+
end
|
860
|
+
end
|
861
|
+
end
|
862
|
+
if s0.last
|
863
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
864
|
+
r0.extend(CnameRecord0)
|
865
|
+
r0.extend(CnameRecord1)
|
866
|
+
else
|
867
|
+
@index = i0
|
868
|
+
r0 = nil
|
869
|
+
end
|
870
|
+
|
871
|
+
node_cache[:cname_record][start_index] = r0
|
872
|
+
|
873
|
+
r0
|
874
|
+
end
|
875
|
+
|
876
|
+
module MxRecord0
|
877
|
+
def host
|
878
|
+
elements[0]
|
879
|
+
end
|
880
|
+
|
881
|
+
def space1
|
882
|
+
elements[1]
|
883
|
+
end
|
884
|
+
|
885
|
+
def space2
|
886
|
+
elements[3]
|
887
|
+
end
|
888
|
+
|
889
|
+
def priority
|
890
|
+
elements[4]
|
891
|
+
end
|
892
|
+
|
893
|
+
def space3
|
894
|
+
elements[5]
|
895
|
+
end
|
896
|
+
|
897
|
+
def exchanger
|
898
|
+
elements[6]
|
899
|
+
end
|
900
|
+
end
|
901
|
+
|
902
|
+
module MxRecord1
|
903
|
+
def to_s
|
904
|
+
text_value
|
905
|
+
end
|
906
|
+
end
|
907
|
+
|
908
|
+
def _nt_mx_record
|
909
|
+
start_index = index
|
910
|
+
if node_cache[:mx_record].has_key?(index)
|
911
|
+
cached = node_cache[:mx_record][index]
|
912
|
+
@index = cached.interval.end if cached
|
913
|
+
return cached
|
914
|
+
end
|
915
|
+
|
916
|
+
i0, s0 = index, []
|
917
|
+
r1 = _nt_host
|
918
|
+
s0 << r1
|
919
|
+
if r1
|
920
|
+
r2 = _nt_space
|
921
|
+
s0 << r2
|
922
|
+
if r2
|
923
|
+
if has_terminal?("MX", false, index)
|
924
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
925
|
+
@index += 2
|
926
|
+
else
|
927
|
+
terminal_parse_failure("MX")
|
928
|
+
r3 = nil
|
929
|
+
end
|
930
|
+
s0 << r3
|
931
|
+
if r3
|
932
|
+
r4 = _nt_space
|
933
|
+
s0 << r4
|
934
|
+
if r4
|
935
|
+
r5 = _nt_integer
|
936
|
+
s0 << r5
|
937
|
+
if r5
|
938
|
+
r6 = _nt_space
|
939
|
+
s0 << r6
|
940
|
+
if r6
|
941
|
+
r7 = _nt_host
|
942
|
+
s0 << r7
|
943
|
+
end
|
944
|
+
end
|
945
|
+
end
|
946
|
+
end
|
947
|
+
end
|
948
|
+
end
|
949
|
+
if s0.last
|
950
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
951
|
+
r0.extend(MxRecord0)
|
952
|
+
r0.extend(MxRecord1)
|
953
|
+
else
|
954
|
+
@index = i0
|
955
|
+
r0 = nil
|
956
|
+
end
|
957
|
+
|
958
|
+
node_cache[:mx_record][start_index] = r0
|
959
|
+
|
960
|
+
r0
|
961
|
+
end
|
962
|
+
|
963
|
+
module NsRecord0
|
964
|
+
def host
|
965
|
+
elements[0]
|
966
|
+
end
|
967
|
+
|
968
|
+
def space1
|
969
|
+
elements[1]
|
970
|
+
end
|
971
|
+
|
972
|
+
def space2
|
973
|
+
elements[3]
|
974
|
+
end
|
975
|
+
|
976
|
+
def nameserver
|
977
|
+
elements[4]
|
978
|
+
end
|
979
|
+
end
|
980
|
+
|
981
|
+
module NsRecord1
|
982
|
+
def to_s
|
983
|
+
text_value
|
984
|
+
end
|
985
|
+
end
|
986
|
+
|
987
|
+
def _nt_ns_record
|
988
|
+
start_index = index
|
989
|
+
if node_cache[:ns_record].has_key?(index)
|
990
|
+
cached = node_cache[:ns_record][index]
|
991
|
+
@index = cached.interval.end if cached
|
992
|
+
return cached
|
993
|
+
end
|
994
|
+
|
995
|
+
i0, s0 = index, []
|
996
|
+
r1 = _nt_host
|
997
|
+
s0 << r1
|
998
|
+
if r1
|
999
|
+
r2 = _nt_space
|
1000
|
+
s0 << r2
|
1001
|
+
if r2
|
1002
|
+
if has_terminal?("NS", false, index)
|
1003
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1004
|
+
@index += 2
|
1005
|
+
else
|
1006
|
+
terminal_parse_failure("NS")
|
1007
|
+
r3 = nil
|
1008
|
+
end
|
1009
|
+
s0 << r3
|
1010
|
+
if r3
|
1011
|
+
r4 = _nt_space
|
1012
|
+
s0 << r4
|
1013
|
+
if r4
|
1014
|
+
r5 = _nt_host
|
1015
|
+
s0 << r5
|
1016
|
+
end
|
1017
|
+
end
|
1018
|
+
end
|
1019
|
+
end
|
1020
|
+
if s0.last
|
1021
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1022
|
+
r0.extend(NsRecord0)
|
1023
|
+
r0.extend(NsRecord1)
|
1024
|
+
else
|
1025
|
+
@index = i0
|
1026
|
+
r0 = nil
|
1027
|
+
end
|
1028
|
+
|
1029
|
+
node_cache[:ns_record][start_index] = r0
|
1030
|
+
|
1031
|
+
r0
|
1032
|
+
end
|
1033
|
+
|
1034
|
+
module Origin0
|
1035
|
+
def host
|
1036
|
+
elements[0]
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
module Origin1
|
1042
|
+
def to_s
|
1043
|
+
text_value
|
1044
|
+
end
|
1045
|
+
end
|
1046
|
+
|
1047
|
+
def _nt_origin
|
1048
|
+
start_index = index
|
1049
|
+
if node_cache[:origin].has_key?(index)
|
1050
|
+
cached = node_cache[:origin][index]
|
1051
|
+
@index = cached.interval.end if cached
|
1052
|
+
return cached
|
1053
|
+
end
|
1054
|
+
|
1055
|
+
i0, s0 = index, []
|
1056
|
+
r1 = _nt_host
|
1057
|
+
s0 << r1
|
1058
|
+
if r1
|
1059
|
+
s2, i2 = [], index
|
1060
|
+
loop do
|
1061
|
+
r3 = _nt_comment
|
1062
|
+
if r3
|
1063
|
+
s2 << r3
|
1064
|
+
else
|
1065
|
+
break
|
1066
|
+
end
|
1067
|
+
end
|
1068
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1069
|
+
s0 << r2
|
1070
|
+
end
|
1071
|
+
if s0.last
|
1072
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1073
|
+
r0.extend(Origin0)
|
1074
|
+
r0.extend(Origin1)
|
1075
|
+
else
|
1076
|
+
@index = i0
|
1077
|
+
r0 = nil
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
node_cache[:origin][start_index] = r0
|
1081
|
+
|
1082
|
+
r0
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
module Space0
|
1086
|
+
def to_s
|
1087
|
+
text_value
|
1088
|
+
end
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
def _nt_space
|
1092
|
+
start_index = index
|
1093
|
+
if node_cache[:space].has_key?(index)
|
1094
|
+
cached = node_cache[:space][index]
|
1095
|
+
@index = cached.interval.end if cached
|
1096
|
+
return cached
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
s0, i0 = [], index
|
1100
|
+
loop do
|
1101
|
+
if has_terminal?('\G[\\s]', true, index)
|
1102
|
+
r1 = true
|
1103
|
+
@index += 1
|
1104
|
+
else
|
1105
|
+
r1 = nil
|
1106
|
+
end
|
1107
|
+
if r1
|
1108
|
+
s0 << r1
|
1109
|
+
else
|
1110
|
+
break
|
1111
|
+
end
|
1112
|
+
end
|
1113
|
+
if s0.empty?
|
1114
|
+
@index = i0
|
1115
|
+
r0 = nil
|
1116
|
+
else
|
1117
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1118
|
+
r0.extend(Space0)
|
1119
|
+
end
|
1120
|
+
|
1121
|
+
node_cache[:space][start_index] = r0
|
1122
|
+
|
1123
|
+
r0
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
module ZoneType0
|
1127
|
+
def to_s
|
1128
|
+
text_value
|
1129
|
+
end
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
def _nt_zone_type
|
1133
|
+
start_index = index
|
1134
|
+
if node_cache[:zone_type].has_key?(index)
|
1135
|
+
cached = node_cache[:zone_type][index]
|
1136
|
+
@index = cached.interval.end if cached
|
1137
|
+
return cached
|
1138
|
+
end
|
1139
|
+
|
1140
|
+
if has_terminal?("IN", false, index)
|
1141
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1142
|
+
r0.extend(ZoneType0)
|
1143
|
+
@index += 2
|
1144
|
+
else
|
1145
|
+
terminal_parse_failure("IN")
|
1146
|
+
r0 = nil
|
1147
|
+
end
|
1148
|
+
|
1149
|
+
node_cache[:zone_type][start_index] = r0
|
1150
|
+
|
1151
|
+
r0
|
1152
|
+
end
|
1153
|
+
|
1154
|
+
module Comment0
|
1155
|
+
end
|
1156
|
+
|
1157
|
+
module Comment1
|
1158
|
+
def to_s
|
1159
|
+
text_value
|
1160
|
+
end
|
1161
|
+
end
|
1162
|
+
|
1163
|
+
def _nt_comment
|
1164
|
+
start_index = index
|
1165
|
+
if node_cache[:comment].has_key?(index)
|
1166
|
+
cached = node_cache[:comment][index]
|
1167
|
+
@index = cached.interval.end if cached
|
1168
|
+
return cached
|
1169
|
+
end
|
1170
|
+
|
1171
|
+
i0, s0 = index, []
|
1172
|
+
s1, i1 = [], index
|
1173
|
+
loop do
|
1174
|
+
r2 = _nt_space
|
1175
|
+
if r2
|
1176
|
+
s1 << r2
|
1177
|
+
else
|
1178
|
+
break
|
1179
|
+
end
|
1180
|
+
end
|
1181
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1182
|
+
s0 << r1
|
1183
|
+
if r1
|
1184
|
+
if has_terminal?(";", false, index)
|
1185
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1186
|
+
@index += 1
|
1187
|
+
else
|
1188
|
+
terminal_parse_failure(";")
|
1189
|
+
r3 = nil
|
1190
|
+
end
|
1191
|
+
s0 << r3
|
1192
|
+
if r3
|
1193
|
+
s4, i4 = [], index
|
1194
|
+
loop do
|
1195
|
+
if has_terminal?('\G[^\\n]', true, index)
|
1196
|
+
r5 = true
|
1197
|
+
@index += 1
|
1198
|
+
else
|
1199
|
+
r5 = nil
|
1200
|
+
end
|
1201
|
+
if r5
|
1202
|
+
s4 << r5
|
1203
|
+
else
|
1204
|
+
break
|
1205
|
+
end
|
1206
|
+
end
|
1207
|
+
if s4.empty?
|
1208
|
+
@index = i4
|
1209
|
+
r4 = nil
|
1210
|
+
else
|
1211
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1212
|
+
end
|
1213
|
+
s0 << r4
|
1214
|
+
end
|
1215
|
+
end
|
1216
|
+
if s0.last
|
1217
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1218
|
+
r0.extend(Comment0)
|
1219
|
+
r0.extend(Comment1)
|
1220
|
+
else
|
1221
|
+
@index = i0
|
1222
|
+
r0 = nil
|
1223
|
+
end
|
1224
|
+
|
1225
|
+
node_cache[:comment][start_index] = r0
|
1226
|
+
|
1227
|
+
r0
|
1228
|
+
end
|
1229
|
+
|
1230
|
+
module Ns0
|
1231
|
+
def host
|
1232
|
+
elements[0]
|
1233
|
+
end
|
1234
|
+
|
1235
|
+
end
|
1236
|
+
|
1237
|
+
module Ns1
|
1238
|
+
def to_s
|
1239
|
+
text_value
|
1240
|
+
end
|
1241
|
+
end
|
1242
|
+
|
1243
|
+
def _nt_ns
|
1244
|
+
start_index = index
|
1245
|
+
if node_cache[:ns].has_key?(index)
|
1246
|
+
cached = node_cache[:ns][index]
|
1247
|
+
@index = cached.interval.end if cached
|
1248
|
+
return cached
|
1249
|
+
end
|
1250
|
+
|
1251
|
+
i0, s0 = index, []
|
1252
|
+
r1 = _nt_host
|
1253
|
+
s0 << r1
|
1254
|
+
if r1
|
1255
|
+
s2, i2 = [], index
|
1256
|
+
loop do
|
1257
|
+
r3 = _nt_comment
|
1258
|
+
if r3
|
1259
|
+
s2 << r3
|
1260
|
+
else
|
1261
|
+
break
|
1262
|
+
end
|
1263
|
+
end
|
1264
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1265
|
+
s0 << r2
|
1266
|
+
end
|
1267
|
+
if s0.last
|
1268
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1269
|
+
r0.extend(Ns0)
|
1270
|
+
r0.extend(Ns1)
|
1271
|
+
else
|
1272
|
+
@index = i0
|
1273
|
+
r0 = nil
|
1274
|
+
end
|
1275
|
+
|
1276
|
+
node_cache[:ns][start_index] = r0
|
1277
|
+
|
1278
|
+
r0
|
1279
|
+
end
|
1280
|
+
|
1281
|
+
module Rp0
|
1282
|
+
end
|
1283
|
+
|
1284
|
+
module Rp1
|
1285
|
+
def to_s
|
1286
|
+
text_value
|
1287
|
+
end
|
1288
|
+
end
|
1289
|
+
|
1290
|
+
def _nt_rp
|
1291
|
+
start_index = index
|
1292
|
+
if node_cache[:rp].has_key?(index)
|
1293
|
+
cached = node_cache[:rp][index]
|
1294
|
+
@index = cached.interval.end if cached
|
1295
|
+
return cached
|
1296
|
+
end
|
1297
|
+
|
1298
|
+
s0, i0 = [], index
|
1299
|
+
loop do
|
1300
|
+
i1, s1 = index, []
|
1301
|
+
s2, i2 = [], index
|
1302
|
+
loop do
|
1303
|
+
if has_terminal?('\G[a-zA-Z0-9\\-]', true, index)
|
1304
|
+
r3 = true
|
1305
|
+
@index += 1
|
1306
|
+
else
|
1307
|
+
r3 = nil
|
1308
|
+
end
|
1309
|
+
if r3
|
1310
|
+
s2 << r3
|
1311
|
+
else
|
1312
|
+
break
|
1313
|
+
end
|
1314
|
+
end
|
1315
|
+
if s2.empty?
|
1316
|
+
@index = i2
|
1317
|
+
r2 = nil
|
1318
|
+
else
|
1319
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1320
|
+
end
|
1321
|
+
s1 << r2
|
1322
|
+
if r2
|
1323
|
+
if has_terminal?(".", false, index)
|
1324
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1325
|
+
@index += 1
|
1326
|
+
else
|
1327
|
+
terminal_parse_failure(".")
|
1328
|
+
r4 = nil
|
1329
|
+
end
|
1330
|
+
s1 << r4
|
1331
|
+
end
|
1332
|
+
if s1.last
|
1333
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1334
|
+
r1.extend(Rp0)
|
1335
|
+
else
|
1336
|
+
@index = i1
|
1337
|
+
r1 = nil
|
1338
|
+
end
|
1339
|
+
if r1
|
1340
|
+
s0 << r1
|
1341
|
+
else
|
1342
|
+
break
|
1343
|
+
end
|
1344
|
+
end
|
1345
|
+
if s0.empty?
|
1346
|
+
@index = i0
|
1347
|
+
r0 = nil
|
1348
|
+
else
|
1349
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1350
|
+
r0.extend(Rp1)
|
1351
|
+
end
|
1352
|
+
|
1353
|
+
node_cache[:rp][start_index] = r0
|
1354
|
+
|
1355
|
+
r0
|
1356
|
+
end
|
1357
|
+
|
1358
|
+
module Serial0
|
1359
|
+
def integer
|
1360
|
+
elements[0]
|
1361
|
+
end
|
1362
|
+
|
1363
|
+
end
|
1364
|
+
|
1365
|
+
module Serial1
|
1366
|
+
def to_i
|
1367
|
+
integer.to_i
|
1368
|
+
end
|
1369
|
+
end
|
1370
|
+
|
1371
|
+
def _nt_serial
|
1372
|
+
start_index = index
|
1373
|
+
if node_cache[:serial].has_key?(index)
|
1374
|
+
cached = node_cache[:serial][index]
|
1375
|
+
@index = cached.interval.end if cached
|
1376
|
+
return cached
|
1377
|
+
end
|
1378
|
+
|
1379
|
+
i0, s0 = index, []
|
1380
|
+
r1 = _nt_integer
|
1381
|
+
s0 << r1
|
1382
|
+
if r1
|
1383
|
+
s2, i2 = [], index
|
1384
|
+
loop do
|
1385
|
+
r3 = _nt_comment
|
1386
|
+
if r3
|
1387
|
+
s2 << r3
|
1388
|
+
else
|
1389
|
+
break
|
1390
|
+
end
|
1391
|
+
end
|
1392
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1393
|
+
s0 << r2
|
1394
|
+
end
|
1395
|
+
if s0.last
|
1396
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1397
|
+
r0.extend(Serial0)
|
1398
|
+
r0.extend(Serial1)
|
1399
|
+
else
|
1400
|
+
@index = i0
|
1401
|
+
r0 = nil
|
1402
|
+
end
|
1403
|
+
|
1404
|
+
node_cache[:serial][start_index] = r0
|
1405
|
+
|
1406
|
+
r0
|
1407
|
+
end
|
1408
|
+
|
1409
|
+
module TimeInterval0
|
1410
|
+
def integer
|
1411
|
+
elements[0]
|
1412
|
+
end
|
1413
|
+
|
1414
|
+
def time_multiplier
|
1415
|
+
elements[1]
|
1416
|
+
end
|
1417
|
+
end
|
1418
|
+
|
1419
|
+
module TimeInterval1
|
1420
|
+
def to_s
|
1421
|
+
text_value
|
1422
|
+
end
|
1423
|
+
|
1424
|
+
def to_i
|
1425
|
+
multipliers = {
|
1426
|
+
"" => 1,
|
1427
|
+
"h" => 60 * 60,
|
1428
|
+
"d" => 60 * 60 * 24,
|
1429
|
+
"w" => 60 * 60 * 24 * 7,
|
1430
|
+
"m" => 60 * 60 * 24 * 7 * 4,
|
1431
|
+
"y" => 60 * 60 * 24 * 7 * 4 * 52
|
1432
|
+
}
|
1433
|
+
multipliers[time_multiplier.to_s] * integer.to_i
|
1434
|
+
end
|
1435
|
+
end
|
1436
|
+
|
1437
|
+
def _nt_time_interval
|
1438
|
+
start_index = index
|
1439
|
+
if node_cache[:time_interval].has_key?(index)
|
1440
|
+
cached = node_cache[:time_interval][index]
|
1441
|
+
@index = cached.interval.end if cached
|
1442
|
+
return cached
|
1443
|
+
end
|
1444
|
+
|
1445
|
+
i0, s0 = index, []
|
1446
|
+
r1 = _nt_integer
|
1447
|
+
s0 << r1
|
1448
|
+
if r1
|
1449
|
+
r2 = _nt_time_multiplier
|
1450
|
+
s0 << r2
|
1451
|
+
end
|
1452
|
+
if s0.last
|
1453
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1454
|
+
r0.extend(TimeInterval0)
|
1455
|
+
r0.extend(TimeInterval1)
|
1456
|
+
else
|
1457
|
+
@index = i0
|
1458
|
+
r0 = nil
|
1459
|
+
end
|
1460
|
+
|
1461
|
+
node_cache[:time_interval][start_index] = r0
|
1462
|
+
|
1463
|
+
r0
|
1464
|
+
end
|
1465
|
+
|
1466
|
+
module Refresh0
|
1467
|
+
def time_interval
|
1468
|
+
elements[0]
|
1469
|
+
end
|
1470
|
+
|
1471
|
+
end
|
1472
|
+
|
1473
|
+
module Refresh1
|
1474
|
+
def to_i
|
1475
|
+
time_interval.to_i
|
1476
|
+
end
|
1477
|
+
end
|
1478
|
+
|
1479
|
+
def _nt_refresh
|
1480
|
+
start_index = index
|
1481
|
+
if node_cache[:refresh].has_key?(index)
|
1482
|
+
cached = node_cache[:refresh][index]
|
1483
|
+
@index = cached.interval.end if cached
|
1484
|
+
return cached
|
1485
|
+
end
|
1486
|
+
|
1487
|
+
i0, s0 = index, []
|
1488
|
+
r1 = _nt_time_interval
|
1489
|
+
s0 << r1
|
1490
|
+
if r1
|
1491
|
+
s2, i2 = [], index
|
1492
|
+
loop do
|
1493
|
+
r3 = _nt_comment
|
1494
|
+
if r3
|
1495
|
+
s2 << r3
|
1496
|
+
else
|
1497
|
+
break
|
1498
|
+
end
|
1499
|
+
end
|
1500
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1501
|
+
s0 << r2
|
1502
|
+
end
|
1503
|
+
if s0.last
|
1504
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1505
|
+
r0.extend(Refresh0)
|
1506
|
+
r0.extend(Refresh1)
|
1507
|
+
else
|
1508
|
+
@index = i0
|
1509
|
+
r0 = nil
|
1510
|
+
end
|
1511
|
+
|
1512
|
+
node_cache[:refresh][start_index] = r0
|
1513
|
+
|
1514
|
+
r0
|
1515
|
+
end
|
1516
|
+
|
1517
|
+
module Integer0
|
1518
|
+
def to_i
|
1519
|
+
text_value.to_i
|
1520
|
+
end
|
1521
|
+
end
|
1522
|
+
|
1523
|
+
def _nt_integer
|
1524
|
+
start_index = index
|
1525
|
+
if node_cache[:integer].has_key?(index)
|
1526
|
+
cached = node_cache[:integer][index]
|
1527
|
+
@index = cached.interval.end if cached
|
1528
|
+
return cached
|
1529
|
+
end
|
1530
|
+
|
1531
|
+
s0, i0 = [], index
|
1532
|
+
loop do
|
1533
|
+
if has_terminal?('\G[0-9]', true, index)
|
1534
|
+
r1 = true
|
1535
|
+
@index += 1
|
1536
|
+
else
|
1537
|
+
r1 = nil
|
1538
|
+
end
|
1539
|
+
if r1
|
1540
|
+
s0 << r1
|
1541
|
+
else
|
1542
|
+
break
|
1543
|
+
end
|
1544
|
+
end
|
1545
|
+
if s0.empty?
|
1546
|
+
@index = i0
|
1547
|
+
r0 = nil
|
1548
|
+
else
|
1549
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1550
|
+
r0.extend(Integer0)
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
node_cache[:integer][start_index] = r0
|
1554
|
+
|
1555
|
+
r0
|
1556
|
+
end
|
1557
|
+
|
1558
|
+
module TimeMultiplier0
|
1559
|
+
def to_s
|
1560
|
+
text_value
|
1561
|
+
end
|
1562
|
+
end
|
1563
|
+
|
1564
|
+
def _nt_time_multiplier
|
1565
|
+
start_index = index
|
1566
|
+
if node_cache[:time_multiplier].has_key?(index)
|
1567
|
+
cached = node_cache[:time_multiplier][index]
|
1568
|
+
@index = cached.interval.end if cached
|
1569
|
+
return cached
|
1570
|
+
end
|
1571
|
+
|
1572
|
+
i0 = index
|
1573
|
+
if has_terminal?("h", false, index)
|
1574
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1575
|
+
@index += 1
|
1576
|
+
else
|
1577
|
+
terminal_parse_failure("h")
|
1578
|
+
r1 = nil
|
1579
|
+
end
|
1580
|
+
if r1
|
1581
|
+
r0 = r1
|
1582
|
+
r0.extend(TimeMultiplier0)
|
1583
|
+
else
|
1584
|
+
if has_terminal?("d", false, index)
|
1585
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1586
|
+
@index += 1
|
1587
|
+
else
|
1588
|
+
terminal_parse_failure("d")
|
1589
|
+
r2 = nil
|
1590
|
+
end
|
1591
|
+
if r2
|
1592
|
+
r0 = r2
|
1593
|
+
r0.extend(TimeMultiplier0)
|
1594
|
+
else
|
1595
|
+
if has_terminal?("w", false, index)
|
1596
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1597
|
+
@index += 1
|
1598
|
+
else
|
1599
|
+
terminal_parse_failure("w")
|
1600
|
+
r3 = nil
|
1601
|
+
end
|
1602
|
+
if r3
|
1603
|
+
r0 = r3
|
1604
|
+
r0.extend(TimeMultiplier0)
|
1605
|
+
else
|
1606
|
+
if has_terminal?("m", false, index)
|
1607
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1608
|
+
@index += 1
|
1609
|
+
else
|
1610
|
+
terminal_parse_failure("m")
|
1611
|
+
r4 = nil
|
1612
|
+
end
|
1613
|
+
if r4
|
1614
|
+
r0 = r4
|
1615
|
+
r0.extend(TimeMultiplier0)
|
1616
|
+
else
|
1617
|
+
if has_terminal?("y", false, index)
|
1618
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1619
|
+
@index += 1
|
1620
|
+
else
|
1621
|
+
terminal_parse_failure("y")
|
1622
|
+
r5 = nil
|
1623
|
+
end
|
1624
|
+
if r5
|
1625
|
+
r0 = r5
|
1626
|
+
r0.extend(TimeMultiplier0)
|
1627
|
+
else
|
1628
|
+
if has_terminal?("", false, index)
|
1629
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 0))
|
1630
|
+
@index += 0
|
1631
|
+
else
|
1632
|
+
terminal_parse_failure("")
|
1633
|
+
r6 = nil
|
1634
|
+
end
|
1635
|
+
if r6
|
1636
|
+
r0 = r6
|
1637
|
+
r0.extend(TimeMultiplier0)
|
1638
|
+
else
|
1639
|
+
@index = i0
|
1640
|
+
r0 = nil
|
1641
|
+
end
|
1642
|
+
end
|
1643
|
+
end
|
1644
|
+
end
|
1645
|
+
end
|
1646
|
+
end
|
1647
|
+
|
1648
|
+
node_cache[:time_multiplier][start_index] = r0
|
1649
|
+
|
1650
|
+
r0
|
1651
|
+
end
|
1652
|
+
|
1653
|
+
module Retry0
|
1654
|
+
def time_interval
|
1655
|
+
elements[0]
|
1656
|
+
end
|
1657
|
+
|
1658
|
+
end
|
1659
|
+
|
1660
|
+
module Retry1
|
1661
|
+
def to_i
|
1662
|
+
time_interval.to_i
|
1663
|
+
end
|
1664
|
+
end
|
1665
|
+
|
1666
|
+
def _nt_retry
|
1667
|
+
start_index = index
|
1668
|
+
if node_cache[:retry].has_key?(index)
|
1669
|
+
cached = node_cache[:retry][index]
|
1670
|
+
@index = cached.interval.end if cached
|
1671
|
+
return cached
|
1672
|
+
end
|
1673
|
+
|
1674
|
+
i0, s0 = index, []
|
1675
|
+
r1 = _nt_time_interval
|
1676
|
+
s0 << r1
|
1677
|
+
if r1
|
1678
|
+
s2, i2 = [], index
|
1679
|
+
loop do
|
1680
|
+
r3 = _nt_comment
|
1681
|
+
if r3
|
1682
|
+
s2 << r3
|
1683
|
+
else
|
1684
|
+
break
|
1685
|
+
end
|
1686
|
+
end
|
1687
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1688
|
+
s0 << r2
|
1689
|
+
end
|
1690
|
+
if s0.last
|
1691
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1692
|
+
r0.extend(Retry0)
|
1693
|
+
r0.extend(Retry1)
|
1694
|
+
else
|
1695
|
+
@index = i0
|
1696
|
+
r0 = nil
|
1697
|
+
end
|
1698
|
+
|
1699
|
+
node_cache[:retry][start_index] = r0
|
1700
|
+
|
1701
|
+
r0
|
1702
|
+
end
|
1703
|
+
|
1704
|
+
module Expiry0
|
1705
|
+
def time_interval
|
1706
|
+
elements[0]
|
1707
|
+
end
|
1708
|
+
|
1709
|
+
end
|
1710
|
+
|
1711
|
+
module Expiry1
|
1712
|
+
def to_i
|
1713
|
+
time_interval.to_i
|
1714
|
+
end
|
1715
|
+
end
|
1716
|
+
|
1717
|
+
def _nt_expiry
|
1718
|
+
start_index = index
|
1719
|
+
if node_cache[:expiry].has_key?(index)
|
1720
|
+
cached = node_cache[:expiry][index]
|
1721
|
+
@index = cached.interval.end if cached
|
1722
|
+
return cached
|
1723
|
+
end
|
1724
|
+
|
1725
|
+
i0, s0 = index, []
|
1726
|
+
r1 = _nt_time_interval
|
1727
|
+
s0 << r1
|
1728
|
+
if r1
|
1729
|
+
s2, i2 = [], index
|
1730
|
+
loop do
|
1731
|
+
r3 = _nt_comment
|
1732
|
+
if r3
|
1733
|
+
s2 << r3
|
1734
|
+
else
|
1735
|
+
break
|
1736
|
+
end
|
1737
|
+
end
|
1738
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1739
|
+
s0 << r2
|
1740
|
+
end
|
1741
|
+
if s0.last
|
1742
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1743
|
+
r0.extend(Expiry0)
|
1744
|
+
r0.extend(Expiry1)
|
1745
|
+
else
|
1746
|
+
@index = i0
|
1747
|
+
r0 = nil
|
1748
|
+
end
|
1749
|
+
|
1750
|
+
node_cache[:expiry][start_index] = r0
|
1751
|
+
|
1752
|
+
r0
|
1753
|
+
end
|
1754
|
+
|
1755
|
+
module Ttl0
|
1756
|
+
def time_interval
|
1757
|
+
elements[0]
|
1758
|
+
end
|
1759
|
+
|
1760
|
+
end
|
1761
|
+
|
1762
|
+
module Ttl1
|
1763
|
+
def to_i
|
1764
|
+
time_interval.to_i
|
1765
|
+
end
|
1766
|
+
end
|
1767
|
+
|
1768
|
+
def _nt_ttl
|
1769
|
+
start_index = index
|
1770
|
+
if node_cache[:ttl].has_key?(index)
|
1771
|
+
cached = node_cache[:ttl][index]
|
1772
|
+
@index = cached.interval.end if cached
|
1773
|
+
return cached
|
1774
|
+
end
|
1775
|
+
|
1776
|
+
i0, s0 = index, []
|
1777
|
+
r1 = _nt_time_interval
|
1778
|
+
s0 << r1
|
1779
|
+
if r1
|
1780
|
+
s2, i2 = [], index
|
1781
|
+
loop do
|
1782
|
+
r3 = _nt_comment
|
1783
|
+
if r3
|
1784
|
+
s2 << r3
|
1785
|
+
else
|
1786
|
+
break
|
1787
|
+
end
|
1788
|
+
end
|
1789
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1790
|
+
s0 << r2
|
1791
|
+
end
|
1792
|
+
if s0.last
|
1793
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1794
|
+
r0.extend(Ttl0)
|
1795
|
+
r0.extend(Ttl1)
|
1796
|
+
else
|
1797
|
+
@index = i0
|
1798
|
+
r0 = nil
|
1799
|
+
end
|
1800
|
+
|
1801
|
+
node_cache[:ttl][start_index] = r0
|
1802
|
+
|
1803
|
+
r0
|
1804
|
+
end
|
1805
|
+
|
1806
|
+
module Host0
|
1807
|
+
def zone
|
1808
|
+
p = parent
|
1809
|
+
while p.respond_to?(:parent) && p.parent
|
1810
|
+
p = p.parent
|
1811
|
+
end
|
1812
|
+
p
|
1813
|
+
end
|
1814
|
+
|
1815
|
+
def to_s
|
1816
|
+
case
|
1817
|
+
when text_value =~ /\.$/
|
1818
|
+
text_value
|
1819
|
+
when text_value == "@" || text_value == ""
|
1820
|
+
if parent == zone.soa.origin
|
1821
|
+
zone.variables['ORIGIN']
|
1822
|
+
else
|
1823
|
+
zone.origin.to_s
|
1824
|
+
end
|
1825
|
+
else
|
1826
|
+
text_value + '.' + zone.origin.to_s
|
1827
|
+
end
|
1828
|
+
end
|
1829
|
+
end
|
1830
|
+
|
1831
|
+
def _nt_host
|
1832
|
+
start_index = index
|
1833
|
+
if node_cache[:host].has_key?(index)
|
1834
|
+
cached = node_cache[:host][index]
|
1835
|
+
@index = cached.interval.end if cached
|
1836
|
+
return cached
|
1837
|
+
end
|
1838
|
+
|
1839
|
+
i0 = index
|
1840
|
+
s1, i1 = [], index
|
1841
|
+
loop do
|
1842
|
+
if has_terminal?('\G[a-zA-Z0-9\\-\\.]', true, index)
|
1843
|
+
r2 = true
|
1844
|
+
@index += 1
|
1845
|
+
else
|
1846
|
+
r2 = nil
|
1847
|
+
end
|
1848
|
+
if r2
|
1849
|
+
s1 << r2
|
1850
|
+
else
|
1851
|
+
break
|
1852
|
+
end
|
1853
|
+
end
|
1854
|
+
if s1.empty?
|
1855
|
+
@index = i1
|
1856
|
+
r1 = nil
|
1857
|
+
else
|
1858
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1859
|
+
end
|
1860
|
+
if r1
|
1861
|
+
r0 = r1
|
1862
|
+
r0.extend(Host0)
|
1863
|
+
else
|
1864
|
+
if has_terminal?("@", false, index)
|
1865
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1866
|
+
@index += 1
|
1867
|
+
else
|
1868
|
+
terminal_parse_failure("@")
|
1869
|
+
r4 = nil
|
1870
|
+
end
|
1871
|
+
if r4
|
1872
|
+
r3 = r4
|
1873
|
+
else
|
1874
|
+
r3 = instantiate_node(SyntaxNode,input, index...index)
|
1875
|
+
end
|
1876
|
+
if r3
|
1877
|
+
r0 = r3
|
1878
|
+
r0.extend(Host0)
|
1879
|
+
else
|
1880
|
+
@index = i0
|
1881
|
+
r0 = nil
|
1882
|
+
end
|
1883
|
+
end
|
1884
|
+
|
1885
|
+
node_cache[:host][start_index] = r0
|
1886
|
+
|
1887
|
+
r0
|
1888
|
+
end
|
1889
|
+
|
1890
|
+
end
|
1891
|
+
|
1892
|
+
class ZonefileParser < Treetop::Runtime::CompiledParser
|
1893
|
+
include ZonefileGrammar # :nodoc:
|
1894
|
+
end
|
1895
|
+
end
|