dns-zonefile 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a5f5cceb20d06d6301bba8050c7ad450f2b5c6eb
4
+ data.tar.gz: b98d282c912ef98f0d2dccd91d7c9777ae092840
5
+ SHA512:
6
+ metadata.gz: 647199e1c8dbcc81cc0deb392ce07af573272937960e690bdf652b407aaea67ce5776177a9cb17b726e04261d48d22a25ca59f70258d34936febf3f1522104b7
7
+ data.tar.gz: 1f287a15a11b931824983bb26ea8e9d790143c2d0485c637b4f3db85be75178a02d5e98d6ed3b44c3747fdfa36fc37fcde9a9f26cded2aa179ef9e368afb1b48
data/doc/zonefile.treetop CHANGED
@@ -397,10 +397,35 @@ grammar Zonefile
397
397
  end
398
398
 
399
399
  rule txt_data
400
- '"'? ('\\"' / !'"' [^\n\r])* '"'? (space '"' ('\\"' / !'"' [^\n\r])* '"')* {
400
+ txt_string (space txt_data)* {
401
401
  def to_s
402
402
  text_value
403
403
  end
404
404
  }
405
405
  end
406
+
407
+ rule txt_string
408
+ (quoted_string / unquoted_string) {
409
+ def to_s
410
+ text_value
411
+ end
412
+ }
413
+ end
414
+
415
+ rule quoted_string
416
+ ( '"' ( '\"' / [^"] )* '"') {
417
+ def to_s
418
+ text_value
419
+ end
420
+ }
421
+ end
422
+
423
+ rule unquoted_string
424
+ [a-zA-Z0-9]+ {
425
+ def to_s
426
+ text_value
427
+ end
428
+ }
429
+ end
430
+
406
431
  end
@@ -55,7 +55,7 @@ module DNS
55
55
  if node_cache[:zone].has_key?(index)
56
56
  cached = node_cache[:zone][index]
57
57
  if cached
58
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
58
+ node_cache[:zone][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
59
59
  @index = cached.interval.end
60
60
  end
61
61
  return cached
@@ -67,14 +67,17 @@ module DNS
67
67
  i2 = index
68
68
  r3 = _nt_variable
69
69
  if r3
70
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
70
71
  r2 = r3
71
72
  else
72
73
  r4 = _nt_space_or_break
73
74
  if r4
75
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
74
76
  r2 = r4
75
77
  else
76
78
  r5 = _nt_comment
77
79
  if r5
80
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
78
81
  r2 = r5
79
82
  else
80
83
  @index = i2
@@ -99,22 +102,27 @@ module DNS
99
102
  i8 = index
100
103
  r9 = _nt_resource_record
101
104
  if r9
105
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
102
106
  r8 = r9
103
107
  else
104
108
  r10 = _nt_variable
105
109
  if r10
110
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
106
111
  r8 = r10
107
112
  else
108
113
  r11 = _nt_comment
109
114
  if r11
115
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
110
116
  r8 = r11
111
117
  else
112
118
  r12 = _nt_space
113
119
  if r12
120
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
114
121
  r8 = r12
115
122
  else
116
123
  r13 = _nt_linebreak
117
124
  if r13
125
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
118
126
  r8 = r13
119
127
  else
120
128
  @index = i8
@@ -176,28 +184,29 @@ module DNS
176
184
  if node_cache[:variable].has_key?(index)
177
185
  cached = node_cache[:variable][index]
178
186
  if cached
179
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
187
+ node_cache[:variable][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
180
188
  @index = cached.interval.end
181
189
  end
182
190
  return cached
183
191
  end
184
192
 
185
193
  i0, s0 = index, []
186
- if has_terminal?("$", false, index)
187
- r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
188
- @index += 1
194
+ if (match_len = has_terminal?("$", false, index))
195
+ r1 = true
196
+ @index += match_len
189
197
  else
190
- terminal_parse_failure("$")
198
+ terminal_parse_failure('"$"')
191
199
  r1 = nil
192
200
  end
193
201
  s0 << r1
194
202
  if r1
195
203
  s2, i2 = [], index
196
204
  loop do
197
- if has_terminal?('\G[a-zA-Z0-9]', true, index)
205
+ if has_terminal?(@regexps[gr = '\A[a-zA-Z0-9]'] ||= Regexp.new(gr), :regexp, index)
198
206
  r3 = true
199
207
  @index += 1
200
208
  else
209
+ terminal_parse_failure('[a-zA-Z0-9]')
201
210
  r3 = nil
202
211
  end
203
212
  if r3
@@ -219,10 +228,11 @@ module DNS
219
228
  if r4
220
229
  s5, i5 = [], index
221
230
  loop do
222
- if has_terminal?('\G[a-zA-Z0-9\\.\\-]', true, index)
231
+ if has_terminal?(@regexps[gr = '\A[a-zA-Z0-9\\.\\-]'] ||= Regexp.new(gr), :regexp, index)
223
232
  r6 = true
224
233
  @index += 1
225
234
  else
235
+ terminal_parse_failure('[a-zA-Z0-9\\.\\-]')
226
236
  r6 = nil
227
237
  end
228
238
  if r6
@@ -361,7 +371,7 @@ module DNS
361
371
  if node_cache[:soa].has_key?(index)
362
372
  cached = node_cache[:soa][index]
363
373
  if cached
364
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
374
+ node_cache[:soa][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
365
375
  @index = cached.interval.end
366
376
  end
367
377
  return cached
@@ -380,11 +390,11 @@ module DNS
380
390
  r4 = _nt_klass
381
391
  s0 << r4
382
392
  if r4
383
- if has_terminal?("SOA", false, index)
384
- r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
385
- @index += 3
393
+ if (match_len = has_terminal?("SOA", false, index))
394
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
395
+ @index += match_len
386
396
  else
387
- terminal_parse_failure("SOA")
397
+ terminal_parse_failure('"SOA"')
388
398
  r5 = nil
389
399
  end
390
400
  s0 << r5
@@ -404,11 +414,11 @@ module DNS
404
414
  r10 = _nt_space
405
415
  s0 << r10
406
416
  if r10
407
- if has_terminal?("(", false, index)
408
- r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
409
- @index += 1
417
+ if (match_len = has_terminal?("(", false, index))
418
+ r12 = true
419
+ @index += match_len
410
420
  else
411
- terminal_parse_failure("(")
421
+ terminal_parse_failure('"("')
412
422
  r12 = nil
413
423
  end
414
424
  if r12
@@ -469,11 +479,11 @@ module DNS
469
479
  r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
470
480
  s0 << r24
471
481
  if r24
472
- if has_terminal?(")", false, index)
473
- r27 = instantiate_node(SyntaxNode,input, index...(index + 1))
474
- @index += 1
482
+ if (match_len = has_terminal?(")", false, index))
483
+ r27 = true
484
+ @index += match_len
475
485
  else
476
- terminal_parse_failure(")")
486
+ terminal_parse_failure('")"')
477
487
  r27 = nil
478
488
  end
479
489
  if r27
@@ -567,7 +577,7 @@ module DNS
567
577
  if node_cache[:resource_record].has_key?(index)
568
578
  cached = node_cache[:resource_record][index]
569
579
  if cached
570
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
580
+ node_cache[:resource_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
571
581
  @index = cached.interval.end
572
582
  end
573
583
  return cached
@@ -577,46 +587,57 @@ module DNS
577
587
  i1 = index
578
588
  r2 = _nt_a_record
579
589
  if r2
590
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
580
591
  r1 = r2
581
592
  else
582
593
  r3 = _nt_aaaa_record
583
594
  if r3
595
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
584
596
  r1 = r3
585
597
  else
586
598
  r4 = _nt_cname_record
587
599
  if r4
600
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
588
601
  r1 = r4
589
602
  else
590
603
  r5 = _nt_mx_record
591
604
  if r5
605
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
592
606
  r1 = r5
593
607
  else
594
608
  r6 = _nt_naptr_record
595
609
  if r6
610
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
596
611
  r1 = r6
597
612
  else
598
613
  r7 = _nt_ns_record
599
614
  if r7
615
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
600
616
  r1 = r7
601
617
  else
602
618
  r8 = _nt_ptr_record
603
619
  if r8
620
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
604
621
  r1 = r8
605
622
  else
606
623
  r9 = _nt_srv_record
607
624
  if r9
625
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
608
626
  r1 = r9
609
627
  else
610
628
  r10 = _nt_spf_record
611
629
  if r10
630
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
612
631
  r1 = r10
613
632
  else
614
633
  r11 = _nt_txt_record
615
634
  if r11
635
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
616
636
  r1 = r11
617
637
  else
618
638
  r12 = _nt_soa_record
619
639
  if r12
640
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
620
641
  r1 = r12
621
642
  else
622
643
  @index = i1
@@ -710,7 +731,7 @@ module DNS
710
731
  if node_cache[:a_record].has_key?(index)
711
732
  cached = node_cache[:a_record][index]
712
733
  if cached
713
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
734
+ node_cache[:a_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
714
735
  @index = cached.interval.end
715
736
  end
716
737
  return cached
@@ -729,11 +750,11 @@ module DNS
729
750
  r4 = _nt_klass
730
751
  s0 << r4
731
752
  if r4
732
- if has_terminal?("A", false, index)
733
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
734
- @index += 1
753
+ if (match_len = has_terminal?("A", false, index))
754
+ r5 = true
755
+ @index += match_len
735
756
  else
736
- terminal_parse_failure("A")
757
+ terminal_parse_failure('"A"')
737
758
  r5 = nil
738
759
  end
739
760
  s0 << r5
@@ -777,7 +798,7 @@ module DNS
777
798
  if node_cache[:ip_address].has_key?(index)
778
799
  cached = node_cache[:ip_address][index]
779
800
  if cached
780
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
801
+ node_cache[:ip_address][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
781
802
  @index = cached.interval.end
782
803
  end
783
804
  return cached
@@ -786,10 +807,11 @@ module DNS
786
807
  i0, s0 = index, []
787
808
  s1, i1 = [], index
788
809
  loop do
789
- if has_terminal?('\G[\\d]', true, index)
810
+ if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
790
811
  r2 = true
791
812
  @index += 1
792
813
  else
814
+ terminal_parse_failure('[\\d]')
793
815
  r2 = nil
794
816
  end
795
817
  if r2
@@ -806,21 +828,22 @@ module DNS
806
828
  end
807
829
  s0 << r1
808
830
  if r1
809
- if has_terminal?(".", false, index)
810
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
811
- @index += 1
831
+ if (match_len = has_terminal?(".", false, index))
832
+ r3 = true
833
+ @index += match_len
812
834
  else
813
- terminal_parse_failure(".")
835
+ terminal_parse_failure('"."')
814
836
  r3 = nil
815
837
  end
816
838
  s0 << r3
817
839
  if r3
818
840
  s4, i4 = [], index
819
841
  loop do
820
- if has_terminal?('\G[\\d]', true, index)
842
+ if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
821
843
  r5 = true
822
844
  @index += 1
823
845
  else
846
+ terminal_parse_failure('[\\d]')
824
847
  r5 = nil
825
848
  end
826
849
  if r5
@@ -837,21 +860,22 @@ module DNS
837
860
  end
838
861
  s0 << r4
839
862
  if r4
840
- if has_terminal?(".", false, index)
841
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
842
- @index += 1
863
+ if (match_len = has_terminal?(".", false, index))
864
+ r6 = true
865
+ @index += match_len
843
866
  else
844
- terminal_parse_failure(".")
867
+ terminal_parse_failure('"."')
845
868
  r6 = nil
846
869
  end
847
870
  s0 << r6
848
871
  if r6
849
872
  s7, i7 = [], index
850
873
  loop do
851
- if has_terminal?('\G[\\d]', true, index)
874
+ if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
852
875
  r8 = true
853
876
  @index += 1
854
877
  else
878
+ terminal_parse_failure('[\\d]')
855
879
  r8 = nil
856
880
  end
857
881
  if r8
@@ -868,21 +892,22 @@ module DNS
868
892
  end
869
893
  s0 << r7
870
894
  if r7
871
- if has_terminal?(".", false, index)
872
- r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
873
- @index += 1
895
+ if (match_len = has_terminal?(".", false, index))
896
+ r9 = true
897
+ @index += match_len
874
898
  else
875
- terminal_parse_failure(".")
899
+ terminal_parse_failure('"."')
876
900
  r9 = nil
877
901
  end
878
902
  s0 << r9
879
903
  if r9
880
904
  s10, i10 = [], index
881
905
  loop do
882
- if has_terminal?('\G[\\d]', true, index)
906
+ if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
883
907
  r11 = true
884
908
  @index += 1
885
909
  else
910
+ terminal_parse_failure('[\\d]')
886
911
  r11 = nil
887
912
  end
888
913
  if r11
@@ -955,7 +980,7 @@ module DNS
955
980
  if node_cache[:aaaa_record].has_key?(index)
956
981
  cached = node_cache[:aaaa_record][index]
957
982
  if cached
958
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
983
+ node_cache[:aaaa_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
959
984
  @index = cached.interval.end
960
985
  end
961
986
  return cached
@@ -974,11 +999,11 @@ module DNS
974
999
  r4 = _nt_klass
975
1000
  s0 << r4
976
1001
  if r4
977
- if has_terminal?("AAAA", false, index)
978
- r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
979
- @index += 4
1002
+ if (match_len = has_terminal?("AAAA", false, index))
1003
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1004
+ @index += match_len
980
1005
  else
981
- terminal_parse_failure("AAAA")
1006
+ terminal_parse_failure('"AAAA"')
982
1007
  r5 = nil
983
1008
  end
984
1009
  s0 << r5
@@ -1019,7 +1044,7 @@ module DNS
1019
1044
  if node_cache[:ip6_address].has_key?(index)
1020
1045
  cached = node_cache[:ip6_address][index]
1021
1046
  if cached
1022
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1047
+ node_cache[:ip6_address][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1023
1048
  @index = cached.interval.end
1024
1049
  end
1025
1050
  return cached
@@ -1027,10 +1052,11 @@ module DNS
1027
1052
 
1028
1053
  s0, i0 = [], index
1029
1054
  loop do
1030
- if has_terminal?('\G[\\da-fA-F:.]', true, index)
1055
+ if has_terminal?(@regexps[gr = '\A[\\da-fA-F:.]'] ||= Regexp.new(gr), :regexp, index)
1031
1056
  r1 = true
1032
1057
  @index += 1
1033
1058
  else
1059
+ terminal_parse_failure('[\\da-fA-F:.]')
1034
1060
  r1 = nil
1035
1061
  end
1036
1062
  if r1
@@ -1046,6 +1072,9 @@ module DNS
1046
1072
  @index = i0
1047
1073
  r0 = nil
1048
1074
  else
1075
+ if s0.size < 39
1076
+ terminal_failures.pop
1077
+ end
1049
1078
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1050
1079
  r0.extend(Ip6Address0)
1051
1080
  end
@@ -1162,7 +1191,7 @@ module DNS
1162
1191
  if node_cache[:cname_record].has_key?(index)
1163
1192
  cached = node_cache[:cname_record][index]
1164
1193
  if cached
1165
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1194
+ node_cache[:cname_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1166
1195
  @index = cached.interval.end
1167
1196
  end
1168
1197
  return cached
@@ -1182,11 +1211,11 @@ module DNS
1182
1211
  r5 = _nt_klass
1183
1212
  s1 << r5
1184
1213
  if r5
1185
- if has_terminal?("CNAME", false, index)
1186
- r6 = instantiate_node(SyntaxNode,input, index...(index + 5))
1187
- @index += 5
1214
+ if (match_len = has_terminal?("CNAME", false, index))
1215
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1216
+ @index += match_len
1188
1217
  else
1189
- terminal_parse_failure("CNAME")
1218
+ terminal_parse_failure('"CNAME"')
1190
1219
  r6 = nil
1191
1220
  end
1192
1221
  s1 << r6
@@ -1210,6 +1239,7 @@ module DNS
1210
1239
  r1 = nil
1211
1240
  end
1212
1241
  if r1
1242
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1213
1243
  r0 = r1
1214
1244
  r0.extend(CnameRecord4)
1215
1245
  else
@@ -1226,11 +1256,11 @@ module DNS
1226
1256
  r13 = _nt_ttl
1227
1257
  s9 << r13
1228
1258
  if r13
1229
- if has_terminal?("CNAME", false, index)
1230
- r14 = instantiate_node(SyntaxNode,input, index...(index + 5))
1231
- @index += 5
1259
+ if (match_len = has_terminal?("CNAME", false, index))
1260
+ r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1261
+ @index += match_len
1232
1262
  else
1233
- terminal_parse_failure("CNAME")
1263
+ terminal_parse_failure('"CNAME"')
1234
1264
  r14 = nil
1235
1265
  end
1236
1266
  s9 << r14
@@ -1254,6 +1284,7 @@ module DNS
1254
1284
  r9 = nil
1255
1285
  end
1256
1286
  if r9
1287
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
1257
1288
  r0 = r9
1258
1289
  r0.extend(CnameRecord4)
1259
1290
  else
@@ -1267,11 +1298,11 @@ module DNS
1267
1298
  r20 = _nt_ttl
1268
1299
  s17 << r20
1269
1300
  if r20
1270
- if has_terminal?("CNAME", false, index)
1271
- r21 = instantiate_node(SyntaxNode,input, index...(index + 5))
1272
- @index += 5
1301
+ if (match_len = has_terminal?("CNAME", false, index))
1302
+ r21 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1303
+ @index += match_len
1273
1304
  else
1274
- terminal_parse_failure("CNAME")
1305
+ terminal_parse_failure('"CNAME"')
1275
1306
  r21 = nil
1276
1307
  end
1277
1308
  s17 << r21
@@ -1294,6 +1325,7 @@ module DNS
1294
1325
  r17 = nil
1295
1326
  end
1296
1327
  if r17
1328
+ r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
1297
1329
  r0 = r17
1298
1330
  r0.extend(CnameRecord4)
1299
1331
  else
@@ -1307,11 +1339,11 @@ module DNS
1307
1339
  r27 = _nt_klass
1308
1340
  s24 << r27
1309
1341
  if r27
1310
- if has_terminal?("CNAME", false, index)
1311
- r28 = instantiate_node(SyntaxNode,input, index...(index + 5))
1312
- @index += 5
1342
+ if (match_len = has_terminal?("CNAME", false, index))
1343
+ r28 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1344
+ @index += match_len
1313
1345
  else
1314
- terminal_parse_failure("CNAME")
1346
+ terminal_parse_failure('"CNAME"')
1315
1347
  r28 = nil
1316
1348
  end
1317
1349
  s24 << r28
@@ -1334,6 +1366,7 @@ module DNS
1334
1366
  r24 = nil
1335
1367
  end
1336
1368
  if r24
1369
+ r24 = SyntaxNode.new(input, (index-1)...index) if r24 == true
1337
1370
  r0 = r24
1338
1371
  r0.extend(CnameRecord4)
1339
1372
  else
@@ -1394,7 +1427,7 @@ module DNS
1394
1427
  if node_cache[:mx_record].has_key?(index)
1395
1428
  cached = node_cache[:mx_record][index]
1396
1429
  if cached
1397
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1430
+ node_cache[:mx_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1398
1431
  @index = cached.interval.end
1399
1432
  end
1400
1433
  return cached
@@ -1413,11 +1446,11 @@ module DNS
1413
1446
  r4 = _nt_klass
1414
1447
  s0 << r4
1415
1448
  if r4
1416
- if has_terminal?("MX", false, index)
1417
- r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
1418
- @index += 2
1449
+ if (match_len = has_terminal?("MX", false, index))
1450
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1451
+ @index += match_len
1419
1452
  else
1420
- terminal_parse_failure("MX")
1453
+ terminal_parse_failure('"MX"')
1421
1454
  r5 = nil
1422
1455
  end
1423
1456
  s0 << r5
@@ -1492,7 +1525,7 @@ module DNS
1492
1525
  if node_cache[:naptr_record].has_key?(index)
1493
1526
  cached = node_cache[:naptr_record][index]
1494
1527
  if cached
1495
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1528
+ node_cache[:naptr_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1496
1529
  @index = cached.interval.end
1497
1530
  end
1498
1531
  return cached
@@ -1511,11 +1544,11 @@ module DNS
1511
1544
  r4 = _nt_klass
1512
1545
  s0 << r4
1513
1546
  if r4
1514
- if has_terminal?("NAPTR", false, index)
1515
- r5 = instantiate_node(SyntaxNode,input, index...(index + 5))
1516
- @index += 5
1547
+ if (match_len = has_terminal?("NAPTR", false, index))
1548
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1549
+ @index += match_len
1517
1550
  else
1518
- terminal_parse_failure("NAPTR")
1551
+ terminal_parse_failure('"NAPTR"')
1519
1552
  r5 = nil
1520
1553
  end
1521
1554
  s0 << r5
@@ -1582,7 +1615,7 @@ module DNS
1582
1615
  if node_cache[:ns_record].has_key?(index)
1583
1616
  cached = node_cache[:ns_record][index]
1584
1617
  if cached
1585
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1618
+ node_cache[:ns_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1586
1619
  @index = cached.interval.end
1587
1620
  end
1588
1621
  return cached
@@ -1601,11 +1634,11 @@ module DNS
1601
1634
  r4 = _nt_klass
1602
1635
  s0 << r4
1603
1636
  if r4
1604
- if has_terminal?("NS", false, index)
1605
- r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
1606
- @index += 2
1637
+ if (match_len = has_terminal?("NS", false, index))
1638
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1639
+ @index += match_len
1607
1640
  else
1608
- terminal_parse_failure("NS")
1641
+ terminal_parse_failure('"NS"')
1609
1642
  r5 = nil
1610
1643
  end
1611
1644
  s0 << r5
@@ -1672,7 +1705,7 @@ module DNS
1672
1705
  if node_cache[:ptr_record].has_key?(index)
1673
1706
  cached = node_cache[:ptr_record][index]
1674
1707
  if cached
1675
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1708
+ node_cache[:ptr_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1676
1709
  @index = cached.interval.end
1677
1710
  end
1678
1711
  return cached
@@ -1691,11 +1724,11 @@ module DNS
1691
1724
  r4 = _nt_klass
1692
1725
  s0 << r4
1693
1726
  if r4
1694
- if has_terminal?("PTR", false, index)
1695
- r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
1696
- @index += 3
1727
+ if (match_len = has_terminal?("PTR", false, index))
1728
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1729
+ @index += match_len
1697
1730
  else
1698
- terminal_parse_failure("PTR")
1731
+ terminal_parse_failure('"PTR"')
1699
1732
  r5 = nil
1700
1733
  end
1701
1734
  s0 << r5
@@ -1778,7 +1811,7 @@ module DNS
1778
1811
  if node_cache[:soa_record].has_key?(index)
1779
1812
  cached = node_cache[:soa_record][index]
1780
1813
  if cached
1781
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1814
+ node_cache[:soa_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1782
1815
  @index = cached.interval.end
1783
1816
  end
1784
1817
  return cached
@@ -1797,11 +1830,11 @@ module DNS
1797
1830
  r4 = _nt_klass
1798
1831
  s0 << r4
1799
1832
  if r4
1800
- if has_terminal?("SOA", false, index)
1801
- r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
1802
- @index += 3
1833
+ if (match_len = has_terminal?("SOA", false, index))
1834
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1835
+ @index += match_len
1803
1836
  else
1804
- terminal_parse_failure("SOA")
1837
+ terminal_parse_failure('"SOA"')
1805
1838
  r5 = nil
1806
1839
  end
1807
1840
  s0 << r5
@@ -2050,7 +2083,7 @@ module DNS
2050
2083
  if node_cache[:srv_record].has_key?(index)
2051
2084
  cached = node_cache[:srv_record][index]
2052
2085
  if cached
2053
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2086
+ node_cache[:srv_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2054
2087
  @index = cached.interval.end
2055
2088
  end
2056
2089
  return cached
@@ -2070,11 +2103,11 @@ module DNS
2070
2103
  r5 = _nt_klass
2071
2104
  s1 << r5
2072
2105
  if r5
2073
- if has_terminal?("SRV", false, index)
2074
- r6 = instantiate_node(SyntaxNode,input, index...(index + 3))
2075
- @index += 3
2106
+ if (match_len = has_terminal?("SRV", false, index))
2107
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2108
+ @index += match_len
2076
2109
  else
2077
- terminal_parse_failure("SRV")
2110
+ terminal_parse_failure('"SRV"')
2078
2111
  r6 = nil
2079
2112
  end
2080
2113
  s1 << r6
@@ -2122,6 +2155,7 @@ module DNS
2122
2155
  r1 = nil
2123
2156
  end
2124
2157
  if r1
2158
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2125
2159
  r0 = r1
2126
2160
  r0.extend(SrvRecord4)
2127
2161
  else
@@ -2138,11 +2172,11 @@ module DNS
2138
2172
  r19 = _nt_ttl
2139
2173
  s15 << r19
2140
2174
  if r19
2141
- if has_terminal?("SRV", false, index)
2142
- r20 = instantiate_node(SyntaxNode,input, index...(index + 3))
2143
- @index += 3
2175
+ if (match_len = has_terminal?("SRV", false, index))
2176
+ r20 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2177
+ @index += match_len
2144
2178
  else
2145
- terminal_parse_failure("SRV")
2179
+ terminal_parse_failure('"SRV"')
2146
2180
  r20 = nil
2147
2181
  end
2148
2182
  s15 << r20
@@ -2190,6 +2224,7 @@ module DNS
2190
2224
  r15 = nil
2191
2225
  end
2192
2226
  if r15
2227
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
2193
2228
  r0 = r15
2194
2229
  r0.extend(SrvRecord4)
2195
2230
  else
@@ -2203,11 +2238,11 @@ module DNS
2203
2238
  r32 = _nt_ttl
2204
2239
  s29 << r32
2205
2240
  if r32
2206
- if has_terminal?("SRV", false, index)
2207
- r33 = instantiate_node(SyntaxNode,input, index...(index + 3))
2208
- @index += 3
2241
+ if (match_len = has_terminal?("SRV", false, index))
2242
+ r33 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2243
+ @index += match_len
2209
2244
  else
2210
- terminal_parse_failure("SRV")
2245
+ terminal_parse_failure('"SRV"')
2211
2246
  r33 = nil
2212
2247
  end
2213
2248
  s29 << r33
@@ -2254,6 +2289,7 @@ module DNS
2254
2289
  r29 = nil
2255
2290
  end
2256
2291
  if r29
2292
+ r29 = SyntaxNode.new(input, (index-1)...index) if r29 == true
2257
2293
  r0 = r29
2258
2294
  r0.extend(SrvRecord4)
2259
2295
  else
@@ -2267,11 +2303,11 @@ module DNS
2267
2303
  r45 = _nt_klass
2268
2304
  s42 << r45
2269
2305
  if r45
2270
- if has_terminal?("SRV", false, index)
2271
- r46 = instantiate_node(SyntaxNode,input, index...(index + 3))
2272
- @index += 3
2306
+ if (match_len = has_terminal?("SRV", false, index))
2307
+ r46 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2308
+ @index += match_len
2273
2309
  else
2274
- terminal_parse_failure("SRV")
2310
+ terminal_parse_failure('"SRV"')
2275
2311
  r46 = nil
2276
2312
  end
2277
2313
  s42 << r46
@@ -2318,6 +2354,7 @@ module DNS
2318
2354
  r42 = nil
2319
2355
  end
2320
2356
  if r42
2357
+ r42 = SyntaxNode.new(input, (index-1)...index) if r42 == true
2321
2358
  r0 = r42
2322
2359
  r0.extend(SrvRecord4)
2323
2360
  else
@@ -2370,7 +2407,7 @@ module DNS
2370
2407
  if node_cache[:spf_record].has_key?(index)
2371
2408
  cached = node_cache[:spf_record][index]
2372
2409
  if cached
2373
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2410
+ node_cache[:spf_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2374
2411
  @index = cached.interval.end
2375
2412
  end
2376
2413
  return cached
@@ -2389,11 +2426,11 @@ module DNS
2389
2426
  r4 = _nt_klass
2390
2427
  s0 << r4
2391
2428
  if r4
2392
- if has_terminal?("SPF", false, index)
2393
- r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
2394
- @index += 3
2429
+ if (match_len = has_terminal?("SPF", false, index))
2430
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2431
+ @index += match_len
2395
2432
  else
2396
- terminal_parse_failure("SPF")
2433
+ terminal_parse_failure('"SPF"')
2397
2434
  r5 = nil
2398
2435
  end
2399
2436
  s0 << r5
@@ -2460,7 +2497,7 @@ module DNS
2460
2497
  if node_cache[:txt_record].has_key?(index)
2461
2498
  cached = node_cache[:txt_record][index]
2462
2499
  if cached
2463
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2500
+ node_cache[:txt_record][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2464
2501
  @index = cached.interval.end
2465
2502
  end
2466
2503
  return cached
@@ -2479,11 +2516,11 @@ module DNS
2479
2516
  r4 = _nt_klass
2480
2517
  s0 << r4
2481
2518
  if r4
2482
- if has_terminal?("TXT", false, index)
2483
- r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
2484
- @index += 3
2519
+ if (match_len = has_terminal?("TXT", false, index))
2520
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2521
+ @index += match_len
2485
2522
  else
2486
- terminal_parse_failure("TXT")
2523
+ terminal_parse_failure('"TXT"')
2487
2524
  r5 = nil
2488
2525
  end
2489
2526
  s0 << r5
@@ -2531,7 +2568,7 @@ module DNS
2531
2568
  if node_cache[:origin].has_key?(index)
2532
2569
  cached = node_cache[:origin][index]
2533
2570
  if cached
2534
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2571
+ node_cache[:origin][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2535
2572
  @index = cached.interval.end
2536
2573
  end
2537
2574
  return cached
@@ -2578,7 +2615,7 @@ module DNS
2578
2615
  if node_cache[:space].has_key?(index)
2579
2616
  cached = node_cache[:space][index]
2580
2617
  if cached
2581
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2618
+ node_cache[:space][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2582
2619
  @index = cached.interval.end
2583
2620
  end
2584
2621
  return cached
@@ -2586,10 +2623,11 @@ module DNS
2586
2623
 
2587
2624
  s0, i0 = [], index
2588
2625
  loop do
2589
- if has_terminal?('\G[ \\t]', true, index)
2626
+ if has_terminal?(@regexps[gr = '\A[ \\t]'] ||= Regexp.new(gr), :regexp, index)
2590
2627
  r1 = true
2591
2628
  @index += 1
2592
2629
  else
2630
+ terminal_parse_failure('[ \\t]')
2593
2631
  r1 = nil
2594
2632
  end
2595
2633
  if r1
@@ -2622,7 +2660,7 @@ module DNS
2622
2660
  if node_cache[:linebreak].has_key?(index)
2623
2661
  cached = node_cache[:linebreak][index]
2624
2662
  if cached
2625
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2663
+ node_cache[:linebreak][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2626
2664
  @index = cached.interval.end
2627
2665
  end
2628
2666
  return cached
@@ -2630,10 +2668,11 @@ module DNS
2630
2668
 
2631
2669
  s0, i0 = [], index
2632
2670
  loop do
2633
- if has_terminal?('\G[\\n\\r]', true, index)
2671
+ if has_terminal?(@regexps[gr = '\A[\\n\\r]'] ||= Regexp.new(gr), :regexp, index)
2634
2672
  r1 = true
2635
2673
  @index += 1
2636
2674
  else
2675
+ terminal_parse_failure('[\\n\\r]')
2637
2676
  r1 = nil
2638
2677
  end
2639
2678
  if r1
@@ -2666,7 +2705,7 @@ module DNS
2666
2705
  if node_cache[:space_or_break].has_key?(index)
2667
2706
  cached = node_cache[:space_or_break][index]
2668
2707
  if cached
2669
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2708
+ node_cache[:space_or_break][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2670
2709
  @index = cached.interval.end
2671
2710
  end
2672
2711
  return cached
@@ -2674,10 +2713,11 @@ module DNS
2674
2713
 
2675
2714
  s0, i0 = [], index
2676
2715
  loop do
2677
- if has_terminal?('\G[\\s]', true, index)
2716
+ if has_terminal?(@regexps[gr = '\A[\\s]'] ||= Regexp.new(gr), :regexp, index)
2678
2717
  r1 = true
2679
2718
  @index += 1
2680
2719
  else
2720
+ terminal_parse_failure('[\\s]')
2681
2721
  r1 = nil
2682
2722
  end
2683
2723
  if r1
@@ -2716,7 +2756,7 @@ module DNS
2716
2756
  if node_cache[:klass].has_key?(index)
2717
2757
  cached = node_cache[:klass][index]
2718
2758
  if cached
2719
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2759
+ node_cache[:klass][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2720
2760
  @index = cached.interval.end
2721
2761
  end
2722
2762
  return cached
@@ -2724,11 +2764,11 @@ module DNS
2724
2764
 
2725
2765
  i0 = index
2726
2766
  i1, s1 = index, []
2727
- if has_terminal?("IN", false, index)
2728
- r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
2729
- @index += 2
2767
+ if (match_len = has_terminal?("IN", false, index))
2768
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2769
+ @index += match_len
2730
2770
  else
2731
- terminal_parse_failure("IN")
2771
+ terminal_parse_failure('"IN"')
2732
2772
  r2 = nil
2733
2773
  end
2734
2774
  s1 << r2
@@ -2744,17 +2784,19 @@ module DNS
2744
2784
  r1 = nil
2745
2785
  end
2746
2786
  if r1
2787
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2747
2788
  r0 = r1
2748
2789
  r0.extend(Klass1)
2749
2790
  else
2750
- if has_terminal?('', false, index)
2751
- r4 = instantiate_node(SyntaxNode,input, index...(index + 0))
2752
- @index += 0
2791
+ if (match_len = has_terminal?('', false, index))
2792
+ r4 = true
2793
+ @index += match_len
2753
2794
  else
2754
- terminal_parse_failure('')
2795
+ terminal_parse_failure('\'\'')
2755
2796
  r4 = nil
2756
2797
  end
2757
2798
  if r4
2799
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
2758
2800
  r0 = r4
2759
2801
  r0.extend(Klass1)
2760
2802
  else
@@ -2782,7 +2824,7 @@ module DNS
2782
2824
  if node_cache[:comment].has_key?(index)
2783
2825
  cached = node_cache[:comment][index]
2784
2826
  if cached
2785
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2827
+ node_cache[:comment][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2786
2828
  @index = cached.interval.end
2787
2829
  end
2788
2830
  return cached
@@ -2801,21 +2843,22 @@ module DNS
2801
2843
  r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2802
2844
  s0 << r1
2803
2845
  if r1
2804
- if has_terminal?(";", false, index)
2805
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
2806
- @index += 1
2846
+ if (match_len = has_terminal?(";", false, index))
2847
+ r3 = true
2848
+ @index += match_len
2807
2849
  else
2808
- terminal_parse_failure(";")
2850
+ terminal_parse_failure('";"')
2809
2851
  r3 = nil
2810
2852
  end
2811
2853
  s0 << r3
2812
2854
  if r3
2813
2855
  s4, i4 = [], index
2814
2856
  loop do
2815
- if has_terminal?('\G[^\\n\\r]', true, index)
2857
+ if has_terminal?(@regexps[gr = '\A[^\\n\\r]'] ||= Regexp.new(gr), :regexp, index)
2816
2858
  r5 = true
2817
2859
  @index += 1
2818
2860
  else
2861
+ terminal_parse_failure('[^\\n\\r]')
2819
2862
  r5 = nil
2820
2863
  end
2821
2864
  if r5
@@ -2860,7 +2903,7 @@ module DNS
2860
2903
  if node_cache[:ns].has_key?(index)
2861
2904
  cached = node_cache[:ns][index]
2862
2905
  if cached
2863
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2906
+ node_cache[:ns][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2864
2907
  @index = cached.interval.end
2865
2908
  end
2866
2909
  return cached
@@ -2910,7 +2953,7 @@ module DNS
2910
2953
  if node_cache[:rp].has_key?(index)
2911
2954
  cached = node_cache[:rp][index]
2912
2955
  if cached
2913
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2956
+ node_cache[:rp][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2914
2957
  @index = cached.interval.end
2915
2958
  end
2916
2959
  return cached
@@ -2922,23 +2965,26 @@ module DNS
2922
2965
  s2, i2 = [], index
2923
2966
  loop do
2924
2967
  i3 = index
2925
- if has_terminal?("\\.", false, index)
2926
- r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
2927
- @index += 2
2968
+ if (match_len = has_terminal?("\\.", false, index))
2969
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2970
+ @index += match_len
2928
2971
  else
2929
- terminal_parse_failure("\\.")
2972
+ terminal_parse_failure('"\\\\."')
2930
2973
  r4 = nil
2931
2974
  end
2932
2975
  if r4
2976
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
2933
2977
  r3 = r4
2934
2978
  else
2935
- if has_terminal?('\G[+a-zA-Z0-9\\-)]', true, index)
2979
+ if has_terminal?(@regexps[gr = '\A[+a-zA-Z0-9\\-)]'] ||= Regexp.new(gr), :regexp, index)
2936
2980
  r5 = true
2937
2981
  @index += 1
2938
2982
  else
2983
+ terminal_parse_failure('[+a-zA-Z0-9\\-)]')
2939
2984
  r5 = nil
2940
2985
  end
2941
2986
  if r5
2987
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
2942
2988
  r3 = r5
2943
2989
  else
2944
2990
  @index = i3
@@ -2959,11 +3005,11 @@ module DNS
2959
3005
  end
2960
3006
  s1 << r2
2961
3007
  if r2
2962
- if has_terminal?(".", false, index)
2963
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
2964
- @index += 1
3008
+ if (match_len = has_terminal?(".", false, index))
3009
+ r6 = true
3010
+ @index += match_len
2965
3011
  else
2966
- terminal_parse_failure(".")
3012
+ terminal_parse_failure('"."')
2967
3013
  r6 = nil
2968
3014
  end
2969
3015
  s1 << r6
@@ -3015,7 +3061,7 @@ module DNS
3015
3061
  if node_cache[:serial].has_key?(index)
3016
3062
  cached = node_cache[:serial][index]
3017
3063
  if cached
3018
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3064
+ node_cache[:serial][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3019
3065
  @index = cached.interval.end
3020
3066
  end
3021
3067
  return cached
@@ -3076,7 +3122,7 @@ module DNS
3076
3122
  if node_cache[:time_interval].has_key?(index)
3077
3123
  cached = node_cache[:time_interval][index]
3078
3124
  if cached
3079
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3125
+ node_cache[:time_interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3080
3126
  @index = cached.interval.end
3081
3127
  end
3082
3128
  return cached
@@ -3124,7 +3170,7 @@ module DNS
3124
3170
  if node_cache[:refresh].has_key?(index)
3125
3171
  cached = node_cache[:refresh][index]
3126
3172
  if cached
3127
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3173
+ node_cache[:refresh][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3128
3174
  @index = cached.interval.end
3129
3175
  end
3130
3176
  return cached
@@ -3174,7 +3220,7 @@ module DNS
3174
3220
  if node_cache[:integer].has_key?(index)
3175
3221
  cached = node_cache[:integer][index]
3176
3222
  if cached
3177
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3223
+ node_cache[:integer][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3178
3224
  @index = cached.interval.end
3179
3225
  end
3180
3226
  return cached
@@ -3182,10 +3228,11 @@ module DNS
3182
3228
 
3183
3229
  s0, i0 = [], index
3184
3230
  loop do
3185
- if has_terminal?('\G[0-9]', true, index)
3231
+ if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
3186
3232
  r1 = true
3187
3233
  @index += 1
3188
3234
  else
3235
+ terminal_parse_failure('[0-9]')
3189
3236
  r1 = nil
3190
3237
  end
3191
3238
  if r1
@@ -3228,131 +3275,142 @@ module DNS
3228
3275
  if node_cache[:time_multiplier].has_key?(index)
3229
3276
  cached = node_cache[:time_multiplier][index]
3230
3277
  if cached
3231
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3278
+ node_cache[:time_multiplier][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3232
3279
  @index = cached.interval.end
3233
3280
  end
3234
3281
  return cached
3235
3282
  end
3236
3283
 
3237
3284
  i0 = index
3238
- if has_terminal?('s', false, index)
3239
- r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
3240
- @index += 1
3285
+ if (match_len = has_terminal?('s', false, index))
3286
+ r1 = true
3287
+ @index += match_len
3241
3288
  else
3242
- terminal_parse_failure('s')
3289
+ terminal_parse_failure('\'s\'')
3243
3290
  r1 = nil
3244
3291
  end
3245
3292
  if r1
3293
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3246
3294
  r0 = r1
3247
3295
  r0.extend(TimeMultiplier0)
3248
3296
  else
3249
- if has_terminal?('S', false, index)
3250
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
3251
- @index += 1
3297
+ if (match_len = has_terminal?('S', false, index))
3298
+ r2 = true
3299
+ @index += match_len
3252
3300
  else
3253
- terminal_parse_failure('S')
3301
+ terminal_parse_failure('\'S\'')
3254
3302
  r2 = nil
3255
3303
  end
3256
3304
  if r2
3305
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3257
3306
  r0 = r2
3258
3307
  r0.extend(TimeMultiplier0)
3259
3308
  else
3260
- if has_terminal?('m', false, index)
3261
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
3262
- @index += 1
3309
+ if (match_len = has_terminal?('m', false, index))
3310
+ r3 = true
3311
+ @index += match_len
3263
3312
  else
3264
- terminal_parse_failure('m')
3313
+ terminal_parse_failure('\'m\'')
3265
3314
  r3 = nil
3266
3315
  end
3267
3316
  if r3
3317
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3268
3318
  r0 = r3
3269
3319
  r0.extend(TimeMultiplier0)
3270
3320
  else
3271
- if has_terminal?('M', false, index)
3272
- r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
3273
- @index += 1
3321
+ if (match_len = has_terminal?('M', false, index))
3322
+ r4 = true
3323
+ @index += match_len
3274
3324
  else
3275
- terminal_parse_failure('M')
3325
+ terminal_parse_failure('\'M\'')
3276
3326
  r4 = nil
3277
3327
  end
3278
3328
  if r4
3329
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3279
3330
  r0 = r4
3280
3331
  r0.extend(TimeMultiplier0)
3281
3332
  else
3282
- if has_terminal?('h', false, index)
3283
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
3284
- @index += 1
3333
+ if (match_len = has_terminal?('h', false, index))
3334
+ r5 = true
3335
+ @index += match_len
3285
3336
  else
3286
- terminal_parse_failure('h')
3337
+ terminal_parse_failure('\'h\'')
3287
3338
  r5 = nil
3288
3339
  end
3289
3340
  if r5
3341
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3290
3342
  r0 = r5
3291
3343
  r0.extend(TimeMultiplier0)
3292
3344
  else
3293
- if has_terminal?('H', false, index)
3294
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
3295
- @index += 1
3345
+ if (match_len = has_terminal?('H', false, index))
3346
+ r6 = true
3347
+ @index += match_len
3296
3348
  else
3297
- terminal_parse_failure('H')
3349
+ terminal_parse_failure('\'H\'')
3298
3350
  r6 = nil
3299
3351
  end
3300
3352
  if r6
3353
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
3301
3354
  r0 = r6
3302
3355
  r0.extend(TimeMultiplier0)
3303
3356
  else
3304
- if has_terminal?('d', false, index)
3305
- r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
3306
- @index += 1
3357
+ if (match_len = has_terminal?('d', false, index))
3358
+ r7 = true
3359
+ @index += match_len
3307
3360
  else
3308
- terminal_parse_failure('d')
3361
+ terminal_parse_failure('\'d\'')
3309
3362
  r7 = nil
3310
3363
  end
3311
3364
  if r7
3365
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
3312
3366
  r0 = r7
3313
3367
  r0.extend(TimeMultiplier0)
3314
3368
  else
3315
- if has_terminal?('D', false, index)
3316
- r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
3317
- @index += 1
3369
+ if (match_len = has_terminal?('D', false, index))
3370
+ r8 = true
3371
+ @index += match_len
3318
3372
  else
3319
- terminal_parse_failure('D')
3373
+ terminal_parse_failure('\'D\'')
3320
3374
  r8 = nil
3321
3375
  end
3322
3376
  if r8
3377
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
3323
3378
  r0 = r8
3324
3379
  r0.extend(TimeMultiplier0)
3325
3380
  else
3326
- if has_terminal?('w', false, index)
3327
- r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
3328
- @index += 1
3381
+ if (match_len = has_terminal?('w', false, index))
3382
+ r9 = true
3383
+ @index += match_len
3329
3384
  else
3330
- terminal_parse_failure('w')
3385
+ terminal_parse_failure('\'w\'')
3331
3386
  r9 = nil
3332
3387
  end
3333
3388
  if r9
3389
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
3334
3390
  r0 = r9
3335
3391
  r0.extend(TimeMultiplier0)
3336
3392
  else
3337
- if has_terminal?('W', false, index)
3338
- r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
3339
- @index += 1
3393
+ if (match_len = has_terminal?('W', false, index))
3394
+ r10 = true
3395
+ @index += match_len
3340
3396
  else
3341
- terminal_parse_failure('W')
3397
+ terminal_parse_failure('\'W\'')
3342
3398
  r10 = nil
3343
3399
  end
3344
3400
  if r10
3401
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
3345
3402
  r0 = r10
3346
3403
  r0.extend(TimeMultiplier0)
3347
3404
  else
3348
- if has_terminal?('', false, index)
3349
- r11 = instantiate_node(SyntaxNode,input, index...(index + 0))
3350
- @index += 0
3405
+ if (match_len = has_terminal?('', false, index))
3406
+ r11 = true
3407
+ @index += match_len
3351
3408
  else
3352
- terminal_parse_failure('')
3409
+ terminal_parse_failure('\'\'')
3353
3410
  r11 = nil
3354
3411
  end
3355
3412
  if r11
3413
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
3356
3414
  r0 = r11
3357
3415
  r0.extend(TimeMultiplier0)
3358
3416
  else
@@ -3396,7 +3454,7 @@ module DNS
3396
3454
  if node_cache[:reretry].has_key?(index)
3397
3455
  cached = node_cache[:reretry][index]
3398
3456
  if cached
3399
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3457
+ node_cache[:reretry][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3400
3458
  @index = cached.interval.end
3401
3459
  end
3402
3460
  return cached
@@ -3453,7 +3511,7 @@ module DNS
3453
3511
  if node_cache[:expiry].has_key?(index)
3454
3512
  cached = node_cache[:expiry][index]
3455
3513
  if cached
3456
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3514
+ node_cache[:expiry][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3457
3515
  @index = cached.interval.end
3458
3516
  end
3459
3517
  return cached
@@ -3510,7 +3568,7 @@ module DNS
3510
3568
  if node_cache[:nxttl].has_key?(index)
3511
3569
  cached = node_cache[:nxttl][index]
3512
3570
  if cached
3513
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3571
+ node_cache[:nxttl][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3514
3572
  @index = cached.interval.end
3515
3573
  end
3516
3574
  return cached
@@ -3570,7 +3628,7 @@ module DNS
3570
3628
  if node_cache[:ttl].has_key?(index)
3571
3629
  cached = node_cache[:ttl][index]
3572
3630
  if cached
3573
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3631
+ node_cache[:ttl][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3574
3632
  @index = cached.interval.end
3575
3633
  end
3576
3634
  return cached
@@ -3592,17 +3650,19 @@ module DNS
3592
3650
  r1 = nil
3593
3651
  end
3594
3652
  if r1
3653
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3595
3654
  r0 = r1
3596
3655
  r0.extend(Ttl1)
3597
3656
  else
3598
- if has_terminal?('', false, index)
3599
- r4 = instantiate_node(SyntaxNode,input, index...(index + 0))
3600
- @index += 0
3657
+ if (match_len = has_terminal?('', false, index))
3658
+ r4 = true
3659
+ @index += match_len
3601
3660
  else
3602
- terminal_parse_failure('')
3661
+ terminal_parse_failure('\'\'')
3603
3662
  r4 = nil
3604
3663
  end
3605
3664
  if r4
3665
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3606
3666
  r0 = r4
3607
3667
  r0.extend(Ttl1)
3608
3668
  else
@@ -3634,7 +3694,7 @@ module DNS
3634
3694
  if node_cache[:host].has_key?(index)
3635
3695
  cached = node_cache[:host][index]
3636
3696
  if cached
3637
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3697
+ node_cache[:host][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3638
3698
  @index = cached.interval.end
3639
3699
  end
3640
3700
  return cached
@@ -3643,10 +3703,11 @@ module DNS
3643
3703
  i0 = index
3644
3704
  s1, i1 = [], index
3645
3705
  loop do
3646
- if has_terminal?('\G[*a-zA-Z0-9\\-\\._]', true, index)
3706
+ if has_terminal?(@regexps[gr = '\A[*a-zA-Z0-9\\-\\._]'] ||= Regexp.new(gr), :regexp, index)
3647
3707
  r2 = true
3648
3708
  @index += 1
3649
3709
  else
3710
+ terminal_parse_failure('[*a-zA-Z0-9\\-\\._]')
3650
3711
  r2 = nil
3651
3712
  end
3652
3713
  if r2
@@ -3662,39 +3723,43 @@ module DNS
3662
3723
  r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
3663
3724
  end
3664
3725
  if r1
3726
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3665
3727
  r0 = r1
3666
3728
  r0.extend(Host0)
3667
3729
  else
3668
- if has_terminal?("@", false, index)
3669
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
3670
- @index += 1
3730
+ if (match_len = has_terminal?("@", false, index))
3731
+ r3 = true
3732
+ @index += match_len
3671
3733
  else
3672
- terminal_parse_failure("@")
3734
+ terminal_parse_failure('"@"')
3673
3735
  r3 = nil
3674
3736
  end
3675
3737
  if r3
3738
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3676
3739
  r0 = r3
3677
3740
  r0.extend(Host0)
3678
3741
  else
3679
- if has_terminal?(' ', false, index)
3680
- r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
3681
- @index += 1
3742
+ if (match_len = has_terminal?(' ', false, index))
3743
+ r4 = true
3744
+ @index += match_len
3682
3745
  else
3683
- terminal_parse_failure(' ')
3746
+ terminal_parse_failure('\' \'')
3684
3747
  r4 = nil
3685
3748
  end
3686
3749
  if r4
3750
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3687
3751
  r0 = r4
3688
3752
  r0.extend(Host0)
3689
3753
  else
3690
- if has_terminal?("\t", false, index)
3691
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
3692
- @index += 1
3754
+ if (match_len = has_terminal?("\t", false, index))
3755
+ r5 = true
3756
+ @index += match_len
3693
3757
  else
3694
- terminal_parse_failure("\t")
3758
+ terminal_parse_failure('"\\t"')
3695
3759
  r5 = nil
3696
3760
  end
3697
3761
  if r5
3762
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3698
3763
  r0 = r5
3699
3764
  r0.extend(Host0)
3700
3765
  else
@@ -3721,7 +3786,7 @@ module DNS
3721
3786
  if node_cache[:data].has_key?(index)
3722
3787
  cached = node_cache[:data][index]
3723
3788
  if cached
3724
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3789
+ node_cache[:data][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3725
3790
  @index = cached.interval.end
3726
3791
  end
3727
3792
  return cached
@@ -3729,10 +3794,11 @@ module DNS
3729
3794
 
3730
3795
  s0, i0 = [], index
3731
3796
  loop do
3732
- if has_terminal?('\G[^;\\n\\r]', true, index)
3797
+ if has_terminal?(@regexps[gr = '\A[^;\\n\\r]'] ||= Regexp.new(gr), :regexp, index)
3733
3798
  r1 = true
3734
3799
  @index += 1
3735
3800
  else
3801
+ terminal_parse_failure('[^;\\n\\r]')
3736
3802
  r1 = nil
3737
3803
  end
3738
3804
  if r1
@@ -3755,22 +3821,23 @@ module DNS
3755
3821
  end
3756
3822
 
3757
3823
  module TxtData0
3758
- end
3759
-
3760
- module TxtData1
3761
- end
3762
-
3763
- module TxtData2
3764
3824
  def space
3765
3825
  elements[0]
3766
3826
  end
3767
3827
 
3828
+ def txt_data
3829
+ elements[1]
3830
+ end
3768
3831
  end
3769
3832
 
3770
- module TxtData3
3833
+ module TxtData1
3834
+ def txt_string
3835
+ elements[0]
3836
+ end
3837
+
3771
3838
  end
3772
3839
 
3773
- module TxtData4
3840
+ module TxtData2
3774
3841
  def to_s
3775
3842
  text_value
3776
3843
  end
@@ -3781,217 +3848,227 @@ module DNS
3781
3848
  if node_cache[:txt_data].has_key?(index)
3782
3849
  cached = node_cache[:txt_data][index]
3783
3850
  if cached
3784
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3851
+ node_cache[:txt_data][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3785
3852
  @index = cached.interval.end
3786
3853
  end
3787
3854
  return cached
3788
3855
  end
3789
3856
 
3790
3857
  i0, s0 = index, []
3791
- if has_terminal?('"', false, index)
3792
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
3793
- @index += 1
3858
+ r1 = _nt_txt_string
3859
+ s0 << r1
3860
+ if r1
3861
+ s2, i2 = [], index
3862
+ loop do
3863
+ i3, s3 = index, []
3864
+ r4 = _nt_space
3865
+ s3 << r4
3866
+ if r4
3867
+ r5 = _nt_txt_data
3868
+ s3 << r5
3869
+ end
3870
+ if s3.last
3871
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
3872
+ r3.extend(TxtData0)
3873
+ else
3874
+ @index = i3
3875
+ r3 = nil
3876
+ end
3877
+ if r3
3878
+ s2 << r3
3879
+ else
3880
+ break
3881
+ end
3882
+ end
3883
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
3884
+ s0 << r2
3885
+ end
3886
+ if s0.last
3887
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3888
+ r0.extend(TxtData1)
3889
+ r0.extend(TxtData2)
3794
3890
  else
3795
- terminal_parse_failure('"')
3796
- r2 = nil
3891
+ @index = i0
3892
+ r0 = nil
3797
3893
  end
3798
- if r2
3799
- r1 = r2
3894
+
3895
+ node_cache[:txt_data][start_index] = r0
3896
+
3897
+ r0
3898
+ end
3899
+
3900
+ module TxtString0
3901
+ def to_s
3902
+ text_value
3903
+ end
3904
+ end
3905
+
3906
+ def _nt_txt_string
3907
+ start_index = index
3908
+ if node_cache[:txt_string].has_key?(index)
3909
+ cached = node_cache[:txt_string][index]
3910
+ if cached
3911
+ node_cache[:txt_string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3912
+ @index = cached.interval.end
3913
+ end
3914
+ return cached
3915
+ end
3916
+
3917
+ i0 = index
3918
+ r1 = _nt_quoted_string
3919
+ if r1
3920
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3921
+ r0 = r1
3922
+ r0.extend(TxtString0)
3800
3923
  else
3801
- r1 = instantiate_node(SyntaxNode,input, index...index)
3924
+ r2 = _nt_unquoted_string
3925
+ if r2
3926
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3927
+ r0 = r2
3928
+ r0.extend(TxtString0)
3929
+ else
3930
+ @index = i0
3931
+ r0 = nil
3932
+ end
3933
+ end
3934
+
3935
+ node_cache[:txt_string][start_index] = r0
3936
+
3937
+ r0
3938
+ end
3939
+
3940
+ module QuotedString0
3941
+ end
3942
+
3943
+ module QuotedString1
3944
+ def to_s
3945
+ text_value
3946
+ end
3947
+ end
3948
+
3949
+ def _nt_quoted_string
3950
+ start_index = index
3951
+ if node_cache[:quoted_string].has_key?(index)
3952
+ cached = node_cache[:quoted_string][index]
3953
+ if cached
3954
+ node_cache[:quoted_string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3955
+ @index = cached.interval.end
3956
+ end
3957
+ return cached
3958
+ end
3959
+
3960
+ i0, s0 = index, []
3961
+ if (match_len = has_terminal?('"', false, index))
3962
+ r1 = true
3963
+ @index += match_len
3964
+ else
3965
+ terminal_parse_failure('\'"\'')
3966
+ r1 = nil
3802
3967
  end
3803
3968
  s0 << r1
3804
3969
  if r1
3805
- s3, i3 = [], index
3970
+ s2, i2 = [], index
3806
3971
  loop do
3807
- i4 = index
3808
- if has_terminal?('\\"', false, index)
3809
- r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
3810
- @index += 2
3972
+ i3 = index
3973
+ if (match_len = has_terminal?('\"', false, index))
3974
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3975
+ @index += match_len
3811
3976
  else
3812
- terminal_parse_failure('\\"')
3813
- r5 = nil
3977
+ terminal_parse_failure('\'\\"\'')
3978
+ r4 = nil
3814
3979
  end
3815
- if r5
3816
- r4 = r5
3980
+ if r4
3981
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3982
+ r3 = r4
3817
3983
  else
3818
- i6, s6 = index, []
3819
- i7 = index
3820
- if has_terminal?('"', false, index)
3821
- r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
3984
+ if has_terminal?(@regexps[gr = '\A[^"]'] ||= Regexp.new(gr), :regexp, index)
3985
+ r5 = true
3822
3986
  @index += 1
3823
3987
  else
3824
- terminal_parse_failure('"')
3825
- r8 = nil
3826
- end
3827
- if r8
3828
- r7 = nil
3829
- else
3830
- @index = i7
3831
- r7 = instantiate_node(SyntaxNode,input, index...index)
3832
- end
3833
- s6 << r7
3834
- if r7
3835
- if has_terminal?('\G[^\\n\\r]', true, index)
3836
- r9 = true
3837
- @index += 1
3838
- else
3839
- r9 = nil
3840
- end
3841
- s6 << r9
3842
- end
3843
- if s6.last
3844
- r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
3845
- r6.extend(TxtData0)
3846
- else
3847
- @index = i6
3848
- r6 = nil
3988
+ terminal_parse_failure('[^"]')
3989
+ r5 = nil
3849
3990
  end
3850
- if r6
3851
- r4 = r6
3991
+ if r5
3992
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3993
+ r3 = r5
3852
3994
  else
3853
- @index = i4
3854
- r4 = nil
3995
+ @index = i3
3996
+ r3 = nil
3855
3997
  end
3856
3998
  end
3857
- if r4
3858
- s3 << r4
3999
+ if r3
4000
+ s2 << r3
3859
4001
  else
3860
4002
  break
3861
4003
  end
3862
4004
  end
3863
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
3864
- s0 << r3
3865
- if r3
3866
- if has_terminal?('"', false, index)
3867
- r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
3868
- @index += 1
3869
- else
3870
- terminal_parse_failure('"')
3871
- r11 = nil
3872
- end
3873
- if r11
3874
- r10 = r11
4005
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
4006
+ s0 << r2
4007
+ if r2
4008
+ if (match_len = has_terminal?('"', false, index))
4009
+ r6 = true
4010
+ @index += match_len
3875
4011
  else
3876
- r10 = instantiate_node(SyntaxNode,input, index...index)
3877
- end
3878
- s0 << r10
3879
- if r10
3880
- s12, i12 = [], index
3881
- loop do
3882
- i13, s13 = index, []
3883
- r14 = _nt_space
3884
- s13 << r14
3885
- if r14
3886
- if has_terminal?('"', false, index)
3887
- r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
3888
- @index += 1
3889
- else
3890
- terminal_parse_failure('"')
3891
- r15 = nil
3892
- end
3893
- s13 << r15
3894
- if r15
3895
- s16, i16 = [], index
3896
- loop do
3897
- i17 = index
3898
- if has_terminal?('\\"', false, index)
3899
- r18 = instantiate_node(SyntaxNode,input, index...(index + 2))
3900
- @index += 2
3901
- else
3902
- terminal_parse_failure('\\"')
3903
- r18 = nil
3904
- end
3905
- if r18
3906
- r17 = r18
3907
- else
3908
- i19, s19 = index, []
3909
- i20 = index
3910
- if has_terminal?('"', false, index)
3911
- r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
3912
- @index += 1
3913
- else
3914
- terminal_parse_failure('"')
3915
- r21 = nil
3916
- end
3917
- if r21
3918
- r20 = nil
3919
- else
3920
- @index = i20
3921
- r20 = instantiate_node(SyntaxNode,input, index...index)
3922
- end
3923
- s19 << r20
3924
- if r20
3925
- if has_terminal?('\G[^\\n\\r]', true, index)
3926
- r22 = true
3927
- @index += 1
3928
- else
3929
- r22 = nil
3930
- end
3931
- s19 << r22
3932
- end
3933
- if s19.last
3934
- r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
3935
- r19.extend(TxtData1)
3936
- else
3937
- @index = i19
3938
- r19 = nil
3939
- end
3940
- if r19
3941
- r17 = r19
3942
- else
3943
- @index = i17
3944
- r17 = nil
3945
- end
3946
- end
3947
- if r17
3948
- s16 << r17
3949
- else
3950
- break
3951
- end
3952
- end
3953
- r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
3954
- s13 << r16
3955
- if r16
3956
- if has_terminal?('"', false, index)
3957
- r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
3958
- @index += 1
3959
- else
3960
- terminal_parse_failure('"')
3961
- r23 = nil
3962
- end
3963
- s13 << r23
3964
- end
3965
- end
3966
- end
3967
- if s13.last
3968
- r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
3969
- r13.extend(TxtData2)
3970
- else
3971
- @index = i13
3972
- r13 = nil
3973
- end
3974
- if r13
3975
- s12 << r13
3976
- else
3977
- break
3978
- end
3979
- end
3980
- r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
3981
- s0 << r12
4012
+ terminal_parse_failure('\'"\'')
4013
+ r6 = nil
3982
4014
  end
4015
+ s0 << r6
3983
4016
  end
3984
4017
  end
3985
4018
  if s0.last
3986
4019
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3987
- r0.extend(TxtData3)
3988
- r0.extend(TxtData4)
4020
+ r0.extend(QuotedString0)
3989
4021
  else
3990
4022
  @index = i0
3991
4023
  r0 = nil
3992
4024
  end
3993
4025
 
3994
- node_cache[:txt_data][start_index] = r0
4026
+ node_cache[:quoted_string][start_index] = r0
4027
+
4028
+ r0
4029
+ end
4030
+
4031
+ module UnquotedString0
4032
+ def to_s
4033
+ text_value
4034
+ end
4035
+ end
4036
+
4037
+ def _nt_unquoted_string
4038
+ start_index = index
4039
+ if node_cache[:unquoted_string].has_key?(index)
4040
+ cached = node_cache[:unquoted_string][index]
4041
+ if cached
4042
+ node_cache[:unquoted_string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4043
+ @index = cached.interval.end
4044
+ end
4045
+ return cached
4046
+ end
4047
+
4048
+ s0, i0 = [], index
4049
+ loop do
4050
+ if has_terminal?(@regexps[gr = '\A[a-zA-Z0-9]'] ||= Regexp.new(gr), :regexp, index)
4051
+ r1 = true
4052
+ @index += 1
4053
+ else
4054
+ terminal_parse_failure('[a-zA-Z0-9]')
4055
+ r1 = nil
4056
+ end
4057
+ if r1
4058
+ s0 << r1
4059
+ else
4060
+ break
4061
+ end
4062
+ end
4063
+ if s0.empty?
4064
+ @index = i0
4065
+ r0 = nil
4066
+ else
4067
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
4068
+ r0.extend(UnquotedString0)
4069
+ end
4070
+
4071
+ node_cache[:unquoted_string][start_index] = r0
3995
4072
 
3996
4073
  r0
3997
4074
  end