Module: Asciidoctor::PDF::FormattedText::Markup

Includes:
Treetop::Runtime
Included in:
MarkupParser
Defined in:
lib/asciidoctor/pdf/formatted_text/parser.rb

Defined Under Namespace

Modules: Attribute0, Attribute1, Attributes0, Cdata0, Charref0, Charref1, Charref2, Charref3, Complex0, Element0, Element1, EndTag0, EndTag1, StartTag0, StartTag1, VoidElement0, VoidElement1, VoidElement2

Instance Method Summary collapse

Instance Method Details

#_nt_attributeObject



608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 608

def _nt_attribute
  start_index = index
  if node_cache[:attribute].has_key?(index)
    cached = node_cache[:attribute][index]
    if cached
      node_cache[:attribute][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  r1 = _nt_spaces
  s0 << r1
  if r1
    s2, i2 = [], index
    loop do
      if has_terminal?(@regexps[gr = '\A[a-z_]'] ||= Regexp.new(gr), :regexp, index)
        r3 = true
        @index += 1
      else
        terminal_parse_failure('[a-z_]')
        r3 = nil
      end
      if r3
        s2 << r3
      else
        break
      end
    end
    if s2.empty?
      @index = i2
      r2 = nil
    else
      r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    end
    s0 << r2
    if r2
      if (match_len = has_terminal?('=', false, index))
        r4 = true
        @index += match_len
      else
        terminal_parse_failure('\'=\'')
        r4 = nil
      end
      s0 << r4
      if r4
        if (match_len = has_terminal?('"', false, index))
          r5 = true
          @index += match_len
        else
          terminal_parse_failure('\'"\'')
          r5 = nil
        end
        s0 << r5
        if r5
          s6, i6 = [], index
          loop do
            if has_terminal?(@regexps[gr = '\A[^"]'] ||= Regexp.new(gr), :regexp, index)
              r7 = true
              @index += 1
            else
              terminal_parse_failure('[^"]')
              r7 = nil
            end
            if r7
              s6 << r7
            else
              break
            end
          end
          r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
          s0 << r6
          if r6
            if (match_len = has_terminal?('"', false, index))
              r8 = true
              @index += match_len
            else
              terminal_parse_failure('\'"\'')
              r8 = nil
            end
            s0 << r8
          end
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(Attribute0)
    r0.extend(Attribute1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:attribute][start_index] = r0

  r0
end

#_nt_attributesObject



567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 567

def _nt_attributes
  start_index = index
  if node_cache[:attributes].has_key?(index)
    cached = node_cache[:attributes][index]
    if cached
      node_cache[:attributes][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  s0, i0 = [], index
  loop do
    r1 = _nt_attribute
    if r1
      s0 << r1
    else
      break
    end
  end
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
  r0.extend(Attributes0)

  node_cache[:attributes][start_index] = r0

  r0
end

#_nt_cdataObject



776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 776

def _nt_cdata
  start_index = index
  if node_cache[:cdata].has_key?(index)
    cached = node_cache[:cdata][index]
    if cached
      node_cache[:cdata][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  s0, i0 = [], index
  loop do
    if has_terminal?(@regexps[gr = '\A[^<&]'] ||= Regexp.new(gr), :regexp, index)
      r1 = true
      @index += 1
    else
      terminal_parse_failure('[^<&]')
      r1 = nil
    end
    if r1
      s0 << r1
    else
      break
    end
  end
  if s0.empty?
    @index = i0
    r0 = nil
  else
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(Cdata0)
  end

  node_cache[:cdata][start_index] = r0

  r0
end

#_nt_character_decimalObject



948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 948

def _nt_character_decimal
  start_index = index
  if node_cache[:character_decimal].has_key?(index)
    cached = node_cache[:character_decimal][index]
    if cached
      node_cache[:character_decimal][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  s0, i0 = [], index
  loop do
    if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
      r1 = true
      @index += 1
    else
      terminal_parse_failure('[0-9]')
      r1 = nil
    end
    if r1
      s0 << r1
    else
      break
    end
    if s0.size == 6
      break
    end
  end
  if s0.size < 2
    @index = i0
    r0 = nil
  else
    if s0.size < 6
      @terminal_failures.pop
    end
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
  end

  node_cache[:character_decimal][start_index] = r0

  r0
end

#_nt_character_hexObject



992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 992

def _nt_character_hex
  start_index = index
  if node_cache[:character_hex].has_key?(index)
    cached = node_cache[:character_hex][index]
    if cached
      node_cache[:character_hex][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  s0, i0 = [], index
  loop do
    if has_terminal?(@regexps[gr = '\A[0-9a-fA-F]'] ||= Regexp.new(gr), :regexp, index)
      r1 = true
      @index += 1
    else
      terminal_parse_failure('[0-9a-fA-F]')
      r1 = nil
    end
    if r1
      s0 << r1
    else
      break
    end
    if s0.size == 5
      break
    end
  end
  if s0.size < 2
    @index = i0
    r0 = nil
  else
    if s0.size < 5
      @terminal_failures.pop
    end
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
  end

  node_cache[:character_hex][start_index] = r0

  r0
end

#_nt_character_nameObject



1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 1036

def _nt_character_name
  start_index = index
  if node_cache[:character_name].has_key?(index)
    cached = node_cache[:character_name][index]
    if cached
      node_cache[:character_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0 = index
  if (match_len = has_terminal?('amp', false, index))
    r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
    @index += match_len
  else
    terminal_parse_failure('\'amp\'')
    r1 = nil
  end
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
  else
    if (match_len = has_terminal?('apos', false, index))
      r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
      @index += match_len
    else
      terminal_parse_failure('\'apos\'')
      r2 = nil
    end
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
    else
      if (match_len = has_terminal?('gt', false, index))
        r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
        @index += match_len
      else
        terminal_parse_failure('\'gt\'')
        r3 = nil
      end
      if r3
        r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
        r0 = r3
      else
        if (match_len = has_terminal?('lt', false, index))
          r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
          @index += match_len
        else
          terminal_parse_failure('\'lt\'')
          r4 = nil
        end
        if r4
          r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
          r0 = r4
        else
          if (match_len = has_terminal?('nbsp', false, index))
            r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
            @index += match_len
          else
            terminal_parse_failure('\'nbsp\'')
            r5 = nil
          end
          if r5
            r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
            r0 = r5
          else
            if (match_len = has_terminal?('quot', false, index))
              r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
              @index += match_len
            else
              terminal_parse_failure('\'quot\'')
              r6 = nil
            end
            if r6
              r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
              r0 = r6
            else
              @index = i0
              r0 = nil
            end
          end
        end
      end
    end
  end

  node_cache[:character_name][start_index] = r0

  r0
end

#_nt_charrefObject



842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 842

def _nt_charref
  start_index = index
  if node_cache[:charref].has_key?(index)
    cached = node_cache[:charref][index]
    if cached
      node_cache[:charref][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  if (match_len = has_terminal?('&', false, index))
    r1 = true
    @index += match_len
  else
    terminal_parse_failure('\'&\'')
    r1 = nil
  end
  s0 << r1
  if r1
    i2 = index
    i3, s3 = index, []
    if (match_len = has_terminal?('#', false, index))
      r4 = true
      @index += match_len
    else
      terminal_parse_failure('\'#\'')
      r4 = nil
    end
    s3 << r4
    if r4
      r5 = _nt_character_decimal
      s3 << r5
    end
    if s3.last
      r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
      r3.extend(Charref0)
    else
      @index = i3
      r3 = nil
    end
    if r3
      r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
      r2 = r3
    else
      i6, s6 = index, []
      if (match_len = has_terminal?('#x', false, index))
        r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
        @index += match_len
      else
        terminal_parse_failure('\'#x\'')
        r7 = nil
      end
      s6 << r7
      if r7
        r8 = _nt_character_hex
        s6 << r8
      end
      if s6.last
        r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
        r6.extend(Charref1)
      else
        @index = i6
        r6 = nil
      end
      if r6
        r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
        r2 = r6
      else
        r9 = _nt_character_name
        if r9
          r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
          r2 = r9
        else
          @index = i2
          r2 = nil
        end
      end
    end
    s0 << r2
    if r2
      if (match_len = has_terminal?(';', false, index))
        r10 = true
        @index += match_len
      else
        terminal_parse_failure('\';\'')
        r10 = nil
      end
      s0 << r10
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(Charref2)
    r0.extend(Charref3)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:charref][start_index] = r0

  r0
end

#_nt_complexObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 39

def _nt_complex
  start_index = index
  if node_cache[:complex].has_key?(index)
    cached = node_cache[:complex][index]
    if cached
      node_cache[:complex][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  s0, i0 = [], index
  loop do
    i1 = index
    r2 = _nt_cdata
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r1 = r2
    else
      r3 = _nt_element
      if r3
        r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
        r1 = r3
      else
        r4 = _nt_charref
        if r4
          r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
          r1 = r4
        else
          @index = i1
          r1 = nil
        end
      end
    end
    if r1
      s0 << r1
    else
      break
    end
  end
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
  r0.extend(Complex0)

  node_cache[:complex][start_index] = r0

  r0
end

#_nt_elementObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 108

def _nt_element
  start_index = index
  if node_cache[:element].has_key?(index)
    cached = node_cache[:element][index]
    if cached
      node_cache[:element][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0 = index
  r1 = _nt_void_element
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
  else
    i2, s2 = index, []
    r3 = _nt_start_tag
    s2 << r3
    if r3
      r4 = _nt_complex
      s2 << r4
      if r4
        r5 = _nt_end_tag
        s2 << r5
      end
    end
    if s2.last
      r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
      r2.extend(Element0)
      r2.extend(Element1)
    else
      @index = i2
      r2 = nil
    end
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
    else
      @index = i0
      r0 = nil
    end
  end

  node_cache[:element][start_index] = r0

  r0
end

#_nt_end_tagObject



722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 722

def _nt_end_tag
  start_index = index
  if node_cache[:end_tag].has_key?(index)
    cached = node_cache[:end_tag][index]
    if cached
      node_cache[:end_tag][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  if (match_len = has_terminal?('</', false, index))
    r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
    @index += match_len
  else
    terminal_parse_failure('\'</\'')
    r1 = nil
  end
  s0 << r1
  if r1
    r2 = _nt_tag_name
    s0 << r2
    if r2
      if (match_len = has_terminal?('>', false, index))
        r3 = true
        @index += match_len
      else
        terminal_parse_failure('\'>\'')
        r3 = nil
      end
      s0 << r3
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(EndTag0)
    r0.extend(EndTag1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:end_tag][start_index] = r0

  r0
end

#_nt_spacesObject



1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 1128

def _nt_spaces
  start_index = index
  if node_cache[:spaces].has_key?(index)
    cached = node_cache[:spaces][index]
    if cached
      node_cache[:spaces][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  s0, i0 = [], index
  loop do
    if (match_len = has_terminal?(' ', false, index))
      r1 = true
      @index += match_len
    else
      terminal_parse_failure('\' \'')
      r1 = nil
    end
    if r1
      s0 << r1
    else
      break
    end
  end
  if s0.empty?
    @index = i0
    r0 = nil
  else
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
  end

  node_cache[:spaces][start_index] = r0

  r0
end

#_nt_start_tagObject



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 284

def _nt_start_tag
  start_index = index
  if node_cache[:start_tag].has_key?(index)
    cached = node_cache[:start_tag][index]
    if cached
      node_cache[:start_tag][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  if (match_len = has_terminal?('<', false, index))
    r1 = true
    @index += match_len
  else
    terminal_parse_failure('\'<\'')
    r1 = nil
  end
  s0 << r1
  if r1
    r2 = _nt_tag_name
    s0 << r2
    if r2
      r3 = _nt_attributes
      s0 << r3
      if r3
        if (match_len = has_terminal?('>', false, index))
          r4 = true
          @index += match_len
        else
          terminal_parse_failure('\'>\'')
          r4 = nil
        end
        s0 << r4
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(StartTag0)
    r0.extend(StartTag1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:start_tag][start_index] = r0

  r0
end

#_nt_tag_nameObject



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 336

def _nt_tag_name
  start_index = index
  if node_cache[:tag_name].has_key?(index)
    cached = node_cache[:tag_name][index]
    if cached
      node_cache[:tag_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0 = index
  if (match_len = has_terminal?('a', false, index))
    r1 = true
    @index += match_len
  else
    terminal_parse_failure('\'a\'')
    r1 = nil
  end
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
  else
    if (match_len = has_terminal?('strong', false, index))
      r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
      @index += match_len
    else
      terminal_parse_failure('\'strong\'')
      r2 = nil
    end
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
    else
      if (match_len = has_terminal?('em', false, index))
        r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
        @index += match_len
      else
        terminal_parse_failure('\'em\'')
        r3 = nil
      end
      if r3
        r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
        r0 = r3
      else
        if (match_len = has_terminal?('code', false, index))
          r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
          @index += match_len
        else
          terminal_parse_failure('\'code\'')
          r4 = nil
        end
        if r4
          r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
          r0 = r4
        else
          if (match_len = has_terminal?('font', false, index))
            r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
            @index += match_len
          else
            terminal_parse_failure('\'font\'')
            r5 = nil
          end
          if r5
            r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
            r0 = r5
          else
            if (match_len = has_terminal?('span', false, index))
              r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
              @index += match_len
            else
              terminal_parse_failure('\'span\'')
              r6 = nil
            end
            if r6
              r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
              r0 = r6
            else
              if (match_len = has_terminal?('button', false, index))
                r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                @index += match_len
              else
                terminal_parse_failure('\'button\'')
                r7 = nil
              end
              if r7
                r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
                r0 = r7
              else
                if (match_len = has_terminal?('kbd', false, index))
                  r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                  @index += match_len
                else
                  terminal_parse_failure('\'kbd\'')
                  r8 = nil
                end
                if r8
                  r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
                  r0 = r8
                else
                  if (match_len = has_terminal?('sup', false, index))
                    r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                    @index += match_len
                  else
                    terminal_parse_failure('\'sup\'')
                    r9 = nil
                  end
                  if r9
                    r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
                    r0 = r9
                  else
                    if (match_len = has_terminal?('sub', false, index))
                      r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                      @index += match_len
                    else
                      terminal_parse_failure('\'sub\'')
                      r10 = nil
                    end
                    if r10
                      r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
                      r0 = r10
                    else
                      if (match_len = has_terminal?('mark', false, index))
                        r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                        @index += match_len
                      else
                        terminal_parse_failure('\'mark\'')
                        r11 = nil
                      end
                      if r11
                        r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
                        r0 = r11
                      else
                        if (match_len = has_terminal?('menu', false, index))
                          r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                          @index += match_len
                        else
                          terminal_parse_failure('\'menu\'')
                          r12 = nil
                        end
                        if r12
                          r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
                          r0 = r12
                        else
                          if (match_len = has_terminal?('del', false, index))
                            r13 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                            @index += match_len
                          else
                            terminal_parse_failure('\'del\'')
                            r13 = nil
                          end
                          if r13
                            r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
                            r0 = r13
                          else
                            @index = i0
                            r0 = nil
                          end
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  end

  node_cache[:tag_name][start_index] = r0

  r0
end

#_nt_textObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 15

def _nt_text
  start_index = index
  if node_cache[:text].has_key?(index)
    cached = node_cache[:text][index]
    if cached
      node_cache[:text][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  r0 = _nt_complex

  node_cache[:text][start_index] = r0

  r0
end

#_nt_void_elementObject



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 178

def _nt_void_element
  start_index = index
  if node_cache[:void_element].has_key?(index)
    cached = node_cache[:void_element][index]
    if cached
      node_cache[:void_element][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  if (match_len = has_terminal?('<', false, index))
    r1 = true
    @index += match_len
  else
    terminal_parse_failure('\'<\'')
    r1 = nil
  end
  s0 << r1
  if r1
    r2 = _nt_void_tag_name
    s0 << r2
    if r2
      r3 = _nt_attributes
      s0 << r3
      if r3
        i5, s5 = index, []
        r7 = _nt_spaces
        if r7
          r6 = r7
        else
          r6 = instantiate_node(SyntaxNode,input, index...index)
        end
        s5 << r6
        if r6
          if (match_len = has_terminal?('/', false, index))
            r8 = true
            @index += match_len
          else
            terminal_parse_failure('\'/\'')
            r8 = nil
          end
          s5 << r8
        end
        if s5.last
          r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
          r5.extend(VoidElement0)
        else
          @index = i5
          r5 = nil
        end
        if r5
          r4 = r5
        else
          r4 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r4
        if r4
          if (match_len = has_terminal?('>', false, index))
            r9 = true
            @index += match_len
          else
            terminal_parse_failure('\'>\'')
            r9 = nil
          end
          s0 << r9
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(VoidElement1)
    r0.extend(VoidElement2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:void_element][start_index] = r0

  r0
end

#_nt_void_tag_nameObject



512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 512

def _nt_void_tag_name
  start_index = index
  if node_cache[:void_tag_name].has_key?(index)
    cached = node_cache[:void_tag_name][index]
    if cached
      node_cache[:void_tag_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0 = index
  if (match_len = has_terminal?('br', false, index))
    r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
    @index += match_len
  else
    terminal_parse_failure('\'br\'')
    r1 = nil
  end
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
  else
    if (match_len = has_terminal?('img', false, index))
      r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
      @index += match_len
    else
      terminal_parse_failure('\'img\'')
      r2 = nil
    end
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
    else
      @index = i0
      r0 = nil
    end
  end

  node_cache[:void_tag_name][start_index] = r0

  r0
end

#rootObject



11
12
13
# File 'lib/asciidoctor/pdf/formatted_text/parser.rb', line 11

def root
  @root ||= :text
end