ceml 0.3.0 → 0.3.1
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.
- data/.gitignore +2 -0
- data/VERSION +1 -1
- data/beginners-guide.md +7 -7
- data/ceml.gemspec +78 -0
- data/examples/sample_delegate.rb +4 -0
- data/lib/ceml/casting.rb +15 -33
- data/lib/ceml/casting_criterion.rb +39 -0
- data/lib/ceml/instructions.rb +11 -10
- data/lib/ceml/script.rb +136 -78
- data/lib/ceml/tt/casting.treetop +26 -29
- data/lib/ceml/tt/instructions.treetop +4 -8
- data/lib/ceml/tt/lexer.treetop +42 -3
- data/lib/ceml/tt/scripts.treetop +25 -10
- data/lib/ceml.rb +13 -14
- data/test/helper.rb +0 -19
- data/test/test_casting.rb +9 -10
- data/test/test_incident.rb +25 -0
- data/test/test_instructions.rb +2 -2
- data/test/test_scripts.rb +1 -1
- data/try +14 -0
- metadata +7 -7
- data/lib/ceml/tt/casting.rb +0 -618
- data/lib/ceml/tt/instructions.rb +0 -409
- data/lib/ceml/tt/lexer.rb +0 -400
- data/lib/ceml/tt/scripts.rb +0 -345
    
        data/lib/ceml/tt/casting.rb
    DELETED
    
    | @@ -1,618 +0,0 @@ | |
| 1 | 
            -
            # Autogenerated from a Treetop grammar. Edits may be lost.
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
            module CEML
         | 
| 5 | 
            -
            module Casting
         | 
| 6 | 
            -
              include Treetop::Runtime
         | 
| 7 | 
            -
             | 
| 8 | 
            -
              def root
         | 
| 9 | 
            -
                @root || :casting_statement
         | 
| 10 | 
            -
              end
         | 
| 11 | 
            -
             | 
| 12 | 
            -
              include Lexer
         | 
| 13 | 
            -
             | 
| 14 | 
            -
              module CastingStatement0
         | 
| 15 | 
            -
                def ws1
         | 
| 16 | 
            -
                  elements[0]
         | 
| 17 | 
            -
                end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                def ws2
         | 
| 20 | 
            -
                  elements[2]
         | 
| 21 | 
            -
                end
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                def distance
         | 
| 24 | 
            -
                  elements[3]
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
              end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
              module CastingStatement1
         | 
| 29 | 
            -
                def casting_method
         | 
| 30 | 
            -
                  elements[0]
         | 
| 31 | 
            -
                end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                def ws
         | 
| 34 | 
            -
                  elements[1]
         | 
| 35 | 
            -
                end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                def roles_phrase
         | 
| 38 | 
            -
                  elements[2]
         | 
| 39 | 
            -
                end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                def within
         | 
| 42 | 
            -
                  elements[3]
         | 
| 43 | 
            -
                end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                def nl
         | 
| 46 | 
            -
                  elements[4]
         | 
| 47 | 
            -
                end
         | 
| 48 | 
            -
              end
         | 
| 49 | 
            -
             | 
| 50 | 
            -
              def _nt_casting_statement
         | 
| 51 | 
            -
                start_index = index
         | 
| 52 | 
            -
                if node_cache[:casting_statement].has_key?(index)
         | 
| 53 | 
            -
                  cached = node_cache[:casting_statement][index]
         | 
| 54 | 
            -
                  @index = cached.interval.end if cached
         | 
| 55 | 
            -
                  return cached
         | 
| 56 | 
            -
                end
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                i0, s0 = index, []
         | 
| 59 | 
            -
                r1 = _nt_casting_method
         | 
| 60 | 
            -
                s0 << r1
         | 
| 61 | 
            -
                if r1
         | 
| 62 | 
            -
                  r2 = _nt_ws
         | 
| 63 | 
            -
                  s0 << r2
         | 
| 64 | 
            -
                  if r2
         | 
| 65 | 
            -
                    r3 = _nt_roles_phrase
         | 
| 66 | 
            -
                    s0 << r3
         | 
| 67 | 
            -
                    if r3
         | 
| 68 | 
            -
                      i5, s5 = index, []
         | 
| 69 | 
            -
                      r6 = _nt_ws
         | 
| 70 | 
            -
                      s5 << r6
         | 
| 71 | 
            -
                      if r6
         | 
| 72 | 
            -
                        if has_terminal?('within', false, index)
         | 
| 73 | 
            -
                          r7 = instantiate_node(SyntaxNode,input, index...(index + 6))
         | 
| 74 | 
            -
                          @index += 6
         | 
| 75 | 
            -
                        else
         | 
| 76 | 
            -
                          terminal_parse_failure('within')
         | 
| 77 | 
            -
                          r7 = nil
         | 
| 78 | 
            -
                        end
         | 
| 79 | 
            -
                        s5 << r7
         | 
| 80 | 
            -
                        if r7
         | 
| 81 | 
            -
                          r8 = _nt_ws
         | 
| 82 | 
            -
                          s5 << r8
         | 
| 83 | 
            -
                          if r8
         | 
| 84 | 
            -
                            r9 = _nt_distance
         | 
| 85 | 
            -
                            s5 << r9
         | 
| 86 | 
            -
                          end
         | 
| 87 | 
            -
                        end
         | 
| 88 | 
            -
                      end
         | 
| 89 | 
            -
                      if s5.last
         | 
| 90 | 
            -
                        r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
         | 
| 91 | 
            -
                        r5.extend(CastingStatement0)
         | 
| 92 | 
            -
                      else
         | 
| 93 | 
            -
                        @index = i5
         | 
| 94 | 
            -
                        r5 = nil
         | 
| 95 | 
            -
                      end
         | 
| 96 | 
            -
                      if r5
         | 
| 97 | 
            -
                        r4 = r5
         | 
| 98 | 
            -
                      else
         | 
| 99 | 
            -
                        r4 = instantiate_node(SyntaxNode,input, index...index)
         | 
| 100 | 
            -
                      end
         | 
| 101 | 
            -
                      s0 << r4
         | 
| 102 | 
            -
                      if r4
         | 
| 103 | 
            -
                        r10 = _nt_nl
         | 
| 104 | 
            -
                        s0 << r10
         | 
| 105 | 
            -
                      end
         | 
| 106 | 
            -
                    end
         | 
| 107 | 
            -
                  end
         | 
| 108 | 
            -
                end
         | 
| 109 | 
            -
                if s0.last
         | 
| 110 | 
            -
                  r0 = instantiate_node(CastingStatement,input, i0...index, s0)
         | 
| 111 | 
            -
                  r0.extend(CastingStatement1)
         | 
| 112 | 
            -
                else
         | 
| 113 | 
            -
                  @index = i0
         | 
| 114 | 
            -
                  r0 = nil
         | 
| 115 | 
            -
                end
         | 
| 116 | 
            -
             | 
| 117 | 
            -
                node_cache[:casting_statement][start_index] = r0
         | 
| 118 | 
            -
             | 
| 119 | 
            -
                r0
         | 
| 120 | 
            -
              end
         | 
| 121 | 
            -
             | 
| 122 | 
            -
              def _nt_casting_method
         | 
| 123 | 
            -
                start_index = index
         | 
| 124 | 
            -
                if node_cache[:casting_method].has_key?(index)
         | 
| 125 | 
            -
                  cached = node_cache[:casting_method][index]
         | 
| 126 | 
            -
                  @index = cached.interval.end if cached
         | 
| 127 | 
            -
                  return cached
         | 
| 128 | 
            -
                end
         | 
| 129 | 
            -
             | 
| 130 | 
            -
                i0 = index
         | 
| 131 | 
            -
                if has_terminal?('gather', false, index)
         | 
| 132 | 
            -
                  r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
         | 
| 133 | 
            -
                  @index += 6
         | 
| 134 | 
            -
                else
         | 
| 135 | 
            -
                  terminal_parse_failure('gather')
         | 
| 136 | 
            -
                  r1 = nil
         | 
| 137 | 
            -
                end
         | 
| 138 | 
            -
                if r1
         | 
| 139 | 
            -
                  r0 = r1
         | 
| 140 | 
            -
                else
         | 
| 141 | 
            -
                  if has_terminal?('teams of', false, index)
         | 
| 142 | 
            -
                    r2 = instantiate_node(SyntaxNode,input, index...(index + 8))
         | 
| 143 | 
            -
                    @index += 8
         | 
| 144 | 
            -
                  else
         | 
| 145 | 
            -
                    terminal_parse_failure('teams of')
         | 
| 146 | 
            -
                    r2 = nil
         | 
| 147 | 
            -
                  end
         | 
| 148 | 
            -
                  if r2
         | 
| 149 | 
            -
                    r0 = r2
         | 
| 150 | 
            -
                  else
         | 
| 151 | 
            -
                    if has_terminal?('nab', false, index)
         | 
| 152 | 
            -
                      r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
         | 
| 153 | 
            -
                      @index += 3
         | 
| 154 | 
            -
                    else
         | 
| 155 | 
            -
                      terminal_parse_failure('nab')
         | 
| 156 | 
            -
                      r3 = nil
         | 
| 157 | 
            -
                    end
         | 
| 158 | 
            -
                    if r3
         | 
| 159 | 
            -
                      r0 = r3
         | 
| 160 | 
            -
                    else
         | 
| 161 | 
            -
                      @index = i0
         | 
| 162 | 
            -
                      r0 = nil
         | 
| 163 | 
            -
                    end
         | 
| 164 | 
            -
                  end
         | 
| 165 | 
            -
                end
         | 
| 166 | 
            -
             | 
| 167 | 
            -
                node_cache[:casting_method][start_index] = r0
         | 
| 168 | 
            -
             | 
| 169 | 
            -
                r0
         | 
| 170 | 
            -
              end
         | 
| 171 | 
            -
             | 
| 172 | 
            -
              module RolesPhrase0
         | 
| 173 | 
            -
                def ws1
         | 
| 174 | 
            -
                  elements[0]
         | 
| 175 | 
            -
                end
         | 
| 176 | 
            -
             | 
| 177 | 
            -
                def ws2
         | 
| 178 | 
            -
                  elements[2]
         | 
| 179 | 
            -
                end
         | 
| 180 | 
            -
             | 
| 181 | 
            -
                def roles_phrase
         | 
| 182 | 
            -
                  elements[3]
         | 
| 183 | 
            -
                end
         | 
| 184 | 
            -
              end
         | 
| 185 | 
            -
             | 
| 186 | 
            -
              module RolesPhrase1
         | 
| 187 | 
            -
                def role
         | 
| 188 | 
            -
                  elements[0]
         | 
| 189 | 
            -
                end
         | 
| 190 | 
            -
             | 
| 191 | 
            -
                def more_roles
         | 
| 192 | 
            -
                  elements[1]
         | 
| 193 | 
            -
                end
         | 
| 194 | 
            -
              end
         | 
| 195 | 
            -
             | 
| 196 | 
            -
              def _nt_roles_phrase
         | 
| 197 | 
            -
                start_index = index
         | 
| 198 | 
            -
                if node_cache[:roles_phrase].has_key?(index)
         | 
| 199 | 
            -
                  cached = node_cache[:roles_phrase][index]
         | 
| 200 | 
            -
                  @index = cached.interval.end if cached
         | 
| 201 | 
            -
                  return cached
         | 
| 202 | 
            -
                end
         | 
| 203 | 
            -
             | 
| 204 | 
            -
                i0, s0 = index, []
         | 
| 205 | 
            -
                r1 = _nt_role
         | 
| 206 | 
            -
                s0 << r1
         | 
| 207 | 
            -
                if r1
         | 
| 208 | 
            -
                  i3, s3 = index, []
         | 
| 209 | 
            -
                  r4 = _nt_ws
         | 
| 210 | 
            -
                  s3 << r4
         | 
| 211 | 
            -
                  if r4
         | 
| 212 | 
            -
                    if has_terminal?('and', false, index)
         | 
| 213 | 
            -
                      r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
         | 
| 214 | 
            -
                      @index += 3
         | 
| 215 | 
            -
                    else
         | 
| 216 | 
            -
                      terminal_parse_failure('and')
         | 
| 217 | 
            -
                      r5 = nil
         | 
| 218 | 
            -
                    end
         | 
| 219 | 
            -
                    s3 << r5
         | 
| 220 | 
            -
                    if r5
         | 
| 221 | 
            -
                      r6 = _nt_ws
         | 
| 222 | 
            -
                      s3 << r6
         | 
| 223 | 
            -
                      if r6
         | 
| 224 | 
            -
                        r7 = _nt_roles_phrase
         | 
| 225 | 
            -
                        s3 << r7
         | 
| 226 | 
            -
                      end
         | 
| 227 | 
            -
                    end
         | 
| 228 | 
            -
                  end
         | 
| 229 | 
            -
                  if s3.last
         | 
| 230 | 
            -
                    r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
         | 
| 231 | 
            -
                    r3.extend(RolesPhrase0)
         | 
| 232 | 
            -
                  else
         | 
| 233 | 
            -
                    @index = i3
         | 
| 234 | 
            -
                    r3 = nil
         | 
| 235 | 
            -
                  end
         | 
| 236 | 
            -
                  if r3
         | 
| 237 | 
            -
                    r2 = r3
         | 
| 238 | 
            -
                  else
         | 
| 239 | 
            -
                    r2 = instantiate_node(SyntaxNode,input, index...index)
         | 
| 240 | 
            -
                  end
         | 
| 241 | 
            -
                  s0 << r2
         | 
| 242 | 
            -
                end
         | 
| 243 | 
            -
                if s0.last
         | 
| 244 | 
            -
                  r0 = instantiate_node(CastingRoles,input, i0...index, s0)
         | 
| 245 | 
            -
                  r0.extend(RolesPhrase1)
         | 
| 246 | 
            -
                else
         | 
| 247 | 
            -
                  @index = i0
         | 
| 248 | 
            -
                  r0 = nil
         | 
| 249 | 
            -
                end
         | 
| 250 | 
            -
             | 
| 251 | 
            -
                node_cache[:roles_phrase][start_index] = r0
         | 
| 252 | 
            -
             | 
| 253 | 
            -
                r0
         | 
| 254 | 
            -
              end
         | 
| 255 | 
            -
             | 
| 256 | 
            -
              module Distance0
         | 
| 257 | 
            -
                def number
         | 
| 258 | 
            -
                  elements[0]
         | 
| 259 | 
            -
                end
         | 
| 260 | 
            -
             | 
| 261 | 
            -
                def distance_unit
         | 
| 262 | 
            -
                  elements[2]
         | 
| 263 | 
            -
                end
         | 
| 264 | 
            -
              end
         | 
| 265 | 
            -
             | 
| 266 | 
            -
              module Distance1
         | 
| 267 | 
            -
                def meters
         | 
| 268 | 
            -
                  number.text_value.to_f * case distance_unit.text_value
         | 
| 269 | 
            -
                  when /^mi/; 1600; when /^k/;  1000; when /^m/;  1;
         | 
| 270 | 
            -
                  when /^f/;  0.35; when /^b/;  200; else 1; end
         | 
| 271 | 
            -
                end
         | 
| 272 | 
            -
              end
         | 
| 273 | 
            -
             | 
| 274 | 
            -
              def _nt_distance
         | 
| 275 | 
            -
                start_index = index
         | 
| 276 | 
            -
                if node_cache[:distance].has_key?(index)
         | 
| 277 | 
            -
                  cached = node_cache[:distance][index]
         | 
| 278 | 
            -
                  @index = cached.interval.end if cached
         | 
| 279 | 
            -
                  return cached
         | 
| 280 | 
            -
                end
         | 
| 281 | 
            -
             | 
| 282 | 
            -
                i0, s0 = index, []
         | 
| 283 | 
            -
                r1 = _nt_number
         | 
| 284 | 
            -
                s0 << r1
         | 
| 285 | 
            -
                if r1
         | 
| 286 | 
            -
                  r3 = _nt_ws
         | 
| 287 | 
            -
                  if r3
         | 
| 288 | 
            -
                    r2 = r3
         | 
| 289 | 
            -
                  else
         | 
| 290 | 
            -
                    r2 = instantiate_node(SyntaxNode,input, index...index)
         | 
| 291 | 
            -
                  end
         | 
| 292 | 
            -
                  s0 << r2
         | 
| 293 | 
            -
                  if r2
         | 
| 294 | 
            -
                    i4 = index
         | 
| 295 | 
            -
                    if has_terminal?('miles', false, index)
         | 
| 296 | 
            -
                      r5 = instantiate_node(SyntaxNode,input, index...(index + 5))
         | 
| 297 | 
            -
                      @index += 5
         | 
| 298 | 
            -
                    else
         | 
| 299 | 
            -
                      terminal_parse_failure('miles')
         | 
| 300 | 
            -
                      r5 = nil
         | 
| 301 | 
            -
                    end
         | 
| 302 | 
            -
                    if r5
         | 
| 303 | 
            -
                      r4 = r5
         | 
| 304 | 
            -
                    else
         | 
| 305 | 
            -
                      if has_terminal?('mile', false, index)
         | 
| 306 | 
            -
                        r6 = instantiate_node(SyntaxNode,input, index...(index + 4))
         | 
| 307 | 
            -
                        @index += 4
         | 
| 308 | 
            -
                      else
         | 
| 309 | 
            -
                        terminal_parse_failure('mile')
         | 
| 310 | 
            -
                        r6 = nil
         | 
| 311 | 
            -
                      end
         | 
| 312 | 
            -
                      if r6
         | 
| 313 | 
            -
                        r4 = r6
         | 
| 314 | 
            -
                      else
         | 
| 315 | 
            -
                        if has_terminal?('mi', false, index)
         | 
| 316 | 
            -
                          r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
         | 
| 317 | 
            -
                          @index += 2
         | 
| 318 | 
            -
                        else
         | 
| 319 | 
            -
                          terminal_parse_failure('mi')
         | 
| 320 | 
            -
                          r7 = nil
         | 
| 321 | 
            -
                        end
         | 
| 322 | 
            -
                        if r7
         | 
| 323 | 
            -
                          r4 = r7
         | 
| 324 | 
            -
                        else
         | 
| 325 | 
            -
                          if has_terminal?('km', false, index)
         | 
| 326 | 
            -
                            r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
         | 
| 327 | 
            -
                            @index += 2
         | 
| 328 | 
            -
                          else
         | 
| 329 | 
            -
                            terminal_parse_failure('km')
         | 
| 330 | 
            -
                            r8 = nil
         | 
| 331 | 
            -
                          end
         | 
| 332 | 
            -
                          if r8
         | 
| 333 | 
            -
                            r4 = r8
         | 
| 334 | 
            -
                          else
         | 
| 335 | 
            -
                            if has_terminal?('kilometers', false, index)
         | 
| 336 | 
            -
                              r9 = instantiate_node(SyntaxNode,input, index...(index + 10))
         | 
| 337 | 
            -
                              @index += 10
         | 
| 338 | 
            -
                            else
         | 
| 339 | 
            -
                              terminal_parse_failure('kilometers')
         | 
| 340 | 
            -
                              r9 = nil
         | 
| 341 | 
            -
                            end
         | 
| 342 | 
            -
                            if r9
         | 
| 343 | 
            -
                              r4 = r9
         | 
| 344 | 
            -
                            else
         | 
| 345 | 
            -
                              if has_terminal?('k', false, index)
         | 
| 346 | 
            -
                                r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
         | 
| 347 | 
            -
                                @index += 1
         | 
| 348 | 
            -
                              else
         | 
| 349 | 
            -
                                terminal_parse_failure('k')
         | 
| 350 | 
            -
                                r10 = nil
         | 
| 351 | 
            -
                              end
         | 
| 352 | 
            -
                              if r10
         | 
| 353 | 
            -
                                r4 = r10
         | 
| 354 | 
            -
                              else
         | 
| 355 | 
            -
                                if has_terminal?('meters', false, index)
         | 
| 356 | 
            -
                                  r11 = instantiate_node(SyntaxNode,input, index...(index + 6))
         | 
| 357 | 
            -
                                  @index += 6
         | 
| 358 | 
            -
                                else
         | 
| 359 | 
            -
                                  terminal_parse_failure('meters')
         | 
| 360 | 
            -
                                  r11 = nil
         | 
| 361 | 
            -
                                end
         | 
| 362 | 
            -
                                if r11
         | 
| 363 | 
            -
                                  r4 = r11
         | 
| 364 | 
            -
                                else
         | 
| 365 | 
            -
                                  if has_terminal?('m', false, index)
         | 
| 366 | 
            -
                                    r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
         | 
| 367 | 
            -
                                    @index += 1
         | 
| 368 | 
            -
                                  else
         | 
| 369 | 
            -
                                    terminal_parse_failure('m')
         | 
| 370 | 
            -
                                    r12 = nil
         | 
| 371 | 
            -
                                  end
         | 
| 372 | 
            -
                                  if r12
         | 
| 373 | 
            -
                                    r4 = r12
         | 
| 374 | 
            -
                                  else
         | 
| 375 | 
            -
                                    if has_terminal?('ft', false, index)
         | 
| 376 | 
            -
                                      r13 = instantiate_node(SyntaxNode,input, index...(index + 2))
         | 
| 377 | 
            -
                                      @index += 2
         | 
| 378 | 
            -
                                    else
         | 
| 379 | 
            -
                                      terminal_parse_failure('ft')
         | 
| 380 | 
            -
                                      r13 = nil
         | 
| 381 | 
            -
                                    end
         | 
| 382 | 
            -
                                    if r13
         | 
| 383 | 
            -
                                      r4 = r13
         | 
| 384 | 
            -
                                    else
         | 
| 385 | 
            -
                                      if has_terminal?('feet', false, index)
         | 
| 386 | 
            -
                                        r14 = instantiate_node(SyntaxNode,input, index...(index + 4))
         | 
| 387 | 
            -
                                        @index += 4
         | 
| 388 | 
            -
                                      else
         | 
| 389 | 
            -
                                        terminal_parse_failure('feet')
         | 
| 390 | 
            -
                                        r14 = nil
         | 
| 391 | 
            -
                                      end
         | 
| 392 | 
            -
                                      if r14
         | 
| 393 | 
            -
                                        r4 = r14
         | 
| 394 | 
            -
                                      else
         | 
| 395 | 
            -
                                        if has_terminal?('f', false, index)
         | 
| 396 | 
            -
                                          r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
         | 
| 397 | 
            -
                                          @index += 1
         | 
| 398 | 
            -
                                        else
         | 
| 399 | 
            -
                                          terminal_parse_failure('f')
         | 
| 400 | 
            -
                                          r15 = nil
         | 
| 401 | 
            -
                                        end
         | 
| 402 | 
            -
                                        if r15
         | 
| 403 | 
            -
                                          r4 = r15
         | 
| 404 | 
            -
                                        else
         | 
| 405 | 
            -
                                          if has_terminal?('blocks', false, index)
         | 
| 406 | 
            -
                                            r16 = instantiate_node(SyntaxNode,input, index...(index + 6))
         | 
| 407 | 
            -
                                            @index += 6
         | 
| 408 | 
            -
                                          else
         | 
| 409 | 
            -
                                            terminal_parse_failure('blocks')
         | 
| 410 | 
            -
                                            r16 = nil
         | 
| 411 | 
            -
                                          end
         | 
| 412 | 
            -
                                          if r16
         | 
| 413 | 
            -
                                            r4 = r16
         | 
| 414 | 
            -
                                          else
         | 
| 415 | 
            -
                                            if has_terminal?('block', false, index)
         | 
| 416 | 
            -
                                              r17 = instantiate_node(SyntaxNode,input, index...(index + 5))
         | 
| 417 | 
            -
                                              @index += 5
         | 
| 418 | 
            -
                                            else
         | 
| 419 | 
            -
                                              terminal_parse_failure('block')
         | 
| 420 | 
            -
                                              r17 = nil
         | 
| 421 | 
            -
                                            end
         | 
| 422 | 
            -
                                            if r17
         | 
| 423 | 
            -
                                              r4 = r17
         | 
| 424 | 
            -
                                            else
         | 
| 425 | 
            -
                                              @index = i4
         | 
| 426 | 
            -
                                              r4 = nil
         | 
| 427 | 
            -
                                            end
         | 
| 428 | 
            -
                                          end
         | 
| 429 | 
            -
                                        end
         | 
| 430 | 
            -
                                      end
         | 
| 431 | 
            -
                                    end
         | 
| 432 | 
            -
                                  end
         | 
| 433 | 
            -
                                end
         | 
| 434 | 
            -
                              end
         | 
| 435 | 
            -
                            end
         | 
| 436 | 
            -
                          end
         | 
| 437 | 
            -
                        end
         | 
| 438 | 
            -
                      end
         | 
| 439 | 
            -
                    end
         | 
| 440 | 
            -
                    s0 << r4
         | 
| 441 | 
            -
                  end
         | 
| 442 | 
            -
                end
         | 
| 443 | 
            -
                if s0.last
         | 
| 444 | 
            -
                  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
         | 
| 445 | 
            -
                  r0.extend(Distance0)
         | 
| 446 | 
            -
                  r0.extend(Distance1)
         | 
| 447 | 
            -
                else
         | 
| 448 | 
            -
                  @index = i0
         | 
| 449 | 
            -
                  r0 = nil
         | 
| 450 | 
            -
                end
         | 
| 451 | 
            -
             | 
| 452 | 
            -
                node_cache[:distance][start_index] = r0
         | 
| 453 | 
            -
             | 
| 454 | 
            -
                r0
         | 
| 455 | 
            -
              end
         | 
| 456 | 
            -
             | 
| 457 | 
            -
              module Role0
         | 
| 458 | 
            -
                def range
         | 
| 459 | 
            -
                  elements[0]
         | 
| 460 | 
            -
                end
         | 
| 461 | 
            -
             | 
| 462 | 
            -
                def id
         | 
| 463 | 
            -
                  elements[2]
         | 
| 464 | 
            -
                end
         | 
| 465 | 
            -
              end
         | 
| 466 | 
            -
             | 
| 467 | 
            -
              module Role1
         | 
| 468 | 
            -
                def name; id.text_value; end
         | 
| 469 | 
            -
                def min;  range.empty? ? 2 : range.min; end
         | 
| 470 | 
            -
                def max;  range.empty? ? 10000 : range.max; end
         | 
| 471 | 
            -
              end
         | 
| 472 | 
            -
             | 
| 473 | 
            -
              def _nt_role
         | 
| 474 | 
            -
                start_index = index
         | 
| 475 | 
            -
                if node_cache[:role].has_key?(index)
         | 
| 476 | 
            -
                  cached = node_cache[:role][index]
         | 
| 477 | 
            -
                  @index = cached.interval.end if cached
         | 
| 478 | 
            -
                  return cached
         | 
| 479 | 
            -
                end
         | 
| 480 | 
            -
             | 
| 481 | 
            -
                i0, s0 = index, []
         | 
| 482 | 
            -
                r2 = _nt_range
         | 
| 483 | 
            -
                if r2
         | 
| 484 | 
            -
                  r1 = r2
         | 
| 485 | 
            -
                else
         | 
| 486 | 
            -
                  r1 = instantiate_node(SyntaxNode,input, index...index)
         | 
| 487 | 
            -
                end
         | 
| 488 | 
            -
                s0 << r1
         | 
| 489 | 
            -
                if r1
         | 
| 490 | 
            -
                  r4 = _nt_ws
         | 
| 491 | 
            -
                  if r4
         | 
| 492 | 
            -
                    r3 = r4
         | 
| 493 | 
            -
                  else
         | 
| 494 | 
            -
                    r3 = instantiate_node(SyntaxNode,input, index...index)
         | 
| 495 | 
            -
                  end
         | 
| 496 | 
            -
                  s0 << r3
         | 
| 497 | 
            -
                  if r3
         | 
| 498 | 
            -
                    r5 = _nt_id
         | 
| 499 | 
            -
                    s0 << r5
         | 
| 500 | 
            -
                  end
         | 
| 501 | 
            -
                end
         | 
| 502 | 
            -
                if s0.last
         | 
| 503 | 
            -
                  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
         | 
| 504 | 
            -
                  r0.extend(Role0)
         | 
| 505 | 
            -
                  r0.extend(Role1)
         | 
| 506 | 
            -
                else
         | 
| 507 | 
            -
                  @index = i0
         | 
| 508 | 
            -
                  r0 = nil
         | 
| 509 | 
            -
                end
         | 
| 510 | 
            -
             | 
| 511 | 
            -
                node_cache[:role][start_index] = r0
         | 
| 512 | 
            -
             | 
| 513 | 
            -
                r0
         | 
| 514 | 
            -
              end
         | 
| 515 | 
            -
             | 
| 516 | 
            -
              module Range0
         | 
| 517 | 
            -
                def number
         | 
| 518 | 
            -
                  elements[1]
         | 
| 519 | 
            -
                end
         | 
| 520 | 
            -
              end
         | 
| 521 | 
            -
             | 
| 522 | 
            -
              module Range1
         | 
| 523 | 
            -
                def min
         | 
| 524 | 
            -
                  elements[0]
         | 
| 525 | 
            -
                end
         | 
| 526 | 
            -
             | 
| 527 | 
            -
                def max
         | 
| 528 | 
            -
                  elements[1]
         | 
| 529 | 
            -
                end
         | 
| 530 | 
            -
              end
         | 
| 531 | 
            -
             | 
| 532 | 
            -
              module Range2
         | 
| 533 | 
            -
                def min; super.text_value.to_i; end
         | 
| 534 | 
            -
                def max
         | 
| 535 | 
            -
                    return min if super.empty?
         | 
| 536 | 
            -
                    return 10000 if super.text_value == '+'
         | 
| 537 | 
            -
                    return super.number.text_value.to_i
         | 
| 538 | 
            -
                end
         | 
| 539 | 
            -
              end
         | 
| 540 | 
            -
             | 
| 541 | 
            -
              def _nt_range
         | 
| 542 | 
            -
                start_index = index
         | 
| 543 | 
            -
                if node_cache[:range].has_key?(index)
         | 
| 544 | 
            -
                  cached = node_cache[:range][index]
         | 
| 545 | 
            -
                  @index = cached.interval.end if cached
         | 
| 546 | 
            -
                  return cached
         | 
| 547 | 
            -
                end
         | 
| 548 | 
            -
             | 
| 549 | 
            -
                i0, s0 = index, []
         | 
| 550 | 
            -
                r1 = _nt_number
         | 
| 551 | 
            -
                s0 << r1
         | 
| 552 | 
            -
                if r1
         | 
| 553 | 
            -
                  i3 = index
         | 
| 554 | 
            -
                  if has_terminal?('+', false, index)
         | 
| 555 | 
            -
                    r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
         | 
| 556 | 
            -
                    @index += 1
         | 
| 557 | 
            -
                  else
         | 
| 558 | 
            -
                    terminal_parse_failure('+')
         | 
| 559 | 
            -
                    r4 = nil
         | 
| 560 | 
            -
                  end
         | 
| 561 | 
            -
                  if r4
         | 
| 562 | 
            -
                    r3 = r4
         | 
| 563 | 
            -
                  else
         | 
| 564 | 
            -
                    i5, s5 = index, []
         | 
| 565 | 
            -
                    if has_terminal?('-', false, index)
         | 
| 566 | 
            -
                      r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
         | 
| 567 | 
            -
                      @index += 1
         | 
| 568 | 
            -
                    else
         | 
| 569 | 
            -
                      terminal_parse_failure('-')
         | 
| 570 | 
            -
                      r6 = nil
         | 
| 571 | 
            -
                    end
         | 
| 572 | 
            -
                    s5 << r6
         | 
| 573 | 
            -
                    if r6
         | 
| 574 | 
            -
                      r7 = _nt_number
         | 
| 575 | 
            -
                      s5 << r7
         | 
| 576 | 
            -
                    end
         | 
| 577 | 
            -
                    if s5.last
         | 
| 578 | 
            -
                      r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
         | 
| 579 | 
            -
                      r5.extend(Range0)
         | 
| 580 | 
            -
                    else
         | 
| 581 | 
            -
                      @index = i5
         | 
| 582 | 
            -
                      r5 = nil
         | 
| 583 | 
            -
                    end
         | 
| 584 | 
            -
                    if r5
         | 
| 585 | 
            -
                      r3 = r5
         | 
| 586 | 
            -
                    else
         | 
| 587 | 
            -
                      @index = i3
         | 
| 588 | 
            -
                      r3 = nil
         | 
| 589 | 
            -
                    end
         | 
| 590 | 
            -
                  end
         | 
| 591 | 
            -
                  if r3
         | 
| 592 | 
            -
                    r2 = r3
         | 
| 593 | 
            -
                  else
         | 
| 594 | 
            -
                    r2 = instantiate_node(SyntaxNode,input, index...index)
         | 
| 595 | 
            -
                  end
         | 
| 596 | 
            -
                  s0 << r2
         | 
| 597 | 
            -
                end
         | 
| 598 | 
            -
                if s0.last
         | 
| 599 | 
            -
                  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
         | 
| 600 | 
            -
                  r0.extend(Range1)
         | 
| 601 | 
            -
                  r0.extend(Range2)
         | 
| 602 | 
            -
                else
         | 
| 603 | 
            -
                  @index = i0
         | 
| 604 | 
            -
                  r0 = nil
         | 
| 605 | 
            -
                end
         | 
| 606 | 
            -
             | 
| 607 | 
            -
                node_cache[:range][start_index] = r0
         | 
| 608 | 
            -
             | 
| 609 | 
            -
                r0
         | 
| 610 | 
            -
              end
         | 
| 611 | 
            -
             | 
| 612 | 
            -
            end
         | 
| 613 | 
            -
             | 
| 614 | 
            -
            class CastingParser < Treetop::Runtime::CompiledParser
         | 
| 615 | 
            -
              include Casting
         | 
| 616 | 
            -
            end
         | 
| 617 | 
            -
             | 
| 618 | 
            -
            end
         |