treetop 1.6.12 → 1.6.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +1 -1
 - data/lib/treetop/compiler/metagrammar.rb +228 -6
 - data/lib/treetop/compiler/metagrammar.treetop +16 -1
 - data/lib/treetop/compiler/node_classes/grammar.rb +9 -7
 - data/lib/treetop/version.rb +1 -1
 - data/treetop.gemspec +3 -3
 - metadata +7 -10
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3f4ebab3912da21994eae994e3e9e74a078e05ad3fac1b5ffbba33403061d86a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 51d7876c22c2edd8dac928cb482cf69383f3150df78bf04ab03b74009e597e3e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: bc3abfe32ebd44518902c94d785886410ff2e53b45fbd4d1f420a7cfcc5bb513dc16fcd6b3e6e55708311e885967f897d32df8457714a707ec773ccefa28afd8
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d009ad35387f28a9d8465562ccbf02498b7cf8743e5dcdc04ad160b48f8ab49a94fe1b6c91a81e85074a25409914fa6832992eff23e0bce2335c093f815bdf3c
         
     | 
    
        data/README.md
    CHANGED
    
    
| 
         @@ -799,13 +799,19 @@ module Treetop 
     | 
|
| 
       799 
799 
     | 
    
         
             
                      r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
         
     | 
| 
       800 
800 
     | 
    
         
             
                      r0 = r1
         
     | 
| 
       801 
801 
     | 
    
         
             
                    else
         
     | 
| 
       802 
     | 
    
         
            -
                      r2 =  
     | 
| 
      
 802 
     | 
    
         
            +
                      r2 = _nt_parsing_endless_rule
         
     | 
| 
       803 
803 
     | 
    
         
             
                      if r2
         
     | 
| 
       804 
804 
     | 
    
         
             
                        r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
         
     | 
| 
       805 
805 
     | 
    
         
             
                        r0 = r2
         
     | 
| 
       806 
806 
     | 
    
         
             
                      else
         
     | 
| 
       807 
     | 
    
         
            -
                         
     | 
| 
       808 
     | 
    
         
            -
                         
     | 
| 
      
 807 
     | 
    
         
            +
                        r3 = _nt_include_declaration
         
     | 
| 
      
 808 
     | 
    
         
            +
                        if r3
         
     | 
| 
      
 809 
     | 
    
         
            +
                          r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
         
     | 
| 
      
 810 
     | 
    
         
            +
                          r0 = r3
         
     | 
| 
      
 811 
     | 
    
         
            +
                        else
         
     | 
| 
      
 812 
     | 
    
         
            +
                          @index = i0
         
     | 
| 
      
 813 
     | 
    
         
            +
                          r0 = nil
         
     | 
| 
      
 814 
     | 
    
         
            +
                        end
         
     | 
| 
       809 
815 
     | 
    
         
             
                      end
         
     | 
| 
       810 
816 
     | 
    
         
             
                    end
         
     | 
| 
       811 
817 
     | 
    
         | 
| 
         @@ -1028,6 +1034,172 @@ module Treetop 
     | 
|
| 
       1028 
1034 
     | 
    
         
             
                    r0
         
     | 
| 
       1029 
1035 
     | 
    
         
             
                  end
         
     | 
| 
       1030 
1036 
     | 
    
         | 
| 
      
 1037 
     | 
    
         
            +
                  module ParsingEndlessRule0
         
     | 
| 
      
 1038 
     | 
    
         
            +
                    def nonterminal
         
     | 
| 
      
 1039 
     | 
    
         
            +
                      elements[2]
         
     | 
| 
      
 1040 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1041 
     | 
    
         
            +
             
     | 
| 
      
 1042 
     | 
    
         
            +
                    def parsing_expression
         
     | 
| 
      
 1043 
     | 
    
         
            +
                      elements[6]
         
     | 
| 
      
 1044 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1045 
     | 
    
         
            +
             
     | 
| 
      
 1046 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1047 
     | 
    
         
            +
             
     | 
| 
      
 1048 
     | 
    
         
            +
                  def _nt_parsing_endless_rule
         
     | 
| 
      
 1049 
     | 
    
         
            +
                    start_index = index
         
     | 
| 
      
 1050 
     | 
    
         
            +
                    if node_cache[:parsing_endless_rule].has_key?(index)
         
     | 
| 
      
 1051 
     | 
    
         
            +
                      cached = node_cache[:parsing_endless_rule][index]
         
     | 
| 
      
 1052 
     | 
    
         
            +
                      if cached
         
     | 
| 
      
 1053 
     | 
    
         
            +
                        node_cache[:parsing_endless_rule][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
         
     | 
| 
      
 1054 
     | 
    
         
            +
                        @index = cached.interval.end
         
     | 
| 
      
 1055 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1056 
     | 
    
         
            +
                      return cached
         
     | 
| 
      
 1057 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1058 
     | 
    
         
            +
             
     | 
| 
      
 1059 
     | 
    
         
            +
                    i0, s0 = index, []
         
     | 
| 
      
 1060 
     | 
    
         
            +
                    if (match_len = has_terminal?('rule', false, index))
         
     | 
| 
      
 1061 
     | 
    
         
            +
                      r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
         
     | 
| 
      
 1062 
     | 
    
         
            +
                      @index += match_len
         
     | 
| 
      
 1063 
     | 
    
         
            +
                    else
         
     | 
| 
      
 1064 
     | 
    
         
            +
                      terminal_parse_failure('\'rule\'')
         
     | 
| 
      
 1065 
     | 
    
         
            +
                      r1 = nil
         
     | 
| 
      
 1066 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1067 
     | 
    
         
            +
                    s0 << r1
         
     | 
| 
      
 1068 
     | 
    
         
            +
                    if r1
         
     | 
| 
      
 1069 
     | 
    
         
            +
                      s2, i2 = [], index
         
     | 
| 
      
 1070 
     | 
    
         
            +
                      loop do
         
     | 
| 
      
 1071 
     | 
    
         
            +
                        r3 = _nt_nbwhite
         
     | 
| 
      
 1072 
     | 
    
         
            +
                        if r3
         
     | 
| 
      
 1073 
     | 
    
         
            +
                          s2 << r3
         
     | 
| 
      
 1074 
     | 
    
         
            +
                        else
         
     | 
| 
      
 1075 
     | 
    
         
            +
                          break
         
     | 
| 
      
 1076 
     | 
    
         
            +
                        end
         
     | 
| 
      
 1077 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1078 
     | 
    
         
            +
                      if s2.empty?
         
     | 
| 
      
 1079 
     | 
    
         
            +
                        @index = i2
         
     | 
| 
      
 1080 
     | 
    
         
            +
                        r2 = nil
         
     | 
| 
      
 1081 
     | 
    
         
            +
                      else
         
     | 
| 
      
 1082 
     | 
    
         
            +
                        r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
         
     | 
| 
      
 1083 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1084 
     | 
    
         
            +
                      s0 << r2
         
     | 
| 
      
 1085 
     | 
    
         
            +
                      if r2
         
     | 
| 
      
 1086 
     | 
    
         
            +
                        r4 = _nt_nonterminal
         
     | 
| 
      
 1087 
     | 
    
         
            +
                        s0 << r4
         
     | 
| 
      
 1088 
     | 
    
         
            +
                        if r4
         
     | 
| 
      
 1089 
     | 
    
         
            +
                          s5, i5 = [], index
         
     | 
| 
      
 1090 
     | 
    
         
            +
                          loop do
         
     | 
| 
      
 1091 
     | 
    
         
            +
                            r6 = _nt_nbwhite
         
     | 
| 
      
 1092 
     | 
    
         
            +
                            if r6
         
     | 
| 
      
 1093 
     | 
    
         
            +
                              s5 << r6
         
     | 
| 
      
 1094 
     | 
    
         
            +
                            else
         
     | 
| 
      
 1095 
     | 
    
         
            +
                              break
         
     | 
| 
      
 1096 
     | 
    
         
            +
                            end
         
     | 
| 
      
 1097 
     | 
    
         
            +
                          end
         
     | 
| 
      
 1098 
     | 
    
         
            +
                          r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
         
     | 
| 
      
 1099 
     | 
    
         
            +
                          s0 << r5
         
     | 
| 
      
 1100 
     | 
    
         
            +
                          if r5
         
     | 
| 
      
 1101 
     | 
    
         
            +
                            if (match_len = has_terminal?('=', false, index))
         
     | 
| 
      
 1102 
     | 
    
         
            +
                              r7 = true
         
     | 
| 
      
 1103 
     | 
    
         
            +
                              @index += match_len
         
     | 
| 
      
 1104 
     | 
    
         
            +
                            else
         
     | 
| 
      
 1105 
     | 
    
         
            +
                              terminal_parse_failure('\'=\'')
         
     | 
| 
      
 1106 
     | 
    
         
            +
                              r7 = nil
         
     | 
| 
      
 1107 
     | 
    
         
            +
                            end
         
     | 
| 
      
 1108 
     | 
    
         
            +
                            s0 << r7
         
     | 
| 
      
 1109 
     | 
    
         
            +
                            if r7
         
     | 
| 
      
 1110 
     | 
    
         
            +
                              s8, i8 = [], index
         
     | 
| 
      
 1111 
     | 
    
         
            +
                              loop do
         
     | 
| 
      
 1112 
     | 
    
         
            +
                                r9 = _nt_nbwhite
         
     | 
| 
      
 1113 
     | 
    
         
            +
                                if r9
         
     | 
| 
      
 1114 
     | 
    
         
            +
                                  s8 << r9
         
     | 
| 
      
 1115 
     | 
    
         
            +
                                else
         
     | 
| 
      
 1116 
     | 
    
         
            +
                                  break
         
     | 
| 
      
 1117 
     | 
    
         
            +
                                end
         
     | 
| 
      
 1118 
     | 
    
         
            +
                              end
         
     | 
| 
      
 1119 
     | 
    
         
            +
                              r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
         
     | 
| 
      
 1120 
     | 
    
         
            +
                              s0 << r8
         
     | 
| 
      
 1121 
     | 
    
         
            +
                              if r8
         
     | 
| 
      
 1122 
     | 
    
         
            +
                                r10 = _nt_parsing_expression
         
     | 
| 
      
 1123 
     | 
    
         
            +
                                s0 << r10
         
     | 
| 
      
 1124 
     | 
    
         
            +
                                if r10
         
     | 
| 
      
 1125 
     | 
    
         
            +
                                  i11 = index
         
     | 
| 
      
 1126 
     | 
    
         
            +
                                  r12 = lambda { |v| v.last.text_value !~ /[\n\r]/ }.call(s0)
         
     | 
| 
      
 1127 
     | 
    
         
            +
                                  if !r12
         
     | 
| 
      
 1128 
     | 
    
         
            +
                                    terminal_parse_failure("<semantic predicate>")
         
     | 
| 
      
 1129 
     | 
    
         
            +
                                  end
         
     | 
| 
      
 1130 
     | 
    
         
            +
                                  if r12
         
     | 
| 
      
 1131 
     | 
    
         
            +
                                    @index = i11
         
     | 
| 
      
 1132 
     | 
    
         
            +
                                    r11 = instantiate_node(SyntaxNode,input, index...index)
         
     | 
| 
      
 1133 
     | 
    
         
            +
                                  else
         
     | 
| 
      
 1134 
     | 
    
         
            +
                                    @index = i11
         
     | 
| 
      
 1135 
     | 
    
         
            +
                                    r11 = nil
         
     | 
| 
      
 1136 
     | 
    
         
            +
                                  end
         
     | 
| 
      
 1137 
     | 
    
         
            +
                                  s0 << r11
         
     | 
| 
      
 1138 
     | 
    
         
            +
                                  if r11
         
     | 
| 
      
 1139 
     | 
    
         
            +
                                    s13, i13 = [], index
         
     | 
| 
      
 1140 
     | 
    
         
            +
                                    loop do
         
     | 
| 
      
 1141 
     | 
    
         
            +
                                      i14 = index
         
     | 
| 
      
 1142 
     | 
    
         
            +
                                      r15 = _nt_nbwhite
         
     | 
| 
      
 1143 
     | 
    
         
            +
                                      if r15
         
     | 
| 
      
 1144 
     | 
    
         
            +
                                        r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
         
     | 
| 
      
 1145 
     | 
    
         
            +
                                        r14 = r15
         
     | 
| 
      
 1146 
     | 
    
         
            +
                                      else
         
     | 
| 
      
 1147 
     | 
    
         
            +
                                        r16 = _nt_comment_to_eol
         
     | 
| 
      
 1148 
     | 
    
         
            +
                                        if r16
         
     | 
| 
      
 1149 
     | 
    
         
            +
                                          r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
         
     | 
| 
      
 1150 
     | 
    
         
            +
                                          r14 = r16
         
     | 
| 
      
 1151 
     | 
    
         
            +
                                        else
         
     | 
| 
      
 1152 
     | 
    
         
            +
                                          @index = i14
         
     | 
| 
      
 1153 
     | 
    
         
            +
                                          r14 = nil
         
     | 
| 
      
 1154 
     | 
    
         
            +
                                        end
         
     | 
| 
      
 1155 
     | 
    
         
            +
                                      end
         
     | 
| 
      
 1156 
     | 
    
         
            +
                                      if r14
         
     | 
| 
      
 1157 
     | 
    
         
            +
                                        s13 << r14
         
     | 
| 
      
 1158 
     | 
    
         
            +
                                      else
         
     | 
| 
      
 1159 
     | 
    
         
            +
                                        break
         
     | 
| 
      
 1160 
     | 
    
         
            +
                                      end
         
     | 
| 
      
 1161 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 1162 
     | 
    
         
            +
                                    r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
         
     | 
| 
      
 1163 
     | 
    
         
            +
                                    s0 << r13
         
     | 
| 
      
 1164 
     | 
    
         
            +
                                    if r13
         
     | 
| 
      
 1165 
     | 
    
         
            +
                                      s17, i17 = [], index
         
     | 
| 
      
 1166 
     | 
    
         
            +
                                      loop do
         
     | 
| 
      
 1167 
     | 
    
         
            +
                                        r18 = _nt_eol
         
     | 
| 
      
 1168 
     | 
    
         
            +
                                        if r18
         
     | 
| 
      
 1169 
     | 
    
         
            +
                                          s17 << r18
         
     | 
| 
      
 1170 
     | 
    
         
            +
                                        else
         
     | 
| 
      
 1171 
     | 
    
         
            +
                                          break
         
     | 
| 
      
 1172 
     | 
    
         
            +
                                        end
         
     | 
| 
      
 1173 
     | 
    
         
            +
                                      end
         
     | 
| 
      
 1174 
     | 
    
         
            +
                                      if s17.empty?
         
     | 
| 
      
 1175 
     | 
    
         
            +
                                        @index = i17
         
     | 
| 
      
 1176 
     | 
    
         
            +
                                        r17 = nil
         
     | 
| 
      
 1177 
     | 
    
         
            +
                                      else
         
     | 
| 
      
 1178 
     | 
    
         
            +
                                        r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
         
     | 
| 
      
 1179 
     | 
    
         
            +
                                      end
         
     | 
| 
      
 1180 
     | 
    
         
            +
                                      s0 << r17
         
     | 
| 
      
 1181 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 1182 
     | 
    
         
            +
                                  end
         
     | 
| 
      
 1183 
     | 
    
         
            +
                                end
         
     | 
| 
      
 1184 
     | 
    
         
            +
                              end
         
     | 
| 
      
 1185 
     | 
    
         
            +
                            end
         
     | 
| 
      
 1186 
     | 
    
         
            +
                          end
         
     | 
| 
      
 1187 
     | 
    
         
            +
                        end
         
     | 
| 
      
 1188 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1189 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1190 
     | 
    
         
            +
                    if s0.last
         
     | 
| 
      
 1191 
     | 
    
         
            +
                      r0 = instantiate_node(ParsingRule,input, i0...index, s0)
         
     | 
| 
      
 1192 
     | 
    
         
            +
                      r0.extend(ParsingEndlessRule0)
         
     | 
| 
      
 1193 
     | 
    
         
            +
                    else
         
     | 
| 
      
 1194 
     | 
    
         
            +
                      @index = i0
         
     | 
| 
      
 1195 
     | 
    
         
            +
                      r0 = nil
         
     | 
| 
      
 1196 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1197 
     | 
    
         
            +
             
     | 
| 
      
 1198 
     | 
    
         
            +
                    node_cache[:parsing_endless_rule][start_index] = r0
         
     | 
| 
      
 1199 
     | 
    
         
            +
             
     | 
| 
      
 1200 
     | 
    
         
            +
                    r0
         
     | 
| 
      
 1201 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1202 
     | 
    
         
            +
             
     | 
| 
       1031 
1203 
     | 
    
         
             
                  def _nt_parsing_expression
         
     | 
| 
       1032 
1204 
     | 
    
         
             
                    start_index = index
         
     | 
| 
       1033 
1205 
     | 
    
         
             
                    if node_cache[:parsing_expression].has_key?(index)
         
     | 
| 
         @@ -4207,6 +4379,54 @@ module Treetop 
     | 
|
| 
       4207 
4379 
     | 
    
         
             
                    r0
         
     | 
| 
       4208 
4380 
     | 
    
         
             
                  end
         
     | 
| 
       4209 
4381 
     | 
    
         | 
| 
      
 4382 
     | 
    
         
            +
                  def _nt_nbwhite
         
     | 
| 
      
 4383 
     | 
    
         
            +
                    start_index = index
         
     | 
| 
      
 4384 
     | 
    
         
            +
                    if node_cache[:nbwhite].has_key?(index)
         
     | 
| 
      
 4385 
     | 
    
         
            +
                      cached = node_cache[:nbwhite][index]
         
     | 
| 
      
 4386 
     | 
    
         
            +
                      if cached
         
     | 
| 
      
 4387 
     | 
    
         
            +
                        node_cache[:nbwhite][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
         
     | 
| 
      
 4388 
     | 
    
         
            +
                        @index = cached.interval.end
         
     | 
| 
      
 4389 
     | 
    
         
            +
                      end
         
     | 
| 
      
 4390 
     | 
    
         
            +
                      return cached
         
     | 
| 
      
 4391 
     | 
    
         
            +
                    end
         
     | 
| 
      
 4392 
     | 
    
         
            +
             
     | 
| 
      
 4393 
     | 
    
         
            +
                    if has_terminal?(@regexps[gr = '\A[ \\t]'] ||= Regexp.new(gr), :regexp, index)
         
     | 
| 
      
 4394 
     | 
    
         
            +
                      r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
         
     | 
| 
      
 4395 
     | 
    
         
            +
                      @index += 1
         
     | 
| 
      
 4396 
     | 
    
         
            +
                    else
         
     | 
| 
      
 4397 
     | 
    
         
            +
                      terminal_parse_failure('[ \\t]')
         
     | 
| 
      
 4398 
     | 
    
         
            +
                      r0 = nil
         
     | 
| 
      
 4399 
     | 
    
         
            +
                    end
         
     | 
| 
      
 4400 
     | 
    
         
            +
             
     | 
| 
      
 4401 
     | 
    
         
            +
                    node_cache[:nbwhite][start_index] = r0
         
     | 
| 
      
 4402 
     | 
    
         
            +
             
     | 
| 
      
 4403 
     | 
    
         
            +
                    r0
         
     | 
| 
      
 4404 
     | 
    
         
            +
                  end
         
     | 
| 
      
 4405 
     | 
    
         
            +
             
     | 
| 
      
 4406 
     | 
    
         
            +
                  def _nt_eol
         
     | 
| 
      
 4407 
     | 
    
         
            +
                    start_index = index
         
     | 
| 
      
 4408 
     | 
    
         
            +
                    if node_cache[:eol].has_key?(index)
         
     | 
| 
      
 4409 
     | 
    
         
            +
                      cached = node_cache[:eol][index]
         
     | 
| 
      
 4410 
     | 
    
         
            +
                      if cached
         
     | 
| 
      
 4411 
     | 
    
         
            +
                        node_cache[:eol][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
         
     | 
| 
      
 4412 
     | 
    
         
            +
                        @index = cached.interval.end
         
     | 
| 
      
 4413 
     | 
    
         
            +
                      end
         
     | 
| 
      
 4414 
     | 
    
         
            +
                      return cached
         
     | 
| 
      
 4415 
     | 
    
         
            +
                    end
         
     | 
| 
      
 4416 
     | 
    
         
            +
             
     | 
| 
      
 4417 
     | 
    
         
            +
                    if has_terminal?(@regexps[gr = '\A[\\n\\r]'] ||= Regexp.new(gr), :regexp, index)
         
     | 
| 
      
 4418 
     | 
    
         
            +
                      r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
         
     | 
| 
      
 4419 
     | 
    
         
            +
                      @index += 1
         
     | 
| 
      
 4420 
     | 
    
         
            +
                    else
         
     | 
| 
      
 4421 
     | 
    
         
            +
                      terminal_parse_failure('[\\n\\r]')
         
     | 
| 
      
 4422 
     | 
    
         
            +
                      r0 = nil
         
     | 
| 
      
 4423 
     | 
    
         
            +
                    end
         
     | 
| 
      
 4424 
     | 
    
         
            +
             
     | 
| 
      
 4425 
     | 
    
         
            +
                    node_cache[:eol][start_index] = r0
         
     | 
| 
      
 4426 
     | 
    
         
            +
             
     | 
| 
      
 4427 
     | 
    
         
            +
                    r0
         
     | 
| 
      
 4428 
     | 
    
         
            +
                  end
         
     | 
| 
      
 4429 
     | 
    
         
            +
             
     | 
| 
       4210 
4430 
     | 
    
         
             
                  def _nt_white
         
     | 
| 
       4211 
4431 
     | 
    
         
             
                    start_index = index
         
     | 
| 
       4212 
4432 
     | 
    
         
             
                    if node_cache[:white].has_key?(index)
         
     | 
| 
         @@ -4231,11 +4451,13 @@ module Treetop 
     | 
|
| 
       4231 
4451 
     | 
    
         
             
                    r0
         
     | 
| 
       4232 
4452 
     | 
    
         
             
                  end
         
     | 
| 
       4233 
4453 
     | 
    
         | 
| 
       4234 
     | 
    
         
            -
                end
         
     | 
| 
       4235 
4454 
     | 
    
         | 
| 
       4236 
     | 
    
         
            -
             
     | 
| 
       4237 
     | 
    
         
            -
             
     | 
| 
      
 4455 
     | 
    
         
            +
                  class Parser < Treetop::Runtime::CompiledParser
         
     | 
| 
      
 4456 
     | 
    
         
            +
                    include Metagrammar
         
     | 
| 
      
 4457 
     | 
    
         
            +
                  end
         
     | 
| 
       4238 
4458 
     | 
    
         
             
                end
         
     | 
| 
       4239 
4459 
     | 
    
         | 
| 
      
 4460 
     | 
    
         
            +
                MetagrammarParser = Metagrammar::Parser
         
     | 
| 
      
 4461 
     | 
    
         
            +
             
     | 
| 
       4240 
4462 
     | 
    
         
             
              end
         
     | 
| 
       4241 
4463 
     | 
    
         
             
            end
         
     | 
| 
         @@ -55,7 +55,7 @@ module Treetop 
     | 
|
| 
       55 
55 
     | 
    
         
             
                  end
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
                  rule declaration
         
     | 
| 
       58 
     | 
    
         
            -
                    parsing_rule / include_declaration
         
     | 
| 
      
 58 
     | 
    
         
            +
                    parsing_rule / parsing_endless_rule / include_declaration
         
     | 
| 
       59 
59 
     | 
    
         
             
                  end
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
                  rule include_declaration
         
     | 
| 
         @@ -70,6 +70,13 @@ module Treetop 
     | 
|
| 
       70 
70 
     | 
    
         
             
                    'rule' space nonterminal space ('do' space)? parsing_expression space 'end' <ParsingRule>
         
     | 
| 
       71 
71 
     | 
    
         
             
                  end
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
      
 73 
     | 
    
         
            +
                  rule parsing_endless_rule
         
     | 
| 
      
 74 
     | 
    
         
            +
                    'rule' nbwhite+ nonterminal nbwhite* '=' nbwhite*
         
     | 
| 
      
 75 
     | 
    
         
            +
            	  parsing_expression &{ |v| v.last.text_value !~ /[\n\r]/ } # Parsing expression must not break line
         
     | 
| 
      
 76 
     | 
    
         
            +
            	  (nbwhite / comment_to_eol)* eol+
         
     | 
| 
      
 77 
     | 
    
         
            +
            	  <ParsingRule>
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
       73 
80 
     | 
    
         
             
                  rule parsing_expression
         
     | 
| 
       74 
81 
     | 
    
         
             
                    choice / sequence / primary
         
     | 
| 
       75 
82 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -578,6 +585,14 @@ module Treetop 
     | 
|
| 
       578 
585 
     | 
    
         
             
                    '#' (!"\n" .)*
         
     | 
| 
       579 
586 
     | 
    
         
             
                  end
         
     | 
| 
       580 
587 
     | 
    
         | 
| 
      
 588 
     | 
    
         
            +
                  rule nbwhite
         
     | 
| 
      
 589 
     | 
    
         
            +
                    [ \t]
         
     | 
| 
      
 590 
     | 
    
         
            +
                  end
         
     | 
| 
      
 591 
     | 
    
         
            +
             
     | 
| 
      
 592 
     | 
    
         
            +
                  rule eol
         
     | 
| 
      
 593 
     | 
    
         
            +
                    [\n\r]
         
     | 
| 
      
 594 
     | 
    
         
            +
                  end
         
     | 
| 
      
 595 
     | 
    
         
            +
             
     | 
| 
       581 
596 
     | 
    
         
             
                  rule white
         
     | 
| 
       582 
597 
     | 
    
         
             
                    [ \t\n\r]
         
     | 
| 
       583 
598 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -3,26 +3,28 @@ module Treetop 
     | 
|
| 
       3 
3 
     | 
    
         
             
                class Grammar < Runtime::SyntaxNode
         
     | 
| 
       4 
4 
     | 
    
         
             
                  def compile
         
     | 
| 
       5 
5 
     | 
    
         
             
                    builder = RubyBuilder.new
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       7 
7 
     | 
    
         
             
                    builder.module_declaration "#{grammar_name.text_value}" do
         
     | 
| 
       8 
8 
     | 
    
         
             
                      builder.in(indent_level) # account for initial indentation of grammar declaration
         
     | 
| 
       9 
9 
     | 
    
         
             
                      builder << "include Treetop::Runtime"
         
     | 
| 
       10 
10 
     | 
    
         
             
                      builder.newline
         
     | 
| 
       11 
11 
     | 
    
         
             
                      declaration_sequence.compile(builder)
         
     | 
| 
      
 12 
     | 
    
         
            +
                      builder.newline
         
     | 
| 
      
 13 
     | 
    
         
            +
                      builder.class_declaration "Parser < Treetop::Runtime::CompiledParser" do
         
     | 
| 
      
 14 
     | 
    
         
            +
                        builder << "include #{grammar_name.text_value}"
         
     | 
| 
      
 15 
     | 
    
         
            +
                      end
         
     | 
| 
       12 
16 
     | 
    
         
             
                    end
         
     | 
| 
       13 
17 
     | 
    
         
             
                    builder.newline
         
     | 
| 
       14 
     | 
    
         
            -
                    builder 
     | 
| 
       15 
     | 
    
         
            -
                      builder << "include #{grammar_name.text_value}"
         
     | 
| 
       16 
     | 
    
         
            -
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
                    builder << "#{parser_name} = #{grammar_name.text_value}::Parser"
         
     | 
| 
       17 
19 
     | 
    
         
             
                  end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       19 
21 
     | 
    
         
             
                  def indent_level
         
     | 
| 
       20 
22 
     | 
    
         
             
                    input.column_of(interval.begin) - 1
         
     | 
| 
       21 
23 
     | 
    
         
             
                  end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       23 
25 
     | 
    
         
             
                  def parser_name
         
     | 
| 
       24 
26 
     | 
    
         
             
                    grammar_name.text_value + 'Parser'
         
     | 
| 
       25 
27 
     | 
    
         
             
                  end
         
     | 
| 
       26 
28 
     | 
    
         
             
                end
         
     | 
| 
       27 
     | 
    
         
            -
              end 
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
       28 
30 
     | 
    
         
             
            end
         
     | 
    
        data/lib/treetop/version.rb
    CHANGED
    
    
    
        data/treetop.gemspec
    CHANGED
    
    | 
         @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       10 
10 
     | 
    
         
             
              spec.authors = ["Nathan Sobo", "Clifford Heath"]
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
              spec.email = "cliffordheath@gmail.com"
         
     | 
| 
       13 
     | 
    
         
            -
              spec.date = Date. 
     | 
| 
      
 13 
     | 
    
         
            +
              spec.date = Date.parse(`git show -s --format=%ci`)
         
     | 
| 
       14 
14 
     | 
    
         
             
              spec.summary = "A Ruby-based text parsing and interpretation DSL"
         
     | 
| 
       15 
15 
     | 
    
         
             
              spec.description = "A Parsing Expression Grammar (PEG) Parser generator DSL for Ruby"
         
     | 
| 
       16 
16 
     | 
    
         
             
              spec.homepage = "https://github.com/cjheath/treetop"
         
     | 
| 
         @@ -25,10 +25,10 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       25 
25 
     | 
    
         
             
              ]
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
              spec.add_runtime_dependency(%q<polyglot>, ["~> 0.3"])
         
     | 
| 
       28 
     | 
    
         
            -
              spec.add_development_dependency(%q<activesupport>, [" 
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_development_dependency(%q<activesupport>, ["~> 4"])
         
     | 
| 
       29 
29 
     | 
    
         
             
              spec.add_development_dependency(%q<i18n>, ["~> 1.0"])
         
     | 
| 
       30 
30 
     | 
    
         
             
              spec.add_development_dependency(%q<rr>, ["~> 3.0"])
         
     | 
| 
       31 
31 
     | 
    
         
             
              spec.add_development_dependency(%q<rspec>, ["~> 3"])
         
     | 
| 
       32 
     | 
    
         
            -
              spec.add_development_dependency(%q<rake>, [" 
     | 
| 
      
 32 
     | 
    
         
            +
              spec.add_development_dependency(%q<rake>, ["~> 11"])
         
     | 
| 
       33 
33 
     | 
    
         
             
            end
         
     | 
| 
       34 
34 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: treetop
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.6. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.6.15
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Nathan Sobo
         
     | 
| 
       8 
8 
     | 
    
         
             
            - Clifford Heath
         
     | 
| 
       9 
     | 
    
         
            -
            autorequire:
         
     | 
| 
       10 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-10-19 00:00:00.000000000 Z
         
     | 
| 
       13 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
14 
     | 
    
         
             
              name: polyglot
         
     | 
| 
         @@ -29,14 +28,14 @@ dependencies: 
     | 
|
| 
       29 
28 
     | 
    
         
             
              name: activesupport
         
     | 
| 
       30 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       31 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       32 
     | 
    
         
            -
                - - " 
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       33 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       34 
33 
     | 
    
         
             
                    version: '4'
         
     | 
| 
       35 
34 
     | 
    
         
             
              type: :development
         
     | 
| 
       36 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       37 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       38 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       39 
     | 
    
         
            -
                - - " 
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       40 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       41 
40 
     | 
    
         
             
                    version: '4'
         
     | 
| 
       42 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
         @@ -85,14 +84,14 @@ dependencies: 
     | 
|
| 
       85 
84 
     | 
    
         
             
              name: rake
         
     | 
| 
       86 
85 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       87 
86 
     | 
    
         
             
                requirements:
         
     | 
| 
       88 
     | 
    
         
            -
                - - " 
     | 
| 
      
 87 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       89 
88 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       90 
89 
     | 
    
         
             
                    version: '11'
         
     | 
| 
       91 
90 
     | 
    
         
             
              type: :development
         
     | 
| 
       92 
91 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       93 
92 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       94 
93 
     | 
    
         
             
                requirements:
         
     | 
| 
       95 
     | 
    
         
            -
                - - " 
     | 
| 
      
 94 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       96 
95 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       97 
96 
     | 
    
         
             
                    version: '11'
         
     | 
| 
       98 
97 
     | 
    
         
             
            description: A Parsing Expression Grammar (PEG) Parser generator DSL for Ruby
         
     | 
| 
         @@ -183,7 +182,6 @@ homepage: https://github.com/cjheath/treetop 
     | 
|
| 
       183 
182 
     | 
    
         
             
            licenses:
         
     | 
| 
       184 
183 
     | 
    
         
             
            - MIT
         
     | 
| 
       185 
184 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       186 
     | 
    
         
            -
            post_install_message:
         
     | 
| 
       187 
185 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       188 
186 
     | 
    
         
             
            require_paths:
         
     | 
| 
       189 
187 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -198,8 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       198 
196 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       199 
197 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       200 
198 
     | 
    
         
             
            requirements: []
         
     | 
| 
       201 
     | 
    
         
            -
            rubygems_version: 3.2 
     | 
| 
       202 
     | 
    
         
            -
            signing_key:
         
     | 
| 
      
 199 
     | 
    
         
            +
            rubygems_version: 3.6.2
         
     | 
| 
       203 
200 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       204 
201 
     | 
    
         
             
            summary: A Ruby-based text parsing and interpretation DSL
         
     | 
| 
       205 
202 
     | 
    
         
             
            test_files: []
         
     |