dns-zonefile 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,308 @@
1
- require 'dns/zonefile_parser'
1
+ require 'dns/zonefile/parser'
2
2
 
3
3
  module DNS
4
- class Zonefile
5
- VERSION = "0.0.1"
6
-
7
- attr_reader :origin, :soa
8
-
4
+ module Zonefile
9
5
  class << self
10
6
  def parse(zone_string)
11
- parser = DNS::ZonefileParser.new
12
- parser.parse(zone_string)
7
+ parser = DNS::Zonefile::Parser.new
8
+ if result = parser.parse(zone_string)
9
+ result
10
+ else
11
+ raise ParsingError, parser.failure_reason
12
+ end
13
+ end
14
+
15
+ def load(zone_string, alternate_origin=nil)
16
+ Zone.new(parse(zone_string).entries, alternate_origin)
17
+ end
18
+ end
19
+
20
+ class ParsingError < RuntimeError ; end
21
+ class UnknownRecordType < RuntimeError ; end
22
+ class Zone
23
+ attr_reader :origin, :soa
24
+ attr_reader :records
25
+
26
+ def initialize(entries, alternate_origin=nil)
27
+ alternate_origin ||= '.'
28
+ @records = []
29
+ @vars = {'origin'=>alternate_origin, :last_host=>'.'}
30
+ entries.each do |e|
31
+ case e.parse_type
32
+ when :variable
33
+ case key = e.name.text_value.downcase
34
+ when 'ttl'
35
+ @vars[key] = e.value.text_value.to_i
36
+ else
37
+ @vars[key] = e.value.text_value
38
+ end
39
+ when :soa
40
+ @records << SOA.new(@vars, e)
41
+ when :record
42
+ case e.record_type
43
+ when 'A' then @records << A.new(@vars, e)
44
+ when 'AAAA' then @records << AAAA.new(@vars, e)
45
+ when 'CNAME' then @records << CNAME.new(@vars, e)
46
+ when 'MX' then @records << MX.new(@vars, e)
47
+ when 'NAPTR' then @records << NAPTR.new(@vars, e)
48
+ when 'NS' then @records << NS.new(@vars, e)
49
+ when 'PTR' then @records << PTR.new(@vars, e)
50
+ when 'SRV' then @records << SRV.new(@vars, e)
51
+ when 'SPF' then @records << SPF.new(@vars, e)
52
+ when 'TXT' then @records << TXT.new(@vars, e)
53
+ when 'SOA' then ;
54
+ else
55
+ raise UnknownRecordType, "Unknown record type: #{e.record_type}"
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ def soa
62
+ records_of(SOA).first
13
63
  end
64
+
65
+ def records_of(kl)
66
+ @records.select{|r| r.instance_of? kl}
67
+ end
68
+ end
69
+
70
+ class Record
71
+ # assign, with handling for '@'
72
+ def self.writer_for_at(*attribs)
73
+ attribs.each do |attrib|
74
+ c = <<-MTH
75
+ def #{attrib}=(val)
76
+ @#{attrib} = val.gsub('@', @vars['origin'])
77
+ end
78
+ MTH
79
+ class_eval c, __FILE__, __LINE__
80
+ end
81
+ end
82
+
83
+ # assign, with handling for '@', with inheritance
84
+ def self.inheriting_writer_for_at(*attribs)
85
+ attribs.each do |attrib|
86
+ c = <<-MTH
87
+ def #{attrib}=(val)
88
+ if val.strip.empty?
89
+ @#{attrib} = @vars[:last_host]
90
+ else
91
+ @#{attrib} = val.gsub('@', @vars['origin'])
92
+ end
93
+ end
94
+ MTH
95
+ class_eval c, __FILE__, __LINE__
96
+ end
97
+ end
98
+
99
+ # assign, with handling for global TTL
100
+ def self.writer_for_ttl(*attribs)
101
+ attribs.each do |attrib|
102
+ c = <<-MTH
103
+ def #{attrib}=(val)
104
+ @#{attrib} = val || @vars['ttl']
105
+ end
106
+ MTH
107
+ class_eval c, __FILE__, __LINE__
108
+ end
109
+ end
110
+
111
+ attr_reader :ttl
112
+ attr_writer :klass
113
+ writer_for_ttl :ttl
114
+
115
+ def klass
116
+ @klass = nil if @klass == ''
117
+ @klass ||= 'IN'
118
+ end
119
+
120
+ end
121
+
122
+ class SOA < Record
123
+ attr_accessor :origin, :nameserver, :responsible_party, :serial, :refresh_time, :retry_time, :expiry_time, :nxttl
124
+
125
+ writer_for_at :origin, :nameserver, :responsible_party
126
+
127
+ def initialize(vars, zonefile_soa=nil)
128
+ @vars = vars
129
+ if zonefile_soa
130
+ self.origin = zonefile_soa.origin.to_s
131
+ @vars[:last_host] = self.origin
132
+ self.ttl = zonefile_soa.ttl.to_i
133
+ self.klass = zonefile_soa.klass.to_s
134
+ self.nameserver = zonefile_soa.ns.to_s
135
+ self.responsible_party = zonefile_soa.rp.to_s
136
+ self.serial = zonefile_soa.serial.to_i
137
+ self.refresh_time = zonefile_soa.refresh.to_i
138
+ self.retry_time = zonefile_soa.reretry.to_i
139
+ self.expiry_time = zonefile_soa.expiry.to_i
140
+ self.nxttl = zonefile_soa.nxttl.to_i
141
+ end
142
+ end
143
+ end
144
+
145
+ class A < Record
146
+ attr_accessor :host, :address
147
+
148
+ inheriting_writer_for_at :host
149
+
150
+ def initialize(vars, zonefile_record)
151
+ @vars = vars
152
+ if zonefile_record
153
+ self.host = zonefile_record.host.to_s
154
+ @vars[:last_host] = self.host
155
+ self.ttl = zonefile_record.ttl.to_i
156
+ self.klass = zonefile_record.klass.to_s
157
+ self.address = zonefile_record.ip_address.to_s
158
+ end
159
+ end
160
+ end
161
+
162
+ class AAAA < A
163
+ end
164
+
165
+ class CNAME < Record
166
+ attr_accessor :host, :domainname
167
+
168
+ inheriting_writer_for_at :host
169
+ writer_for_at :domainname
170
+
171
+ def initialize(vars, zonefile_record)
172
+ @vars = vars
173
+ if zonefile_record
174
+ self.host = zonefile_record.host.to_s
175
+ @vars[:last_host] = self.host
176
+ self.ttl = zonefile_record.ttl.to_i
177
+ self.klass = zonefile_record.klass.to_s
178
+ self.domainname = zonefile_record.target.to_s
179
+ end
180
+ end
181
+
182
+ alias :target :domainname
183
+ alias :alias :host
184
+ end
185
+
186
+ class MX < Record
187
+ attr_accessor :host, :priority, :domainname
188
+
189
+ inheriting_writer_for_at :host
190
+ writer_for_at :domainname
191
+
192
+ def initialize(vars, zonefile_record)
193
+ @vars = vars
194
+ if zonefile_record
195
+ self.host = zonefile_record.host.to_s
196
+ @vars[:last_host] = self.host
197
+ self.ttl = zonefile_record.ttl.to_i
198
+ self.klass = zonefile_record.klass.to_s
199
+ self.priority = zonefile_record.priority.to_i
200
+ self.domainname = zonefile_record.exchanger.to_s
201
+ end
202
+ end
203
+
204
+ alias :exchange :domainname
205
+ alias :exchanger :domainname
206
+ end
207
+
208
+ class NAPTR < Record
209
+ attr_accessor :host, :data
210
+
211
+ inheriting_writer_for_at :host
212
+
213
+ def initialize(vars, zonefile_record)
214
+ @vars = vars
215
+ if zonefile_record
216
+ self.host = zonefile_record.host.to_s
217
+ @vars[:last_host] = self.host
218
+ self.ttl = zonefile_record.ttl.to_i
219
+ self.klass = zonefile_record.klass.to_s
220
+ self.data = zonefile_record.data.to_s
221
+ end
222
+ end
223
+ end
224
+
225
+ class NS < Record
226
+ attr_accessor :host, :domainname
227
+
228
+ inheriting_writer_for_at :host
229
+ writer_for_at :domainname
230
+
231
+ def initialize(vars, zonefile_record)
232
+ @vars = vars
233
+ if zonefile_record
234
+ self.host = zonefile_record.host.to_s
235
+ @vars[:last_host] = self.host
236
+ self.ttl = zonefile_record.ttl.to_i
237
+ self.klass = zonefile_record.klass.to_s
238
+ self.domainname = zonefile_record.nameserver.to_s
239
+ end
240
+ end
241
+
242
+ alias :nameserver :domainname
243
+ end
244
+
245
+ class PTR < Record
246
+ attr_accessor :host, :domainname
247
+
248
+ inheriting_writer_for_at :host
249
+ writer_for_at :domainname
250
+
251
+ def initialize(vars, zonefile_record)
252
+ @vars = vars
253
+ if zonefile_record
254
+ self.host = zonefile_record.host.to_s
255
+ @vars[:last_host] = self.host
256
+ self.ttl = zonefile_record.ttl.to_i
257
+ self.klass = zonefile_record.klass.to_s
258
+ self.domainname = zonefile_record.target.to_s
259
+ end
260
+ end
261
+
262
+ alias :target :domainname
263
+ end
264
+
265
+ class SRV < Record
266
+ attr_accessor :host, :priority, :weight, :port, :domainname
267
+
268
+ inheriting_writer_for_at :host
269
+ writer_for_at :domainname
270
+
271
+ def initialize(vars, zonefile_record)
272
+ @vars = vars
273
+ if zonefile_record
274
+ self.host = zonefile_record.host.to_s
275
+ @vars[:last_host] = self.host
276
+ self.ttl = zonefile_record.ttl.to_i
277
+ self.klass = zonefile_record.klass.to_s
278
+ self.priority = zonefile_record.priority.to_i
279
+ self.weight = zonefile_record.weight.to_i
280
+ self.port = zonefile_record.port.to_i
281
+ self.domainname = zonefile_record.target.to_s
282
+ end
283
+ end
284
+
285
+ alias :target :domainname
286
+ end
287
+
288
+ class TXT < Record
289
+ attr_accessor :host, :data
290
+
291
+ inheriting_writer_for_at :host
292
+
293
+ def initialize(vars, zonefile_record)
294
+ @vars = vars
295
+ if zonefile_record
296
+ self.host = zonefile_record.host.to_s
297
+ @vars[:last_host] = self.host
298
+ self.ttl = zonefile_record.ttl.to_i
299
+ self.klass = zonefile_record.klass.to_s
300
+ self.data = zonefile_record.data.to_s
301
+ end
302
+ end
303
+ end
304
+
305
+ class SPF < TXT
14
306
  end
15
307
  end
16
- end
308
+ end
@@ -0,0 +1,3435 @@
1
+ require 'treetop'
2
+
3
+ module DNS
4
+ module Zonefile
5
+ # Autogenerated from a Treetop grammar. Edits may be lost.
6
+
7
+
8
+ module ZonefileGrammar # :nodoc:
9
+ include Treetop::Runtime
10
+
11
+ def root
12
+ @root ||= :zone
13
+ end
14
+
15
+ module Zone0
16
+ def soa
17
+ elements[1]
18
+ end
19
+
20
+ end
21
+
22
+ module Zone1
23
+ def variables
24
+ @variables ||= begin
25
+ raw = elements[0].elements.select { |e| e.to_s =~ /^\$/ }
26
+ variables = {}
27
+ raw.each do |e|
28
+ variables[e.name.text_value.to_s] = e.value.text_value.to_s
29
+ end
30
+ variables
31
+ end
32
+ end
33
+
34
+ def origin
35
+ soa.origin.host.to_s
36
+ end
37
+
38
+ def to_s
39
+ text_value
40
+ end
41
+
42
+ def rr
43
+ elements[-1].elements.select { |e| e.to_s !~ /\A\s*([;$].*)?\z|\A\z/; }
44
+ end
45
+
46
+ def entries
47
+ elements[0].elements.select { |e| e.to_s !~ /\A\s*(;.*)?\z|\A\z/; } +
48
+ [soa] +
49
+ elements[-1].elements.select { |e| e.to_s !~ /\A\s*(;.*)?\z|\A\z/; }
50
+ end
51
+ end
52
+
53
+ def _nt_zone
54
+ start_index = index
55
+ if node_cache[:zone].has_key?(index)
56
+ cached = node_cache[:zone][index]
57
+ if cached
58
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
59
+ @index = cached.interval.end
60
+ end
61
+ return cached
62
+ end
63
+
64
+ i0, s0 = index, []
65
+ s1, i1 = [], index
66
+ loop do
67
+ i2 = index
68
+ r3 = _nt_variable
69
+ if r3
70
+ r2 = r3
71
+ else
72
+ r4 = _nt_space_or_break
73
+ if r4
74
+ r2 = r4
75
+ else
76
+ r5 = _nt_comment
77
+ if r5
78
+ r2 = r5
79
+ else
80
+ @index = i2
81
+ r2 = nil
82
+ end
83
+ end
84
+ end
85
+ if r2
86
+ s1 << r2
87
+ else
88
+ break
89
+ end
90
+ end
91
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
92
+ s0 << r1
93
+ if r1
94
+ r6 = _nt_soa
95
+ s0 << r6
96
+ if r6
97
+ s7, i7 = [], index
98
+ loop do
99
+ i8 = index
100
+ r9 = _nt_resource_record
101
+ if r9
102
+ r8 = r9
103
+ else
104
+ r10 = _nt_variable
105
+ if r10
106
+ r8 = r10
107
+ else
108
+ r11 = _nt_comment
109
+ if r11
110
+ r8 = r11
111
+ else
112
+ r12 = _nt_space
113
+ if r12
114
+ r8 = r12
115
+ else
116
+ r13 = _nt_linebreak
117
+ if r13
118
+ r8 = r13
119
+ else
120
+ @index = i8
121
+ r8 = nil
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
127
+ if r8
128
+ s7 << r8
129
+ else
130
+ break
131
+ end
132
+ end
133
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
134
+ s0 << r7
135
+ end
136
+ end
137
+ if s0.last
138
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
139
+ r0.extend(Zone0)
140
+ r0.extend(Zone1)
141
+ else
142
+ @index = i0
143
+ r0 = nil
144
+ end
145
+
146
+ node_cache[:zone][start_index] = r0
147
+
148
+ r0
149
+ end
150
+
151
+ module Variable0
152
+ def name
153
+ elements[1]
154
+ end
155
+
156
+ def space
157
+ elements[2]
158
+ end
159
+
160
+ def value
161
+ elements[3]
162
+ end
163
+
164
+ end
165
+
166
+ module Variable1
167
+ def to_s
168
+ "$#{name.text_value.to_s} #{value.text_value.to_s}"
169
+ end
170
+
171
+ def parse_type ; :variable ; end
172
+ end
173
+
174
+ def _nt_variable
175
+ start_index = index
176
+ if node_cache[:variable].has_key?(index)
177
+ cached = node_cache[:variable][index]
178
+ if cached
179
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
180
+ @index = cached.interval.end
181
+ end
182
+ return cached
183
+ end
184
+
185
+ i0, s0 = index, []
186
+ if has_terminal?("$", false, index)
187
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
188
+ @index += 1
189
+ else
190
+ terminal_parse_failure("$")
191
+ r1 = nil
192
+ end
193
+ s0 << r1
194
+ if r1
195
+ s2, i2 = [], index
196
+ loop do
197
+ if has_terminal?('\G[a-zA-Z0-9]', true, index)
198
+ r3 = true
199
+ @index += 1
200
+ else
201
+ r3 = nil
202
+ end
203
+ if r3
204
+ s2 << r3
205
+ else
206
+ break
207
+ end
208
+ end
209
+ if s2.empty?
210
+ @index = i2
211
+ r2 = nil
212
+ else
213
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
214
+ end
215
+ s0 << r2
216
+ if r2
217
+ r4 = _nt_space
218
+ s0 << r4
219
+ if r4
220
+ s5, i5 = [], index
221
+ loop do
222
+ if has_terminal?('\G[a-zA-Z0-9\\.\\-]', true, index)
223
+ r6 = true
224
+ @index += 1
225
+ else
226
+ r6 = nil
227
+ end
228
+ if r6
229
+ s5 << r6
230
+ else
231
+ break
232
+ end
233
+ end
234
+ if s5.empty?
235
+ @index = i5
236
+ r5 = nil
237
+ else
238
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
239
+ end
240
+ s0 << r5
241
+ if r5
242
+ r8 = _nt_space
243
+ if r8
244
+ r7 = r8
245
+ else
246
+ r7 = instantiate_node(SyntaxNode,input, index...index)
247
+ end
248
+ s0 << r7
249
+ if r7
250
+ r10 = _nt_comment
251
+ if r10
252
+ r9 = r10
253
+ else
254
+ r9 = instantiate_node(SyntaxNode,input, index...index)
255
+ end
256
+ s0 << r9
257
+ end
258
+ end
259
+ end
260
+ end
261
+ end
262
+ if s0.last
263
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
264
+ r0.extend(Variable0)
265
+ r0.extend(Variable1)
266
+ else
267
+ @index = i0
268
+ r0 = nil
269
+ end
270
+
271
+ node_cache[:variable][start_index] = r0
272
+
273
+ r0
274
+ end
275
+
276
+ module Soa0
277
+ def origin
278
+ elements[0]
279
+ end
280
+
281
+ def space1
282
+ elements[1]
283
+ end
284
+
285
+ def ttl
286
+ elements[2]
287
+ end
288
+
289
+ def klass
290
+ elements[3]
291
+ end
292
+
293
+ def space2
294
+ elements[5]
295
+ end
296
+
297
+ def ns
298
+ elements[6]
299
+ end
300
+
301
+ def space3
302
+ elements[7]
303
+ end
304
+
305
+ def rp
306
+ elements[8]
307
+ end
308
+
309
+ def space4
310
+ elements[9]
311
+ end
312
+
313
+ def serial
314
+ elements[12]
315
+ end
316
+
317
+ def space_or_break1
318
+ elements[13]
319
+ end
320
+
321
+ def refresh
322
+ elements[14]
323
+ end
324
+
325
+ def space_or_break2
326
+ elements[15]
327
+ end
328
+
329
+ def reretry
330
+ elements[16]
331
+ end
332
+
333
+ def space_or_break3
334
+ elements[17]
335
+ end
336
+
337
+ def expiry
338
+ elements[18]
339
+ end
340
+
341
+ def space_or_break4
342
+ elements[19]
343
+ end
344
+
345
+ def nxttl
346
+ elements[20]
347
+ end
348
+
349
+ end
350
+
351
+ module Soa1
352
+ def to_s
353
+ "#{origin} #{ttl} #{klass} SOA #{ns} #{rp} (#{serial} #{refresh} #{reretry} #{expiry} #{nxttl})"
354
+ end
355
+
356
+ def parse_type ; :soa ; end
357
+ end
358
+
359
+ def _nt_soa
360
+ start_index = index
361
+ if node_cache[:soa].has_key?(index)
362
+ cached = node_cache[:soa][index]
363
+ if cached
364
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
365
+ @index = cached.interval.end
366
+ end
367
+ return cached
368
+ end
369
+
370
+ i0, s0 = index, []
371
+ r1 = _nt_origin
372
+ s0 << r1
373
+ if r1
374
+ r2 = _nt_space
375
+ s0 << r2
376
+ if r2
377
+ r3 = _nt_ttl
378
+ s0 << r3
379
+ if r3
380
+ r4 = _nt_klass
381
+ s0 << r4
382
+ if r4
383
+ if has_terminal?("SOA", false, index)
384
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
385
+ @index += 3
386
+ else
387
+ terminal_parse_failure("SOA")
388
+ r5 = nil
389
+ end
390
+ s0 << r5
391
+ if r5
392
+ r6 = _nt_space
393
+ s0 << r6
394
+ if r6
395
+ r7 = _nt_ns
396
+ s0 << r7
397
+ if r7
398
+ r8 = _nt_space
399
+ s0 << r8
400
+ if r8
401
+ r9 = _nt_rp
402
+ s0 << r9
403
+ if r9
404
+ r10 = _nt_space
405
+ s0 << r10
406
+ if r10
407
+ if has_terminal?("(", false, index)
408
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
409
+ @index += 1
410
+ else
411
+ terminal_parse_failure("(")
412
+ r12 = nil
413
+ end
414
+ if r12
415
+ r11 = r12
416
+ else
417
+ r11 = instantiate_node(SyntaxNode,input, index...index)
418
+ end
419
+ s0 << r11
420
+ if r11
421
+ s13, i13 = [], index
422
+ loop do
423
+ r14 = _nt_space_or_break
424
+ if r14
425
+ s13 << r14
426
+ else
427
+ break
428
+ end
429
+ end
430
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
431
+ s0 << r13
432
+ if r13
433
+ r15 = _nt_serial
434
+ s0 << r15
435
+ if r15
436
+ r16 = _nt_space_or_break
437
+ s0 << r16
438
+ if r16
439
+ r17 = _nt_refresh
440
+ s0 << r17
441
+ if r17
442
+ r18 = _nt_space_or_break
443
+ s0 << r18
444
+ if r18
445
+ r19 = _nt_reretry
446
+ s0 << r19
447
+ if r19
448
+ r20 = _nt_space_or_break
449
+ s0 << r20
450
+ if r20
451
+ r21 = _nt_expiry
452
+ s0 << r21
453
+ if r21
454
+ r22 = _nt_space_or_break
455
+ s0 << r22
456
+ if r22
457
+ r23 = _nt_nxttl
458
+ s0 << r23
459
+ if r23
460
+ s24, i24 = [], index
461
+ loop do
462
+ r25 = _nt_space_or_break
463
+ if r25
464
+ s24 << r25
465
+ else
466
+ break
467
+ end
468
+ end
469
+ r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
470
+ s0 << r24
471
+ if r24
472
+ if has_terminal?(")", false, index)
473
+ r27 = instantiate_node(SyntaxNode,input, index...(index + 1))
474
+ @index += 1
475
+ else
476
+ terminal_parse_failure(")")
477
+ r27 = nil
478
+ end
479
+ if r27
480
+ r26 = r27
481
+ else
482
+ r26 = instantiate_node(SyntaxNode,input, index...index)
483
+ end
484
+ s0 << r26
485
+ end
486
+ end
487
+ end
488
+ end
489
+ end
490
+ end
491
+ end
492
+ end
493
+ end
494
+ end
495
+ end
496
+ end
497
+ end
498
+ end
499
+ end
500
+ end
501
+ end
502
+ end
503
+ end
504
+ end
505
+ end
506
+ end
507
+ if s0.last
508
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
509
+ r0.extend(Soa0)
510
+ r0.extend(Soa1)
511
+ else
512
+ @index = i0
513
+ r0 = nil
514
+ end
515
+
516
+ node_cache[:soa][start_index] = r0
517
+
518
+ r0
519
+ end
520
+
521
+ module ResourceRecord0
522
+ def record
523
+ elements[0]
524
+ end
525
+
526
+ def linebreak
527
+ elements[3]
528
+ end
529
+ end
530
+
531
+ module ResourceRecord1
532
+ def zone
533
+ p = parent
534
+ while p.respond_to?(:parent) && p.parent
535
+ p = p.parent
536
+ end
537
+ p
538
+ end
539
+
540
+ def to_s
541
+ text_value
542
+ end
543
+
544
+ def record_type
545
+ record.elements[4].text_value
546
+ end
547
+
548
+ def ttl
549
+ record.ttl || zone.variables['TTL'].to_i
550
+ end
551
+
552
+ def method_missing(method_name, *args)
553
+ if record.respond_to?(method_name)
554
+ record.send(method_name, *args)
555
+ end
556
+ end
557
+
558
+ def respond_to?(method_name)
559
+ super || record.respond_to?(method_name)
560
+ end
561
+
562
+ def parse_type ; :record ; end
563
+ end
564
+
565
+ def _nt_resource_record
566
+ start_index = index
567
+ if node_cache[:resource_record].has_key?(index)
568
+ cached = node_cache[:resource_record][index]
569
+ if cached
570
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
571
+ @index = cached.interval.end
572
+ end
573
+ return cached
574
+ end
575
+
576
+ i0, s0 = index, []
577
+ i1 = index
578
+ r2 = _nt_a_record
579
+ if r2
580
+ r1 = r2
581
+ else
582
+ r3 = _nt_aaaa_record
583
+ if r3
584
+ r1 = r3
585
+ else
586
+ r4 = _nt_cname_record
587
+ if r4
588
+ r1 = r4
589
+ else
590
+ r5 = _nt_mx_record
591
+ if r5
592
+ r1 = r5
593
+ else
594
+ r6 = _nt_naptr_record
595
+ if r6
596
+ r1 = r6
597
+ else
598
+ r7 = _nt_ns_record
599
+ if r7
600
+ r1 = r7
601
+ else
602
+ r8 = _nt_ptr_record
603
+ if r8
604
+ r1 = r8
605
+ else
606
+ r9 = _nt_srv_record
607
+ if r9
608
+ r1 = r9
609
+ else
610
+ r10 = _nt_spf_record
611
+ if r10
612
+ r1 = r10
613
+ else
614
+ r11 = _nt_txt_record
615
+ if r11
616
+ r1 = r11
617
+ else
618
+ r12 = _nt_soa_record
619
+ if r12
620
+ r1 = r12
621
+ else
622
+ @index = i1
623
+ r1 = nil
624
+ end
625
+ end
626
+ end
627
+ end
628
+ end
629
+ end
630
+ end
631
+ end
632
+ end
633
+ end
634
+ end
635
+ s0 << r1
636
+ if r1
637
+ s13, i13 = [], index
638
+ loop do
639
+ r14 = _nt_space
640
+ if r14
641
+ s13 << r14
642
+ else
643
+ break
644
+ end
645
+ end
646
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
647
+ s0 << r13
648
+ if r13
649
+ r16 = _nt_comment
650
+ if r16
651
+ r15 = r16
652
+ else
653
+ r15 = instantiate_node(SyntaxNode,input, index...index)
654
+ end
655
+ s0 << r15
656
+ if r15
657
+ r17 = _nt_linebreak
658
+ s0 << r17
659
+ end
660
+ end
661
+ end
662
+ if s0.last
663
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
664
+ r0.extend(ResourceRecord0)
665
+ r0.extend(ResourceRecord1)
666
+ else
667
+ @index = i0
668
+ r0 = nil
669
+ end
670
+
671
+ node_cache[:resource_record][start_index] = r0
672
+
673
+ r0
674
+ end
675
+
676
+ module ARecord0
677
+ def host
678
+ elements[0]
679
+ end
680
+
681
+ def space1
682
+ elements[1]
683
+ end
684
+
685
+ def ttl
686
+ elements[2]
687
+ end
688
+
689
+ def klass
690
+ elements[3]
691
+ end
692
+
693
+ def space2
694
+ elements[5]
695
+ end
696
+
697
+ def ip_address
698
+ elements[6]
699
+ end
700
+ end
701
+
702
+ module ARecord1
703
+ def to_s
704
+ "#{host} #{ttl} #{klass} A #{ip_address}"
705
+ end
706
+ end
707
+
708
+ def _nt_a_record
709
+ start_index = index
710
+ if node_cache[:a_record].has_key?(index)
711
+ cached = node_cache[:a_record][index]
712
+ if cached
713
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
714
+ @index = cached.interval.end
715
+ end
716
+ return cached
717
+ end
718
+
719
+ i0, s0 = index, []
720
+ r1 = _nt_host
721
+ s0 << r1
722
+ if r1
723
+ r2 = _nt_space
724
+ s0 << r2
725
+ if r2
726
+ r3 = _nt_ttl
727
+ s0 << r3
728
+ if r3
729
+ r4 = _nt_klass
730
+ s0 << r4
731
+ if r4
732
+ if has_terminal?("A", false, index)
733
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
734
+ @index += 1
735
+ else
736
+ terminal_parse_failure("A")
737
+ r5 = nil
738
+ end
739
+ s0 << r5
740
+ if r5
741
+ r6 = _nt_space
742
+ s0 << r6
743
+ if r6
744
+ r7 = _nt_ip_address
745
+ s0 << r7
746
+ end
747
+ end
748
+ end
749
+ end
750
+ end
751
+ end
752
+ if s0.last
753
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
754
+ r0.extend(ARecord0)
755
+ r0.extend(ARecord1)
756
+ else
757
+ @index = i0
758
+ r0 = nil
759
+ end
760
+
761
+ node_cache[:a_record][start_index] = r0
762
+
763
+ r0
764
+ end
765
+
766
+ module IpAddress0
767
+ end
768
+
769
+ module IpAddress1
770
+ def to_s
771
+ text_value
772
+ end
773
+ end
774
+
775
+ def _nt_ip_address
776
+ start_index = index
777
+ if node_cache[:ip_address].has_key?(index)
778
+ cached = node_cache[:ip_address][index]
779
+ if cached
780
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
781
+ @index = cached.interval.end
782
+ end
783
+ return cached
784
+ end
785
+
786
+ i0, s0 = index, []
787
+ s1, i1 = [], index
788
+ loop do
789
+ if has_terminal?('\G[\\d]', true, index)
790
+ r2 = true
791
+ @index += 1
792
+ else
793
+ r2 = nil
794
+ end
795
+ if r2
796
+ s1 << r2
797
+ else
798
+ break
799
+ end
800
+ end
801
+ if s1.empty?
802
+ @index = i1
803
+ r1 = nil
804
+ else
805
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
806
+ end
807
+ s0 << r1
808
+ if r1
809
+ if has_terminal?(".", false, index)
810
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
811
+ @index += 1
812
+ else
813
+ terminal_parse_failure(".")
814
+ r3 = nil
815
+ end
816
+ s0 << r3
817
+ if r3
818
+ s4, i4 = [], index
819
+ loop do
820
+ if has_terminal?('\G[\\d]', true, index)
821
+ r5 = true
822
+ @index += 1
823
+ else
824
+ r5 = nil
825
+ end
826
+ if r5
827
+ s4 << r5
828
+ else
829
+ break
830
+ end
831
+ end
832
+ if s4.empty?
833
+ @index = i4
834
+ r4 = nil
835
+ else
836
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
837
+ end
838
+ s0 << r4
839
+ if r4
840
+ if has_terminal?(".", false, index)
841
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
842
+ @index += 1
843
+ else
844
+ terminal_parse_failure(".")
845
+ r6 = nil
846
+ end
847
+ s0 << r6
848
+ if r6
849
+ s7, i7 = [], index
850
+ loop do
851
+ if has_terminal?('\G[\\d]', true, index)
852
+ r8 = true
853
+ @index += 1
854
+ else
855
+ r8 = nil
856
+ end
857
+ if r8
858
+ s7 << r8
859
+ else
860
+ break
861
+ end
862
+ end
863
+ if s7.empty?
864
+ @index = i7
865
+ r7 = nil
866
+ else
867
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
868
+ end
869
+ s0 << r7
870
+ if r7
871
+ if has_terminal?(".", false, index)
872
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
873
+ @index += 1
874
+ else
875
+ terminal_parse_failure(".")
876
+ r9 = nil
877
+ end
878
+ s0 << r9
879
+ if r9
880
+ s10, i10 = [], index
881
+ loop do
882
+ if has_terminal?('\G[\\d]', true, index)
883
+ r11 = true
884
+ @index += 1
885
+ else
886
+ r11 = nil
887
+ end
888
+ if r11
889
+ s10 << r11
890
+ else
891
+ break
892
+ end
893
+ end
894
+ if s10.empty?
895
+ @index = i10
896
+ r10 = nil
897
+ else
898
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
899
+ end
900
+ s0 << r10
901
+ end
902
+ end
903
+ end
904
+ end
905
+ end
906
+ end
907
+ if s0.last
908
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
909
+ r0.extend(IpAddress0)
910
+ r0.extend(IpAddress1)
911
+ else
912
+ @index = i0
913
+ r0 = nil
914
+ end
915
+
916
+ node_cache[:ip_address][start_index] = r0
917
+
918
+ r0
919
+ end
920
+
921
+ module AaaaRecord0
922
+ def host
923
+ elements[0]
924
+ end
925
+
926
+ def space1
927
+ elements[1]
928
+ end
929
+
930
+ def ttl
931
+ elements[2]
932
+ end
933
+
934
+ def klass
935
+ elements[3]
936
+ end
937
+
938
+ def space2
939
+ elements[5]
940
+ end
941
+
942
+ def ip_address
943
+ elements[6]
944
+ end
945
+ end
946
+
947
+ module AaaaRecord1
948
+ def to_s
949
+ "#{host} #{ttl} #{klass} AAAA #{ip_address}"
950
+ end
951
+ end
952
+
953
+ def _nt_aaaa_record
954
+ start_index = index
955
+ if node_cache[:aaaa_record].has_key?(index)
956
+ cached = node_cache[:aaaa_record][index]
957
+ if cached
958
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
959
+ @index = cached.interval.end
960
+ end
961
+ return cached
962
+ end
963
+
964
+ i0, s0 = index, []
965
+ r1 = _nt_host
966
+ s0 << r1
967
+ if r1
968
+ r2 = _nt_space
969
+ s0 << r2
970
+ if r2
971
+ r3 = _nt_ttl
972
+ s0 << r3
973
+ if r3
974
+ r4 = _nt_klass
975
+ s0 << r4
976
+ if r4
977
+ if has_terminal?("AAAA", false, index)
978
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
979
+ @index += 4
980
+ else
981
+ terminal_parse_failure("AAAA")
982
+ r5 = nil
983
+ end
984
+ s0 << r5
985
+ if r5
986
+ r6 = _nt_space
987
+ s0 << r6
988
+ if r6
989
+ r7 = _nt_ip6_address
990
+ s0 << r7
991
+ end
992
+ end
993
+ end
994
+ end
995
+ end
996
+ end
997
+ if s0.last
998
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
999
+ r0.extend(AaaaRecord0)
1000
+ r0.extend(AaaaRecord1)
1001
+ else
1002
+ @index = i0
1003
+ r0 = nil
1004
+ end
1005
+
1006
+ node_cache[:aaaa_record][start_index] = r0
1007
+
1008
+ r0
1009
+ end
1010
+
1011
+ module Ip6Address0
1012
+ def to_s
1013
+ text_value.downcase
1014
+ end
1015
+ end
1016
+
1017
+ def _nt_ip6_address
1018
+ start_index = index
1019
+ if node_cache[:ip6_address].has_key?(index)
1020
+ cached = node_cache[:ip6_address][index]
1021
+ if cached
1022
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1023
+ @index = cached.interval.end
1024
+ end
1025
+ return cached
1026
+ end
1027
+
1028
+ s0, i0 = [], index
1029
+ loop do
1030
+ if has_terminal?('\G[\\da-fA-F:.]', true, index)
1031
+ r1 = true
1032
+ @index += 1
1033
+ else
1034
+ r1 = nil
1035
+ end
1036
+ if r1
1037
+ s0 << r1
1038
+ else
1039
+ break
1040
+ end
1041
+ if s0.size == 39
1042
+ break
1043
+ end
1044
+ end
1045
+ if s0.size < 2
1046
+ @index = i0
1047
+ r0 = nil
1048
+ else
1049
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1050
+ r0.extend(Ip6Address0)
1051
+ end
1052
+
1053
+ node_cache[:ip6_address][start_index] = r0
1054
+
1055
+ r0
1056
+ end
1057
+
1058
+ module CnameRecord0
1059
+ def host
1060
+ elements[0]
1061
+ end
1062
+
1063
+ def space1
1064
+ elements[1]
1065
+ end
1066
+
1067
+ def ttl
1068
+ elements[2]
1069
+ end
1070
+
1071
+ def klass
1072
+ elements[3]
1073
+ end
1074
+
1075
+ def space2
1076
+ elements[5]
1077
+ end
1078
+
1079
+ def target
1080
+ elements[6]
1081
+ end
1082
+ end
1083
+
1084
+ module CnameRecord1
1085
+ def to_s
1086
+ "#{host} #{ttl} #{klass} CNAME #{target}"
1087
+ end
1088
+ end
1089
+
1090
+ def _nt_cname_record
1091
+ start_index = index
1092
+ if node_cache[:cname_record].has_key?(index)
1093
+ cached = node_cache[:cname_record][index]
1094
+ if cached
1095
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1096
+ @index = cached.interval.end
1097
+ end
1098
+ return cached
1099
+ end
1100
+
1101
+ i0, s0 = index, []
1102
+ r1 = _nt_host
1103
+ s0 << r1
1104
+ if r1
1105
+ r2 = _nt_space
1106
+ s0 << r2
1107
+ if r2
1108
+ r3 = _nt_ttl
1109
+ s0 << r3
1110
+ if r3
1111
+ r4 = _nt_klass
1112
+ s0 << r4
1113
+ if r4
1114
+ if has_terminal?("CNAME", false, index)
1115
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 5))
1116
+ @index += 5
1117
+ else
1118
+ terminal_parse_failure("CNAME")
1119
+ r5 = nil
1120
+ end
1121
+ s0 << r5
1122
+ if r5
1123
+ r6 = _nt_space
1124
+ s0 << r6
1125
+ if r6
1126
+ r7 = _nt_host
1127
+ s0 << r7
1128
+ end
1129
+ end
1130
+ end
1131
+ end
1132
+ end
1133
+ end
1134
+ if s0.last
1135
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1136
+ r0.extend(CnameRecord0)
1137
+ r0.extend(CnameRecord1)
1138
+ else
1139
+ @index = i0
1140
+ r0 = nil
1141
+ end
1142
+
1143
+ node_cache[:cname_record][start_index] = r0
1144
+
1145
+ r0
1146
+ end
1147
+
1148
+ module MxRecord0
1149
+ def host
1150
+ elements[0]
1151
+ end
1152
+
1153
+ def space1
1154
+ elements[1]
1155
+ end
1156
+
1157
+ def ttl
1158
+ elements[2]
1159
+ end
1160
+
1161
+ def klass
1162
+ elements[3]
1163
+ end
1164
+
1165
+ def space2
1166
+ elements[5]
1167
+ end
1168
+
1169
+ def priority
1170
+ elements[6]
1171
+ end
1172
+
1173
+ def space3
1174
+ elements[7]
1175
+ end
1176
+
1177
+ def exchanger
1178
+ elements[8]
1179
+ end
1180
+ end
1181
+
1182
+ module MxRecord1
1183
+ def to_s
1184
+ "#{host} #{ttl} #{klass} MX #{priority} #{exchanger}"
1185
+ end
1186
+ end
1187
+
1188
+ def _nt_mx_record
1189
+ start_index = index
1190
+ if node_cache[:mx_record].has_key?(index)
1191
+ cached = node_cache[:mx_record][index]
1192
+ if cached
1193
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1194
+ @index = cached.interval.end
1195
+ end
1196
+ return cached
1197
+ end
1198
+
1199
+ i0, s0 = index, []
1200
+ r1 = _nt_host
1201
+ s0 << r1
1202
+ if r1
1203
+ r2 = _nt_space
1204
+ s0 << r2
1205
+ if r2
1206
+ r3 = _nt_ttl
1207
+ s0 << r3
1208
+ if r3
1209
+ r4 = _nt_klass
1210
+ s0 << r4
1211
+ if r4
1212
+ if has_terminal?("MX", false, index)
1213
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
1214
+ @index += 2
1215
+ else
1216
+ terminal_parse_failure("MX")
1217
+ r5 = nil
1218
+ end
1219
+ s0 << r5
1220
+ if r5
1221
+ r6 = _nt_space
1222
+ s0 << r6
1223
+ if r6
1224
+ r7 = _nt_integer
1225
+ s0 << r7
1226
+ if r7
1227
+ r8 = _nt_space
1228
+ s0 << r8
1229
+ if r8
1230
+ r9 = _nt_host
1231
+ s0 << r9
1232
+ end
1233
+ end
1234
+ end
1235
+ end
1236
+ end
1237
+ end
1238
+ end
1239
+ end
1240
+ if s0.last
1241
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1242
+ r0.extend(MxRecord0)
1243
+ r0.extend(MxRecord1)
1244
+ else
1245
+ @index = i0
1246
+ r0 = nil
1247
+ end
1248
+
1249
+ node_cache[:mx_record][start_index] = r0
1250
+
1251
+ r0
1252
+ end
1253
+
1254
+ module NaptrRecord0
1255
+ def host
1256
+ elements[0]
1257
+ end
1258
+
1259
+ def space1
1260
+ elements[1]
1261
+ end
1262
+
1263
+ def ttl
1264
+ elements[2]
1265
+ end
1266
+
1267
+ def klass
1268
+ elements[3]
1269
+ end
1270
+
1271
+ def space2
1272
+ elements[5]
1273
+ end
1274
+
1275
+ def data
1276
+ elements[6]
1277
+ end
1278
+ end
1279
+
1280
+ module NaptrRecord1
1281
+ def to_s
1282
+ "#{host} #{ttl} #{klass} NAPTR #{data}"
1283
+ end
1284
+ end
1285
+
1286
+ def _nt_naptr_record
1287
+ start_index = index
1288
+ if node_cache[:naptr_record].has_key?(index)
1289
+ cached = node_cache[:naptr_record][index]
1290
+ if cached
1291
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1292
+ @index = cached.interval.end
1293
+ end
1294
+ return cached
1295
+ end
1296
+
1297
+ i0, s0 = index, []
1298
+ r1 = _nt_host
1299
+ s0 << r1
1300
+ if r1
1301
+ r2 = _nt_space
1302
+ s0 << r2
1303
+ if r2
1304
+ r3 = _nt_ttl
1305
+ s0 << r3
1306
+ if r3
1307
+ r4 = _nt_klass
1308
+ s0 << r4
1309
+ if r4
1310
+ if has_terminal?("NAPTR", false, index)
1311
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 5))
1312
+ @index += 5
1313
+ else
1314
+ terminal_parse_failure("NAPTR")
1315
+ r5 = nil
1316
+ end
1317
+ s0 << r5
1318
+ if r5
1319
+ r6 = _nt_space
1320
+ s0 << r6
1321
+ if r6
1322
+ r7 = _nt_data
1323
+ s0 << r7
1324
+ end
1325
+ end
1326
+ end
1327
+ end
1328
+ end
1329
+ end
1330
+ if s0.last
1331
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1332
+ r0.extend(NaptrRecord0)
1333
+ r0.extend(NaptrRecord1)
1334
+ else
1335
+ @index = i0
1336
+ r0 = nil
1337
+ end
1338
+
1339
+ node_cache[:naptr_record][start_index] = r0
1340
+
1341
+ r0
1342
+ end
1343
+
1344
+ module NsRecord0
1345
+ def host
1346
+ elements[0]
1347
+ end
1348
+
1349
+ def space1
1350
+ elements[1]
1351
+ end
1352
+
1353
+ def ttl
1354
+ elements[2]
1355
+ end
1356
+
1357
+ def klass
1358
+ elements[3]
1359
+ end
1360
+
1361
+ def space2
1362
+ elements[5]
1363
+ end
1364
+
1365
+ def nameserver
1366
+ elements[6]
1367
+ end
1368
+ end
1369
+
1370
+ module NsRecord1
1371
+ def to_s
1372
+ "#{host} #{ttl} #{klass} NS #{nameserver}"
1373
+ end
1374
+ end
1375
+
1376
+ def _nt_ns_record
1377
+ start_index = index
1378
+ if node_cache[:ns_record].has_key?(index)
1379
+ cached = node_cache[:ns_record][index]
1380
+ if cached
1381
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1382
+ @index = cached.interval.end
1383
+ end
1384
+ return cached
1385
+ end
1386
+
1387
+ i0, s0 = index, []
1388
+ r1 = _nt_host
1389
+ s0 << r1
1390
+ if r1
1391
+ r2 = _nt_space
1392
+ s0 << r2
1393
+ if r2
1394
+ r3 = _nt_ttl
1395
+ s0 << r3
1396
+ if r3
1397
+ r4 = _nt_klass
1398
+ s0 << r4
1399
+ if r4
1400
+ if has_terminal?("NS", false, index)
1401
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
1402
+ @index += 2
1403
+ else
1404
+ terminal_parse_failure("NS")
1405
+ r5 = nil
1406
+ end
1407
+ s0 << r5
1408
+ if r5
1409
+ r6 = _nt_space
1410
+ s0 << r6
1411
+ if r6
1412
+ r7 = _nt_host
1413
+ s0 << r7
1414
+ end
1415
+ end
1416
+ end
1417
+ end
1418
+ end
1419
+ end
1420
+ if s0.last
1421
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1422
+ r0.extend(NsRecord0)
1423
+ r0.extend(NsRecord1)
1424
+ else
1425
+ @index = i0
1426
+ r0 = nil
1427
+ end
1428
+
1429
+ node_cache[:ns_record][start_index] = r0
1430
+
1431
+ r0
1432
+ end
1433
+
1434
+ module PtrRecord0
1435
+ def host
1436
+ elements[0]
1437
+ end
1438
+
1439
+ def space1
1440
+ elements[1]
1441
+ end
1442
+
1443
+ def ttl
1444
+ elements[2]
1445
+ end
1446
+
1447
+ def klass
1448
+ elements[3]
1449
+ end
1450
+
1451
+ def space2
1452
+ elements[5]
1453
+ end
1454
+
1455
+ def target
1456
+ elements[6]
1457
+ end
1458
+ end
1459
+
1460
+ module PtrRecord1
1461
+ def to_s
1462
+ "#{host} #{ttl} #{klass} PTR #{target}"
1463
+ end
1464
+ end
1465
+
1466
+ def _nt_ptr_record
1467
+ start_index = index
1468
+ if node_cache[:ptr_record].has_key?(index)
1469
+ cached = node_cache[:ptr_record][index]
1470
+ if cached
1471
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1472
+ @index = cached.interval.end
1473
+ end
1474
+ return cached
1475
+ end
1476
+
1477
+ i0, s0 = index, []
1478
+ r1 = _nt_host
1479
+ s0 << r1
1480
+ if r1
1481
+ r2 = _nt_space
1482
+ s0 << r2
1483
+ if r2
1484
+ r3 = _nt_ttl
1485
+ s0 << r3
1486
+ if r3
1487
+ r4 = _nt_klass
1488
+ s0 << r4
1489
+ if r4
1490
+ if has_terminal?("PTR", false, index)
1491
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
1492
+ @index += 3
1493
+ else
1494
+ terminal_parse_failure("PTR")
1495
+ r5 = nil
1496
+ end
1497
+ s0 << r5
1498
+ if r5
1499
+ r6 = _nt_space
1500
+ s0 << r6
1501
+ if r6
1502
+ r7 = _nt_host
1503
+ s0 << r7
1504
+ end
1505
+ end
1506
+ end
1507
+ end
1508
+ end
1509
+ end
1510
+ if s0.last
1511
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1512
+ r0.extend(PtrRecord0)
1513
+ r0.extend(PtrRecord1)
1514
+ else
1515
+ @index = i0
1516
+ r0 = nil
1517
+ end
1518
+
1519
+ node_cache[:ptr_record][start_index] = r0
1520
+
1521
+ r0
1522
+ end
1523
+
1524
+ module SoaRecord0
1525
+ def origin
1526
+ elements[0]
1527
+ end
1528
+
1529
+ def space1
1530
+ elements[1]
1531
+ end
1532
+
1533
+ def ttl
1534
+ elements[2]
1535
+ end
1536
+
1537
+ def klass
1538
+ elements[3]
1539
+ end
1540
+
1541
+ def space2
1542
+ elements[5]
1543
+ end
1544
+
1545
+ def ns
1546
+ elements[6]
1547
+ end
1548
+
1549
+ def space3
1550
+ elements[7]
1551
+ end
1552
+
1553
+ def rp
1554
+ elements[8]
1555
+ end
1556
+
1557
+ def space4
1558
+ elements[9]
1559
+ end
1560
+
1561
+ def data
1562
+ elements[10]
1563
+ end
1564
+ end
1565
+
1566
+ module SoaRecord1
1567
+ def to_s
1568
+ "#{origin} #{ttl} #{klass} SOA #{ns} #{rp} (#{space})"
1569
+ end
1570
+ end
1571
+
1572
+ def _nt_soa_record
1573
+ start_index = index
1574
+ if node_cache[:soa_record].has_key?(index)
1575
+ cached = node_cache[:soa_record][index]
1576
+ if cached
1577
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1578
+ @index = cached.interval.end
1579
+ end
1580
+ return cached
1581
+ end
1582
+
1583
+ i0, s0 = index, []
1584
+ r1 = _nt_origin
1585
+ s0 << r1
1586
+ if r1
1587
+ r2 = _nt_space
1588
+ s0 << r2
1589
+ if r2
1590
+ r3 = _nt_ttl
1591
+ s0 << r3
1592
+ if r3
1593
+ r4 = _nt_klass
1594
+ s0 << r4
1595
+ if r4
1596
+ if has_terminal?("SOA", false, index)
1597
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
1598
+ @index += 3
1599
+ else
1600
+ terminal_parse_failure("SOA")
1601
+ r5 = nil
1602
+ end
1603
+ s0 << r5
1604
+ if r5
1605
+ r6 = _nt_space
1606
+ s0 << r6
1607
+ if r6
1608
+ r7 = _nt_ns
1609
+ s0 << r7
1610
+ if r7
1611
+ r8 = _nt_space
1612
+ s0 << r8
1613
+ if r8
1614
+ r9 = _nt_rp
1615
+ s0 << r9
1616
+ if r9
1617
+ r10 = _nt_space
1618
+ s0 << r10
1619
+ if r10
1620
+ r11 = _nt_data
1621
+ s0 << r11
1622
+ end
1623
+ end
1624
+ end
1625
+ end
1626
+ end
1627
+ end
1628
+ end
1629
+ end
1630
+ end
1631
+ end
1632
+ if s0.last
1633
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1634
+ r0.extend(SoaRecord0)
1635
+ r0.extend(SoaRecord1)
1636
+ else
1637
+ @index = i0
1638
+ r0 = nil
1639
+ end
1640
+
1641
+ node_cache[:soa_record][start_index] = r0
1642
+
1643
+ r0
1644
+ end
1645
+
1646
+ module SrvRecord0
1647
+ def host
1648
+ elements[0]
1649
+ end
1650
+
1651
+ def space1
1652
+ elements[1]
1653
+ end
1654
+
1655
+ def ttl
1656
+ elements[2]
1657
+ end
1658
+
1659
+ def klass
1660
+ elements[3]
1661
+ end
1662
+
1663
+ def space2
1664
+ elements[5]
1665
+ end
1666
+
1667
+ def priority
1668
+ elements[6]
1669
+ end
1670
+
1671
+ def space3
1672
+ elements[7]
1673
+ end
1674
+
1675
+ def weight
1676
+ elements[8]
1677
+ end
1678
+
1679
+ def space4
1680
+ elements[9]
1681
+ end
1682
+
1683
+ def port
1684
+ elements[10]
1685
+ end
1686
+
1687
+ def space5
1688
+ elements[11]
1689
+ end
1690
+
1691
+ def target
1692
+ elements[12]
1693
+ end
1694
+ end
1695
+
1696
+ module SrvRecord1
1697
+ def to_s
1698
+ "#{host} #{ttl} #{klass} SRV #{priority} #{weight} #{port} #{target}"
1699
+ end
1700
+ end
1701
+
1702
+ def _nt_srv_record
1703
+ start_index = index
1704
+ if node_cache[:srv_record].has_key?(index)
1705
+ cached = node_cache[:srv_record][index]
1706
+ if cached
1707
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1708
+ @index = cached.interval.end
1709
+ end
1710
+ return cached
1711
+ end
1712
+
1713
+ i0, s0 = index, []
1714
+ r1 = _nt_host
1715
+ s0 << r1
1716
+ if r1
1717
+ r2 = _nt_space
1718
+ s0 << r2
1719
+ if r2
1720
+ r3 = _nt_ttl
1721
+ s0 << r3
1722
+ if r3
1723
+ r4 = _nt_klass
1724
+ s0 << r4
1725
+ if r4
1726
+ if has_terminal?("SRV", false, index)
1727
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
1728
+ @index += 3
1729
+ else
1730
+ terminal_parse_failure("SRV")
1731
+ r5 = nil
1732
+ end
1733
+ s0 << r5
1734
+ if r5
1735
+ r6 = _nt_space
1736
+ s0 << r6
1737
+ if r6
1738
+ r7 = _nt_integer
1739
+ s0 << r7
1740
+ if r7
1741
+ r8 = _nt_space
1742
+ s0 << r8
1743
+ if r8
1744
+ r9 = _nt_integer
1745
+ s0 << r9
1746
+ if r9
1747
+ r10 = _nt_space
1748
+ s0 << r10
1749
+ if r10
1750
+ r11 = _nt_integer
1751
+ s0 << r11
1752
+ if r11
1753
+ r12 = _nt_space
1754
+ s0 << r12
1755
+ if r12
1756
+ r13 = _nt_host
1757
+ s0 << r13
1758
+ end
1759
+ end
1760
+ end
1761
+ end
1762
+ end
1763
+ end
1764
+ end
1765
+ end
1766
+ end
1767
+ end
1768
+ end
1769
+ end
1770
+ if s0.last
1771
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1772
+ r0.extend(SrvRecord0)
1773
+ r0.extend(SrvRecord1)
1774
+ else
1775
+ @index = i0
1776
+ r0 = nil
1777
+ end
1778
+
1779
+ node_cache[:srv_record][start_index] = r0
1780
+
1781
+ r0
1782
+ end
1783
+
1784
+ module SpfRecord0
1785
+ def host
1786
+ elements[0]
1787
+ end
1788
+
1789
+ def space1
1790
+ elements[1]
1791
+ end
1792
+
1793
+ def ttl
1794
+ elements[2]
1795
+ end
1796
+
1797
+ def klass
1798
+ elements[3]
1799
+ end
1800
+
1801
+ def space2
1802
+ elements[5]
1803
+ end
1804
+
1805
+ def data
1806
+ elements[6]
1807
+ end
1808
+ end
1809
+
1810
+ module SpfRecord1
1811
+ def to_s
1812
+ "#{host} #{ttl} #{klass} SPF #{data}"
1813
+ end
1814
+ end
1815
+
1816
+ def _nt_spf_record
1817
+ start_index = index
1818
+ if node_cache[:spf_record].has_key?(index)
1819
+ cached = node_cache[:spf_record][index]
1820
+ if cached
1821
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1822
+ @index = cached.interval.end
1823
+ end
1824
+ return cached
1825
+ end
1826
+
1827
+ i0, s0 = index, []
1828
+ r1 = _nt_host
1829
+ s0 << r1
1830
+ if r1
1831
+ r2 = _nt_space
1832
+ s0 << r2
1833
+ if r2
1834
+ r3 = _nt_ttl
1835
+ s0 << r3
1836
+ if r3
1837
+ r4 = _nt_klass
1838
+ s0 << r4
1839
+ if r4
1840
+ if has_terminal?("SPF", false, index)
1841
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
1842
+ @index += 3
1843
+ else
1844
+ terminal_parse_failure("SPF")
1845
+ r5 = nil
1846
+ end
1847
+ s0 << r5
1848
+ if r5
1849
+ r6 = _nt_space
1850
+ s0 << r6
1851
+ if r6
1852
+ r7 = _nt_txt_data
1853
+ s0 << r7
1854
+ end
1855
+ end
1856
+ end
1857
+ end
1858
+ end
1859
+ end
1860
+ if s0.last
1861
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1862
+ r0.extend(SpfRecord0)
1863
+ r0.extend(SpfRecord1)
1864
+ else
1865
+ @index = i0
1866
+ r0 = nil
1867
+ end
1868
+
1869
+ node_cache[:spf_record][start_index] = r0
1870
+
1871
+ r0
1872
+ end
1873
+
1874
+ module TxtRecord0
1875
+ def host
1876
+ elements[0]
1877
+ end
1878
+
1879
+ def space1
1880
+ elements[1]
1881
+ end
1882
+
1883
+ def ttl
1884
+ elements[2]
1885
+ end
1886
+
1887
+ def klass
1888
+ elements[3]
1889
+ end
1890
+
1891
+ def space2
1892
+ elements[5]
1893
+ end
1894
+
1895
+ def data
1896
+ elements[6]
1897
+ end
1898
+ end
1899
+
1900
+ module TxtRecord1
1901
+ def to_s
1902
+ "#{host} #{ttl} #{klass} TXT #{data}"
1903
+ end
1904
+ end
1905
+
1906
+ def _nt_txt_record
1907
+ start_index = index
1908
+ if node_cache[:txt_record].has_key?(index)
1909
+ cached = node_cache[:txt_record][index]
1910
+ if cached
1911
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1912
+ @index = cached.interval.end
1913
+ end
1914
+ return cached
1915
+ end
1916
+
1917
+ i0, s0 = index, []
1918
+ r1 = _nt_host
1919
+ s0 << r1
1920
+ if r1
1921
+ r2 = _nt_space
1922
+ s0 << r2
1923
+ if r2
1924
+ r3 = _nt_ttl
1925
+ s0 << r3
1926
+ if r3
1927
+ r4 = _nt_klass
1928
+ s0 << r4
1929
+ if r4
1930
+ if has_terminal?("TXT", false, index)
1931
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
1932
+ @index += 3
1933
+ else
1934
+ terminal_parse_failure("TXT")
1935
+ r5 = nil
1936
+ end
1937
+ s0 << r5
1938
+ if r5
1939
+ r6 = _nt_space
1940
+ s0 << r6
1941
+ if r6
1942
+ r7 = _nt_txt_data
1943
+ s0 << r7
1944
+ end
1945
+ end
1946
+ end
1947
+ end
1948
+ end
1949
+ end
1950
+ if s0.last
1951
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1952
+ r0.extend(TxtRecord0)
1953
+ r0.extend(TxtRecord1)
1954
+ else
1955
+ @index = i0
1956
+ r0 = nil
1957
+ end
1958
+
1959
+ node_cache[:txt_record][start_index] = r0
1960
+
1961
+ r0
1962
+ end
1963
+
1964
+ module Origin0
1965
+ def host
1966
+ elements[0]
1967
+ end
1968
+
1969
+ end
1970
+
1971
+ module Origin1
1972
+ def to_s
1973
+ "#{host}"
1974
+ end
1975
+ end
1976
+
1977
+ def _nt_origin
1978
+ start_index = index
1979
+ if node_cache[:origin].has_key?(index)
1980
+ cached = node_cache[:origin][index]
1981
+ if cached
1982
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1983
+ @index = cached.interval.end
1984
+ end
1985
+ return cached
1986
+ end
1987
+
1988
+ i0, s0 = index, []
1989
+ r1 = _nt_host
1990
+ s0 << r1
1991
+ if r1
1992
+ s2, i2 = [], index
1993
+ loop do
1994
+ r3 = _nt_comment
1995
+ if r3
1996
+ s2 << r3
1997
+ else
1998
+ break
1999
+ end
2000
+ end
2001
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2002
+ s0 << r2
2003
+ end
2004
+ if s0.last
2005
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2006
+ r0.extend(Origin0)
2007
+ r0.extend(Origin1)
2008
+ else
2009
+ @index = i0
2010
+ r0 = nil
2011
+ end
2012
+
2013
+ node_cache[:origin][start_index] = r0
2014
+
2015
+ r0
2016
+ end
2017
+
2018
+ module Space0
2019
+ def to_s
2020
+ text_value
2021
+ end
2022
+ end
2023
+
2024
+ def _nt_space
2025
+ start_index = index
2026
+ if node_cache[:space].has_key?(index)
2027
+ cached = node_cache[:space][index]
2028
+ if cached
2029
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2030
+ @index = cached.interval.end
2031
+ end
2032
+ return cached
2033
+ end
2034
+
2035
+ s0, i0 = [], index
2036
+ loop do
2037
+ if has_terminal?('\G[ \\t]', true, index)
2038
+ r1 = true
2039
+ @index += 1
2040
+ else
2041
+ r1 = nil
2042
+ end
2043
+ if r1
2044
+ s0 << r1
2045
+ else
2046
+ break
2047
+ end
2048
+ end
2049
+ if s0.empty?
2050
+ @index = i0
2051
+ r0 = nil
2052
+ else
2053
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2054
+ r0.extend(Space0)
2055
+ end
2056
+
2057
+ node_cache[:space][start_index] = r0
2058
+
2059
+ r0
2060
+ end
2061
+
2062
+ module Linebreak0
2063
+ def to_s
2064
+ ''
2065
+ end
2066
+ end
2067
+
2068
+ def _nt_linebreak
2069
+ start_index = index
2070
+ if node_cache[:linebreak].has_key?(index)
2071
+ cached = node_cache[:linebreak][index]
2072
+ if cached
2073
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2074
+ @index = cached.interval.end
2075
+ end
2076
+ return cached
2077
+ end
2078
+
2079
+ s0, i0 = [], index
2080
+ loop do
2081
+ if has_terminal?('\G[\\n\\r]', true, index)
2082
+ r1 = true
2083
+ @index += 1
2084
+ else
2085
+ r1 = nil
2086
+ end
2087
+ if r1
2088
+ s0 << r1
2089
+ else
2090
+ break
2091
+ end
2092
+ end
2093
+ if s0.empty?
2094
+ @index = i0
2095
+ r0 = nil
2096
+ else
2097
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2098
+ r0.extend(Linebreak0)
2099
+ end
2100
+
2101
+ node_cache[:linebreak][start_index] = r0
2102
+
2103
+ r0
2104
+ end
2105
+
2106
+ module SpaceOrBreak0
2107
+ def to_s
2108
+ text_value
2109
+ end
2110
+ end
2111
+
2112
+ def _nt_space_or_break
2113
+ start_index = index
2114
+ if node_cache[:space_or_break].has_key?(index)
2115
+ cached = node_cache[:space_or_break][index]
2116
+ if cached
2117
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2118
+ @index = cached.interval.end
2119
+ end
2120
+ return cached
2121
+ end
2122
+
2123
+ s0, i0 = [], index
2124
+ loop do
2125
+ if has_terminal?('\G[\\s]', true, index)
2126
+ r1 = true
2127
+ @index += 1
2128
+ else
2129
+ r1 = nil
2130
+ end
2131
+ if r1
2132
+ s0 << r1
2133
+ else
2134
+ break
2135
+ end
2136
+ end
2137
+ if s0.empty?
2138
+ @index = i0
2139
+ r0 = nil
2140
+ else
2141
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2142
+ r0.extend(SpaceOrBreak0)
2143
+ end
2144
+
2145
+ node_cache[:space_or_break][start_index] = r0
2146
+
2147
+ r0
2148
+ end
2149
+
2150
+ module Klass0
2151
+ def space
2152
+ elements[1]
2153
+ end
2154
+ end
2155
+
2156
+ module Klass1
2157
+ def to_s
2158
+ text_value.strip
2159
+ end
2160
+ end
2161
+
2162
+ def _nt_klass
2163
+ start_index = index
2164
+ if node_cache[:klass].has_key?(index)
2165
+ cached = node_cache[:klass][index]
2166
+ if cached
2167
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2168
+ @index = cached.interval.end
2169
+ end
2170
+ return cached
2171
+ end
2172
+
2173
+ i0 = index
2174
+ i1, s1 = index, []
2175
+ if has_terminal?("IN", false, index)
2176
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
2177
+ @index += 2
2178
+ else
2179
+ terminal_parse_failure("IN")
2180
+ r2 = nil
2181
+ end
2182
+ s1 << r2
2183
+ if r2
2184
+ r3 = _nt_space
2185
+ s1 << r3
2186
+ end
2187
+ if s1.last
2188
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2189
+ r1.extend(Klass0)
2190
+ else
2191
+ @index = i1
2192
+ r1 = nil
2193
+ end
2194
+ if r1
2195
+ r0 = r1
2196
+ r0.extend(Klass1)
2197
+ else
2198
+ if has_terminal?('', false, index)
2199
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 0))
2200
+ @index += 0
2201
+ else
2202
+ terminal_parse_failure('')
2203
+ r4 = nil
2204
+ end
2205
+ if r4
2206
+ r0 = r4
2207
+ r0.extend(Klass1)
2208
+ else
2209
+ @index = i0
2210
+ r0 = nil
2211
+ end
2212
+ end
2213
+
2214
+ node_cache[:klass][start_index] = r0
2215
+
2216
+ r0
2217
+ end
2218
+
2219
+ module Comment0
2220
+ end
2221
+
2222
+ module Comment1
2223
+ def to_s
2224
+ text_value.strip
2225
+ end
2226
+ end
2227
+
2228
+ def _nt_comment
2229
+ start_index = index
2230
+ if node_cache[:comment].has_key?(index)
2231
+ cached = node_cache[:comment][index]
2232
+ if cached
2233
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2234
+ @index = cached.interval.end
2235
+ end
2236
+ return cached
2237
+ end
2238
+
2239
+ i0, s0 = index, []
2240
+ s1, i1 = [], index
2241
+ loop do
2242
+ r2 = _nt_space
2243
+ if r2
2244
+ s1 << r2
2245
+ else
2246
+ break
2247
+ end
2248
+ end
2249
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2250
+ s0 << r1
2251
+ if r1
2252
+ if has_terminal?(";", false, index)
2253
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
2254
+ @index += 1
2255
+ else
2256
+ terminal_parse_failure(";")
2257
+ r3 = nil
2258
+ end
2259
+ s0 << r3
2260
+ if r3
2261
+ s4, i4 = [], index
2262
+ loop do
2263
+ if has_terminal?('\G[^\\n\\r]', true, index)
2264
+ r5 = true
2265
+ @index += 1
2266
+ else
2267
+ r5 = nil
2268
+ end
2269
+ if r5
2270
+ s4 << r5
2271
+ else
2272
+ break
2273
+ end
2274
+ end
2275
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
2276
+ s0 << r4
2277
+ end
2278
+ end
2279
+ if s0.last
2280
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2281
+ r0.extend(Comment0)
2282
+ r0.extend(Comment1)
2283
+ else
2284
+ @index = i0
2285
+ r0 = nil
2286
+ end
2287
+
2288
+ node_cache[:comment][start_index] = r0
2289
+
2290
+ r0
2291
+ end
2292
+
2293
+ module Ns0
2294
+ def host
2295
+ elements[0]
2296
+ end
2297
+
2298
+ end
2299
+
2300
+ module Ns1
2301
+ def to_s
2302
+ "#{host}"
2303
+ end
2304
+ end
2305
+
2306
+ def _nt_ns
2307
+ start_index = index
2308
+ if node_cache[:ns].has_key?(index)
2309
+ cached = node_cache[:ns][index]
2310
+ if cached
2311
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2312
+ @index = cached.interval.end
2313
+ end
2314
+ return cached
2315
+ end
2316
+
2317
+ i0, s0 = index, []
2318
+ r1 = _nt_host
2319
+ s0 << r1
2320
+ if r1
2321
+ s2, i2 = [], index
2322
+ loop do
2323
+ r3 = _nt_comment
2324
+ if r3
2325
+ s2 << r3
2326
+ else
2327
+ break
2328
+ end
2329
+ end
2330
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2331
+ s0 << r2
2332
+ end
2333
+ if s0.last
2334
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2335
+ r0.extend(Ns0)
2336
+ r0.extend(Ns1)
2337
+ else
2338
+ @index = i0
2339
+ r0 = nil
2340
+ end
2341
+
2342
+ node_cache[:ns][start_index] = r0
2343
+
2344
+ r0
2345
+ end
2346
+
2347
+ module Rp0
2348
+ end
2349
+
2350
+ module Rp1
2351
+ def to_s
2352
+ text_value
2353
+ end
2354
+ end
2355
+
2356
+ def _nt_rp
2357
+ start_index = index
2358
+ if node_cache[:rp].has_key?(index)
2359
+ cached = node_cache[:rp][index]
2360
+ if cached
2361
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2362
+ @index = cached.interval.end
2363
+ end
2364
+ return cached
2365
+ end
2366
+
2367
+ s0, i0 = [], index
2368
+ loop do
2369
+ i1, s1 = index, []
2370
+ s2, i2 = [], index
2371
+ loop do
2372
+ if has_terminal?('\G[a-zA-Z0-9\\-]', true, index)
2373
+ r3 = true
2374
+ @index += 1
2375
+ else
2376
+ r3 = nil
2377
+ end
2378
+ if r3
2379
+ s2 << r3
2380
+ else
2381
+ break
2382
+ end
2383
+ end
2384
+ if s2.empty?
2385
+ @index = i2
2386
+ r2 = nil
2387
+ else
2388
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2389
+ end
2390
+ s1 << r2
2391
+ if r2
2392
+ if has_terminal?(".", false, index)
2393
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
2394
+ @index += 1
2395
+ else
2396
+ terminal_parse_failure(".")
2397
+ r4 = nil
2398
+ end
2399
+ s1 << r4
2400
+ end
2401
+ if s1.last
2402
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2403
+ r1.extend(Rp0)
2404
+ else
2405
+ @index = i1
2406
+ r1 = nil
2407
+ end
2408
+ if r1
2409
+ s0 << r1
2410
+ else
2411
+ break
2412
+ end
2413
+ end
2414
+ if s0.empty?
2415
+ @index = i0
2416
+ r0 = nil
2417
+ else
2418
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2419
+ r0.extend(Rp1)
2420
+ end
2421
+
2422
+ node_cache[:rp][start_index] = r0
2423
+
2424
+ r0
2425
+ end
2426
+
2427
+ module Serial0
2428
+ def integer
2429
+ elements[0]
2430
+ end
2431
+
2432
+ end
2433
+
2434
+ module Serial1
2435
+ def to_i
2436
+ integer.to_i
2437
+ end
2438
+ def to_s
2439
+ "#{to_i}"
2440
+ end
2441
+ end
2442
+
2443
+ def _nt_serial
2444
+ start_index = index
2445
+ if node_cache[:serial].has_key?(index)
2446
+ cached = node_cache[:serial][index]
2447
+ if cached
2448
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2449
+ @index = cached.interval.end
2450
+ end
2451
+ return cached
2452
+ end
2453
+
2454
+ i0, s0 = index, []
2455
+ r1 = _nt_integer
2456
+ s0 << r1
2457
+ if r1
2458
+ s2, i2 = [], index
2459
+ loop do
2460
+ r3 = _nt_comment
2461
+ if r3
2462
+ s2 << r3
2463
+ else
2464
+ break
2465
+ end
2466
+ end
2467
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2468
+ s0 << r2
2469
+ end
2470
+ if s0.last
2471
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2472
+ r0.extend(Serial0)
2473
+ r0.extend(Serial1)
2474
+ else
2475
+ @index = i0
2476
+ r0 = nil
2477
+ end
2478
+
2479
+ node_cache[:serial][start_index] = r0
2480
+
2481
+ r0
2482
+ end
2483
+
2484
+ module TimeInterval0
2485
+ def integer
2486
+ elements[0]
2487
+ end
2488
+
2489
+ def time_multiplier
2490
+ elements[1]
2491
+ end
2492
+ end
2493
+
2494
+ module TimeInterval1
2495
+ def to_s
2496
+ text_value
2497
+ end
2498
+
2499
+ def to_i
2500
+ time_multiplier.to_i * integer.to_i
2501
+ end
2502
+ end
2503
+
2504
+ def _nt_time_interval
2505
+ start_index = index
2506
+ if node_cache[:time_interval].has_key?(index)
2507
+ cached = node_cache[:time_interval][index]
2508
+ if cached
2509
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2510
+ @index = cached.interval.end
2511
+ end
2512
+ return cached
2513
+ end
2514
+
2515
+ i0, s0 = index, []
2516
+ r1 = _nt_integer
2517
+ s0 << r1
2518
+ if r1
2519
+ r2 = _nt_time_multiplier
2520
+ s0 << r2
2521
+ end
2522
+ if s0.last
2523
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2524
+ r0.extend(TimeInterval0)
2525
+ r0.extend(TimeInterval1)
2526
+ else
2527
+ @index = i0
2528
+ r0 = nil
2529
+ end
2530
+
2531
+ node_cache[:time_interval][start_index] = r0
2532
+
2533
+ r0
2534
+ end
2535
+
2536
+ module Refresh0
2537
+ def time_interval
2538
+ elements[0]
2539
+ end
2540
+
2541
+ end
2542
+
2543
+ module Refresh1
2544
+ def to_i
2545
+ time_interval.to_i
2546
+ end
2547
+ def to_s
2548
+ time_interval.to_s
2549
+ end
2550
+ end
2551
+
2552
+ def _nt_refresh
2553
+ start_index = index
2554
+ if node_cache[:refresh].has_key?(index)
2555
+ cached = node_cache[:refresh][index]
2556
+ if cached
2557
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2558
+ @index = cached.interval.end
2559
+ end
2560
+ return cached
2561
+ end
2562
+
2563
+ i0, s0 = index, []
2564
+ r1 = _nt_time_interval
2565
+ s0 << r1
2566
+ if r1
2567
+ s2, i2 = [], index
2568
+ loop do
2569
+ r3 = _nt_comment
2570
+ if r3
2571
+ s2 << r3
2572
+ else
2573
+ break
2574
+ end
2575
+ end
2576
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2577
+ s0 << r2
2578
+ end
2579
+ if s0.last
2580
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2581
+ r0.extend(Refresh0)
2582
+ r0.extend(Refresh1)
2583
+ else
2584
+ @index = i0
2585
+ r0 = nil
2586
+ end
2587
+
2588
+ node_cache[:refresh][start_index] = r0
2589
+
2590
+ r0
2591
+ end
2592
+
2593
+ module Integer0
2594
+ def to_i
2595
+ text_value.to_i
2596
+ end
2597
+ def to_s
2598
+ "#{to_i}"
2599
+ end
2600
+ end
2601
+
2602
+ def _nt_integer
2603
+ start_index = index
2604
+ if node_cache[:integer].has_key?(index)
2605
+ cached = node_cache[:integer][index]
2606
+ if cached
2607
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2608
+ @index = cached.interval.end
2609
+ end
2610
+ return cached
2611
+ end
2612
+
2613
+ s0, i0 = [], index
2614
+ loop do
2615
+ if has_terminal?('\G[0-9]', true, index)
2616
+ r1 = true
2617
+ @index += 1
2618
+ else
2619
+ r1 = nil
2620
+ end
2621
+ if r1
2622
+ s0 << r1
2623
+ else
2624
+ break
2625
+ end
2626
+ end
2627
+ if s0.empty?
2628
+ @index = i0
2629
+ r0 = nil
2630
+ else
2631
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2632
+ r0.extend(Integer0)
2633
+ end
2634
+
2635
+ node_cache[:integer][start_index] = r0
2636
+
2637
+ r0
2638
+ end
2639
+
2640
+ module TimeMultiplier0
2641
+ def to_s
2642
+ text_value
2643
+ end
2644
+ def to_i
2645
+ case text_value.downcase
2646
+ when 'm' then 60
2647
+ when 'h' then 60 * 60
2648
+ when 'd' then 60 * 60 * 24
2649
+ when 'w' then 60 * 60 * 24 * 7
2650
+ else
2651
+ 1
2652
+ end
2653
+ end
2654
+ end
2655
+
2656
+ def _nt_time_multiplier
2657
+ start_index = index
2658
+ if node_cache[:time_multiplier].has_key?(index)
2659
+ cached = node_cache[:time_multiplier][index]
2660
+ if cached
2661
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2662
+ @index = cached.interval.end
2663
+ end
2664
+ return cached
2665
+ end
2666
+
2667
+ i0 = index
2668
+ if has_terminal?('s', false, index)
2669
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
2670
+ @index += 1
2671
+ else
2672
+ terminal_parse_failure('s')
2673
+ r1 = nil
2674
+ end
2675
+ if r1
2676
+ r0 = r1
2677
+ r0.extend(TimeMultiplier0)
2678
+ else
2679
+ if has_terminal?('S', false, index)
2680
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
2681
+ @index += 1
2682
+ else
2683
+ terminal_parse_failure('S')
2684
+ r2 = nil
2685
+ end
2686
+ if r2
2687
+ r0 = r2
2688
+ r0.extend(TimeMultiplier0)
2689
+ else
2690
+ if has_terminal?('m', false, index)
2691
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
2692
+ @index += 1
2693
+ else
2694
+ terminal_parse_failure('m')
2695
+ r3 = nil
2696
+ end
2697
+ if r3
2698
+ r0 = r3
2699
+ r0.extend(TimeMultiplier0)
2700
+ else
2701
+ if has_terminal?('M', false, index)
2702
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
2703
+ @index += 1
2704
+ else
2705
+ terminal_parse_failure('M')
2706
+ r4 = nil
2707
+ end
2708
+ if r4
2709
+ r0 = r4
2710
+ r0.extend(TimeMultiplier0)
2711
+ else
2712
+ if has_terminal?('h', false, index)
2713
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
2714
+ @index += 1
2715
+ else
2716
+ terminal_parse_failure('h')
2717
+ r5 = nil
2718
+ end
2719
+ if r5
2720
+ r0 = r5
2721
+ r0.extend(TimeMultiplier0)
2722
+ else
2723
+ if has_terminal?('H', false, index)
2724
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
2725
+ @index += 1
2726
+ else
2727
+ terminal_parse_failure('H')
2728
+ r6 = nil
2729
+ end
2730
+ if r6
2731
+ r0 = r6
2732
+ r0.extend(TimeMultiplier0)
2733
+ else
2734
+ if has_terminal?('d', false, index)
2735
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
2736
+ @index += 1
2737
+ else
2738
+ terminal_parse_failure('d')
2739
+ r7 = nil
2740
+ end
2741
+ if r7
2742
+ r0 = r7
2743
+ r0.extend(TimeMultiplier0)
2744
+ else
2745
+ if has_terminal?('D', false, index)
2746
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
2747
+ @index += 1
2748
+ else
2749
+ terminal_parse_failure('D')
2750
+ r8 = nil
2751
+ end
2752
+ if r8
2753
+ r0 = r8
2754
+ r0.extend(TimeMultiplier0)
2755
+ else
2756
+ if has_terminal?('w', false, index)
2757
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
2758
+ @index += 1
2759
+ else
2760
+ terminal_parse_failure('w')
2761
+ r9 = nil
2762
+ end
2763
+ if r9
2764
+ r0 = r9
2765
+ r0.extend(TimeMultiplier0)
2766
+ else
2767
+ if has_terminal?('W', false, index)
2768
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
2769
+ @index += 1
2770
+ else
2771
+ terminal_parse_failure('W')
2772
+ r10 = nil
2773
+ end
2774
+ if r10
2775
+ r0 = r10
2776
+ r0.extend(TimeMultiplier0)
2777
+ else
2778
+ if has_terminal?('', false, index)
2779
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 0))
2780
+ @index += 0
2781
+ else
2782
+ terminal_parse_failure('')
2783
+ r11 = nil
2784
+ end
2785
+ if r11
2786
+ r0 = r11
2787
+ r0.extend(TimeMultiplier0)
2788
+ else
2789
+ @index = i0
2790
+ r0 = nil
2791
+ end
2792
+ end
2793
+ end
2794
+ end
2795
+ end
2796
+ end
2797
+ end
2798
+ end
2799
+ end
2800
+ end
2801
+ end
2802
+
2803
+ node_cache[:time_multiplier][start_index] = r0
2804
+
2805
+ r0
2806
+ end
2807
+
2808
+ module Reretry0
2809
+ def time_interval
2810
+ elements[0]
2811
+ end
2812
+
2813
+ end
2814
+
2815
+ module Reretry1
2816
+ def to_i
2817
+ time_interval.to_i
2818
+ end
2819
+ def to_s
2820
+ time_interval.to_s
2821
+ end
2822
+ end
2823
+
2824
+ def _nt_reretry
2825
+ start_index = index
2826
+ if node_cache[:reretry].has_key?(index)
2827
+ cached = node_cache[:reretry][index]
2828
+ if cached
2829
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2830
+ @index = cached.interval.end
2831
+ end
2832
+ return cached
2833
+ end
2834
+
2835
+ i0, s0 = index, []
2836
+ r1 = _nt_time_interval
2837
+ s0 << r1
2838
+ if r1
2839
+ s2, i2 = [], index
2840
+ loop do
2841
+ r3 = _nt_comment
2842
+ if r3
2843
+ s2 << r3
2844
+ else
2845
+ break
2846
+ end
2847
+ end
2848
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2849
+ s0 << r2
2850
+ end
2851
+ if s0.last
2852
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2853
+ r0.extend(Reretry0)
2854
+ r0.extend(Reretry1)
2855
+ else
2856
+ @index = i0
2857
+ r0 = nil
2858
+ end
2859
+
2860
+ node_cache[:reretry][start_index] = r0
2861
+
2862
+ r0
2863
+ end
2864
+
2865
+ module Expiry0
2866
+ def time_interval
2867
+ elements[0]
2868
+ end
2869
+
2870
+ end
2871
+
2872
+ module Expiry1
2873
+ def to_i
2874
+ time_interval.to_i
2875
+ end
2876
+ def to_s
2877
+ time_interval.to_s
2878
+ end
2879
+ end
2880
+
2881
+ def _nt_expiry
2882
+ start_index = index
2883
+ if node_cache[:expiry].has_key?(index)
2884
+ cached = node_cache[:expiry][index]
2885
+ if cached
2886
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2887
+ @index = cached.interval.end
2888
+ end
2889
+ return cached
2890
+ end
2891
+
2892
+ i0, s0 = index, []
2893
+ r1 = _nt_time_interval
2894
+ s0 << r1
2895
+ if r1
2896
+ s2, i2 = [], index
2897
+ loop do
2898
+ r3 = _nt_comment
2899
+ if r3
2900
+ s2 << r3
2901
+ else
2902
+ break
2903
+ end
2904
+ end
2905
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2906
+ s0 << r2
2907
+ end
2908
+ if s0.last
2909
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2910
+ r0.extend(Expiry0)
2911
+ r0.extend(Expiry1)
2912
+ else
2913
+ @index = i0
2914
+ r0 = nil
2915
+ end
2916
+
2917
+ node_cache[:expiry][start_index] = r0
2918
+
2919
+ r0
2920
+ end
2921
+
2922
+ module Nxttl0
2923
+ def time_interval
2924
+ elements[0]
2925
+ end
2926
+
2927
+ end
2928
+
2929
+ module Nxttl1
2930
+ def to_i
2931
+ time_interval.to_i
2932
+ end
2933
+ def to_s
2934
+ time_interval.to_s
2935
+ end
2936
+ end
2937
+
2938
+ def _nt_nxttl
2939
+ start_index = index
2940
+ if node_cache[:nxttl].has_key?(index)
2941
+ cached = node_cache[:nxttl][index]
2942
+ if cached
2943
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2944
+ @index = cached.interval.end
2945
+ end
2946
+ return cached
2947
+ end
2948
+
2949
+ i0, s0 = index, []
2950
+ r1 = _nt_time_interval
2951
+ s0 << r1
2952
+ if r1
2953
+ s2, i2 = [], index
2954
+ loop do
2955
+ r3 = _nt_comment
2956
+ if r3
2957
+ s2 << r3
2958
+ else
2959
+ break
2960
+ end
2961
+ end
2962
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2963
+ s0 << r2
2964
+ end
2965
+ if s0.last
2966
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2967
+ r0.extend(Nxttl0)
2968
+ r0.extend(Nxttl1)
2969
+ else
2970
+ @index = i0
2971
+ r0 = nil
2972
+ end
2973
+
2974
+ node_cache[:nxttl][start_index] = r0
2975
+
2976
+ r0
2977
+ end
2978
+
2979
+ module Ttl0
2980
+ def time_interval
2981
+ elements[0]
2982
+ end
2983
+
2984
+ def space
2985
+ elements[1]
2986
+ end
2987
+ end
2988
+
2989
+ module Ttl1
2990
+ def to_i
2991
+ respond_to?(:time_interval) ? time_interval.to_i : nil
2992
+ end
2993
+ def to_s
2994
+ respond_to?(:time_interval) ? time_interval.to_s : ''
2995
+ end
2996
+ end
2997
+
2998
+ def _nt_ttl
2999
+ start_index = index
3000
+ if node_cache[:ttl].has_key?(index)
3001
+ cached = node_cache[:ttl][index]
3002
+ if cached
3003
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3004
+ @index = cached.interval.end
3005
+ end
3006
+ return cached
3007
+ end
3008
+
3009
+ i0 = index
3010
+ i1, s1 = index, []
3011
+ r2 = _nt_time_interval
3012
+ s1 << r2
3013
+ if r2
3014
+ r3 = _nt_space
3015
+ s1 << r3
3016
+ end
3017
+ if s1.last
3018
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
3019
+ r1.extend(Ttl0)
3020
+ else
3021
+ @index = i1
3022
+ r1 = nil
3023
+ end
3024
+ if r1
3025
+ r0 = r1
3026
+ r0.extend(Ttl1)
3027
+ else
3028
+ if has_terminal?('', false, index)
3029
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 0))
3030
+ @index += 0
3031
+ else
3032
+ terminal_parse_failure('')
3033
+ r4 = nil
3034
+ end
3035
+ if r4
3036
+ r0 = r4
3037
+ r0.extend(Ttl1)
3038
+ else
3039
+ @index = i0
3040
+ r0 = nil
3041
+ end
3042
+ end
3043
+
3044
+ node_cache[:ttl][start_index] = r0
3045
+
3046
+ r0
3047
+ end
3048
+
3049
+ module Host0
3050
+ def to_s
3051
+ case text_value
3052
+ when /\.$/
3053
+ text_value
3054
+ when "@", /\s/
3055
+ text_value
3056
+ else
3057
+ text_value + '.@'
3058
+ end
3059
+ end
3060
+ end
3061
+
3062
+ def _nt_host
3063
+ start_index = index
3064
+ if node_cache[:host].has_key?(index)
3065
+ cached = node_cache[:host][index]
3066
+ if cached
3067
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3068
+ @index = cached.interval.end
3069
+ end
3070
+ return cached
3071
+ end
3072
+
3073
+ i0 = index
3074
+ s1, i1 = [], index
3075
+ loop do
3076
+ if has_terminal?('\G[*a-zA-Z0-9\\-\\._]', true, index)
3077
+ r2 = true
3078
+ @index += 1
3079
+ else
3080
+ r2 = nil
3081
+ end
3082
+ if r2
3083
+ s1 << r2
3084
+ else
3085
+ break
3086
+ end
3087
+ end
3088
+ if s1.empty?
3089
+ @index = i1
3090
+ r1 = nil
3091
+ else
3092
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
3093
+ end
3094
+ if r1
3095
+ r0 = r1
3096
+ r0.extend(Host0)
3097
+ else
3098
+ if has_terminal?("@", false, index)
3099
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
3100
+ @index += 1
3101
+ else
3102
+ terminal_parse_failure("@")
3103
+ r3 = nil
3104
+ end
3105
+ if r3
3106
+ r0 = r3
3107
+ r0.extend(Host0)
3108
+ else
3109
+ if has_terminal?(' ', false, index)
3110
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
3111
+ @index += 1
3112
+ else
3113
+ terminal_parse_failure(' ')
3114
+ r4 = nil
3115
+ end
3116
+ if r4
3117
+ r0 = r4
3118
+ r0.extend(Host0)
3119
+ else
3120
+ if has_terminal?("\t", false, index)
3121
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
3122
+ @index += 1
3123
+ else
3124
+ terminal_parse_failure("\t")
3125
+ r5 = nil
3126
+ end
3127
+ if r5
3128
+ r0 = r5
3129
+ r0.extend(Host0)
3130
+ else
3131
+ @index = i0
3132
+ r0 = nil
3133
+ end
3134
+ end
3135
+ end
3136
+ end
3137
+
3138
+ node_cache[:host][start_index] = r0
3139
+
3140
+ r0
3141
+ end
3142
+
3143
+ module Data0
3144
+ def to_s
3145
+ text_value.strip
3146
+ end
3147
+ end
3148
+
3149
+ def _nt_data
3150
+ start_index = index
3151
+ if node_cache[:data].has_key?(index)
3152
+ cached = node_cache[:data][index]
3153
+ if cached
3154
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3155
+ @index = cached.interval.end
3156
+ end
3157
+ return cached
3158
+ end
3159
+
3160
+ s0, i0 = [], index
3161
+ loop do
3162
+ if has_terminal?('\G[^;\\n\\r]', true, index)
3163
+ r1 = true
3164
+ @index += 1
3165
+ else
3166
+ r1 = nil
3167
+ end
3168
+ if r1
3169
+ s0 << r1
3170
+ else
3171
+ break
3172
+ end
3173
+ end
3174
+ if s0.empty?
3175
+ @index = i0
3176
+ r0 = nil
3177
+ else
3178
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3179
+ r0.extend(Data0)
3180
+ end
3181
+
3182
+ node_cache[:data][start_index] = r0
3183
+
3184
+ r0
3185
+ end
3186
+
3187
+ module TxtData0
3188
+ end
3189
+
3190
+ module TxtData1
3191
+ end
3192
+
3193
+ module TxtData2
3194
+ def space
3195
+ elements[0]
3196
+ end
3197
+
3198
+ end
3199
+
3200
+ module TxtData3
3201
+ end
3202
+
3203
+ module TxtData4
3204
+ def to_s
3205
+ text_value
3206
+ end
3207
+ end
3208
+
3209
+ def _nt_txt_data
3210
+ start_index = index
3211
+ if node_cache[:txt_data].has_key?(index)
3212
+ cached = node_cache[:txt_data][index]
3213
+ if cached
3214
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3215
+ @index = cached.interval.end
3216
+ end
3217
+ return cached
3218
+ end
3219
+
3220
+ i0, s0 = index, []
3221
+ if has_terminal?('"', false, index)
3222
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
3223
+ @index += 1
3224
+ else
3225
+ terminal_parse_failure('"')
3226
+ r2 = nil
3227
+ end
3228
+ if r2
3229
+ r1 = r2
3230
+ else
3231
+ r1 = instantiate_node(SyntaxNode,input, index...index)
3232
+ end
3233
+ s0 << r1
3234
+ if r1
3235
+ s3, i3 = [], index
3236
+ loop do
3237
+ i4 = index
3238
+ if has_terminal?('\\"', false, index)
3239
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
3240
+ @index += 2
3241
+ else
3242
+ terminal_parse_failure('\\"')
3243
+ r5 = nil
3244
+ end
3245
+ if r5
3246
+ r4 = r5
3247
+ else
3248
+ i6, s6 = index, []
3249
+ i7 = index
3250
+ if has_terminal?('"', false, index)
3251
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
3252
+ @index += 1
3253
+ else
3254
+ terminal_parse_failure('"')
3255
+ r8 = nil
3256
+ end
3257
+ if r8
3258
+ r7 = nil
3259
+ else
3260
+ @index = i7
3261
+ r7 = instantiate_node(SyntaxNode,input, index...index)
3262
+ end
3263
+ s6 << r7
3264
+ if r7
3265
+ if has_terminal?('\G[^\\n\\r]', true, index)
3266
+ r9 = true
3267
+ @index += 1
3268
+ else
3269
+ r9 = nil
3270
+ end
3271
+ s6 << r9
3272
+ end
3273
+ if s6.last
3274
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
3275
+ r6.extend(TxtData0)
3276
+ else
3277
+ @index = i6
3278
+ r6 = nil
3279
+ end
3280
+ if r6
3281
+ r4 = r6
3282
+ else
3283
+ @index = i4
3284
+ r4 = nil
3285
+ end
3286
+ end
3287
+ if r4
3288
+ s3 << r4
3289
+ else
3290
+ break
3291
+ end
3292
+ end
3293
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
3294
+ s0 << r3
3295
+ if r3
3296
+ if has_terminal?('"', false, index)
3297
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
3298
+ @index += 1
3299
+ else
3300
+ terminal_parse_failure('"')
3301
+ r11 = nil
3302
+ end
3303
+ if r11
3304
+ r10 = r11
3305
+ else
3306
+ r10 = instantiate_node(SyntaxNode,input, index...index)
3307
+ end
3308
+ s0 << r10
3309
+ if r10
3310
+ s12, i12 = [], index
3311
+ loop do
3312
+ i13, s13 = index, []
3313
+ r14 = _nt_space
3314
+ s13 << r14
3315
+ if r14
3316
+ if has_terminal?('"', false, index)
3317
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
3318
+ @index += 1
3319
+ else
3320
+ terminal_parse_failure('"')
3321
+ r15 = nil
3322
+ end
3323
+ s13 << r15
3324
+ if r15
3325
+ s16, i16 = [], index
3326
+ loop do
3327
+ i17 = index
3328
+ if has_terminal?('\\"', false, index)
3329
+ r18 = instantiate_node(SyntaxNode,input, index...(index + 2))
3330
+ @index += 2
3331
+ else
3332
+ terminal_parse_failure('\\"')
3333
+ r18 = nil
3334
+ end
3335
+ if r18
3336
+ r17 = r18
3337
+ else
3338
+ i19, s19 = index, []
3339
+ i20 = index
3340
+ if has_terminal?('"', false, index)
3341
+ r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
3342
+ @index += 1
3343
+ else
3344
+ terminal_parse_failure('"')
3345
+ r21 = nil
3346
+ end
3347
+ if r21
3348
+ r20 = nil
3349
+ else
3350
+ @index = i20
3351
+ r20 = instantiate_node(SyntaxNode,input, index...index)
3352
+ end
3353
+ s19 << r20
3354
+ if r20
3355
+ if has_terminal?('\G[^\\n\\r]', true, index)
3356
+ r22 = true
3357
+ @index += 1
3358
+ else
3359
+ r22 = nil
3360
+ end
3361
+ s19 << r22
3362
+ end
3363
+ if s19.last
3364
+ r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
3365
+ r19.extend(TxtData1)
3366
+ else
3367
+ @index = i19
3368
+ r19 = nil
3369
+ end
3370
+ if r19
3371
+ r17 = r19
3372
+ else
3373
+ @index = i17
3374
+ r17 = nil
3375
+ end
3376
+ end
3377
+ if r17
3378
+ s16 << r17
3379
+ else
3380
+ break
3381
+ end
3382
+ end
3383
+ r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
3384
+ s13 << r16
3385
+ if r16
3386
+ if has_terminal?('"', false, index)
3387
+ r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
3388
+ @index += 1
3389
+ else
3390
+ terminal_parse_failure('"')
3391
+ r23 = nil
3392
+ end
3393
+ s13 << r23
3394
+ end
3395
+ end
3396
+ end
3397
+ if s13.last
3398
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
3399
+ r13.extend(TxtData2)
3400
+ else
3401
+ @index = i13
3402
+ r13 = nil
3403
+ end
3404
+ if r13
3405
+ s12 << r13
3406
+ else
3407
+ break
3408
+ end
3409
+ end
3410
+ r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
3411
+ s0 << r12
3412
+ end
3413
+ end
3414
+ end
3415
+ if s0.last
3416
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3417
+ r0.extend(TxtData3)
3418
+ r0.extend(TxtData4)
3419
+ else
3420
+ @index = i0
3421
+ r0 = nil
3422
+ end
3423
+
3424
+ node_cache[:txt_data][start_index] = r0
3425
+
3426
+ r0
3427
+ end
3428
+
3429
+ end
3430
+
3431
+ class Parser < Treetop::Runtime::CompiledParser
3432
+ include ZonefileGrammar # :nodoc:
3433
+ end
3434
+ end
3435
+ end