# module Treetop::Compiler::Metagrammar

### Public Instance Methods

_nt_alpha_char() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3768
    def _nt_alpha_char
      start_index = index
      if node_cache[:alpha_char].has_key?(index)
        cached = node_cache[:alpha_char][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      if has_terminal?('\G[A-Za-z_]', true, index)
        r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        r0 = nil
      end

      node_cache[:alpha_char][start_index] = r0

      r0
    end

_nt_alphanumeric_char() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3791
    def _nt_alphanumeric_char
      start_index = index
      if node_cache[:alphanumeric_char].has_key?(index)
        cached = node_cache[:alphanumeric_char][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_alpha_char
      if r1
        r0 = r1
      else
        if has_terminal?('\G[0-9]', true, index)
          r2 = true
          @index += 1
        else
          r2 = nil
        end
        if r2
          r0 = r2
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:alphanumeric_char][start_index] = r0

      r0
    end

_nt_alternative() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1348
    def _nt_alternative
      start_index = index
      if node_cache[:alternative].has_key?(index)
        cached = node_cache[:alternative][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_sequence
      if r1
        r0 = r1
      else
        r2 = _nt_primary
        if r2
          r0 = r2
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:alternative][start_index] = r0

      r0
    end

_nt_anything_symbol() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3260
    def _nt_anything_symbol
      start_index = index
      if node_cache[:anything_symbol].has_key?(index)
        cached = node_cache[:anything_symbol][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      if has_terminal?('.', false, index)
        r0 = instantiate_node(AnythingSymbol,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('.')
        r0 = nil
      end

      node_cache[:anything_symbol][start_index] = r0

      r0
    end

_nt_atomic() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2355
    def _nt_atomic
      start_index = index
      if node_cache[:atomic].has_key?(index)
        cached = node_cache[:atomic][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_terminal
      if r1
        r0 = r1
      else
        r2 = _nt_nonterminal
        if r2
          r0 = r2
        else
          r3 = _nt_parenthesized_expression
          if r3
            r0 = r3
          else
            @index = i0
            r0 = nil
          end
        end
      end

      node_cache[:atomic][start_index] = r0

      r0
    end

_nt_bracket_expression() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3053
    def _nt_bracket_expression
      start_index = index
      if node_cache[:bracket_expression].has_key?(index)
        cached = node_cache[:bracket_expression][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('[:', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
        @index += 2
      else
        terminal_parse_failure('[:')
        r1 = nil
      end
      s0 << r1
      if r1
        if has_terminal?('^', false, index)
          r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
          @index += 1
        else
          terminal_parse_failure('^')
          r3 = nil
        end
        if r3
          r2 = r3
        else
          r2 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r2
        if r2
          i4 = index
          if has_terminal?('alnum', false, index)
            r5 = instantiate_node(SyntaxNode,input, index...(index + 5))
            @index += 5
          else
            terminal_parse_failure('alnum')
            r5 = nil
          end
          if r5
            r4 = r5
          else
            if has_terminal?('alpha', false, index)
              r6 = instantiate_node(SyntaxNode,input, index...(index + 5))
              @index += 5
            else
              terminal_parse_failure('alpha')
              r6 = nil
            end
            if r6
              r4 = r6
            else
              if has_terminal?('blank', false, index)
                r7 = instantiate_node(SyntaxNode,input, index...(index + 5))
                @index += 5
              else
                terminal_parse_failure('blank')
                r7 = nil
              end
              if r7
                r4 = r7
              else
                if has_terminal?('cntrl', false, index)
                  r8 = instantiate_node(SyntaxNode,input, index...(index + 5))
                  @index += 5
                else
                  terminal_parse_failure('cntrl')
                  r8 = nil
                end
                if r8
                  r4 = r8
                else
                  if has_terminal?('digit', false, index)
                    r9 = instantiate_node(SyntaxNode,input, index...(index + 5))
                    @index += 5
                  else
                    terminal_parse_failure('digit')
                    r9 = nil
                  end
                  if r9
                    r4 = r9
                  else
                    if has_terminal?('graph', false, index)
                      r10 = instantiate_node(SyntaxNode,input, index...(index + 5))
                      @index += 5
                    else
                      terminal_parse_failure('graph')
                      r10 = nil
                    end
                    if r10
                      r4 = r10
                    else
                      if has_terminal?('lower', false, index)
                        r11 = instantiate_node(SyntaxNode,input, index...(index + 5))
                        @index += 5
                      else
                        terminal_parse_failure('lower')
                        r11 = nil
                      end
                      if r11
                        r4 = r11
                      else
                        if has_terminal?('print', false, index)
                          r12 = instantiate_node(SyntaxNode,input, index...(index + 5))
                          @index += 5
                        else
                          terminal_parse_failure('print')
                          r12 = nil
                        end
                        if r12
                          r4 = r12
                        else
                          if has_terminal?('punct', false, index)
                            r13 = instantiate_node(SyntaxNode,input, index...(index + 5))
                            @index += 5
                          else
                            terminal_parse_failure('punct')
                            r13 = nil
                          end
                          if r13
                            r4 = r13
                          else
                            if has_terminal?('space', false, index)
                              r14 = instantiate_node(SyntaxNode,input, index...(index + 5))
                              @index += 5
                            else
                              terminal_parse_failure('space')
                              r14 = nil
                            end
                            if r14
                              r4 = r14
                            else
                              if has_terminal?('upper', false, index)
                                r15 = instantiate_node(SyntaxNode,input, index...(index + 5))
                                @index += 5
                              else
                                terminal_parse_failure('upper')
                                r15 = nil
                              end
                              if r15
                                r4 = r15
                              else
                                if has_terminal?('xdigit', false, index)
                                  r16 = instantiate_node(SyntaxNode,input, index...(index + 6))
                                  @index += 6
                                else
                                  terminal_parse_failure('xdigit')
                                  r16 = nil
                                end
                                if r16
                                  r4 = r16
                                else
                                  if has_terminal?('word', false, index)
                                    r17 = instantiate_node(SyntaxNode,input, index...(index + 4))
                                    @index += 4
                                  else
                                    terminal_parse_failure('word')
                                    r17 = nil
                                  end
                                  if r17
                                    r4 = r17
                                  else
                                    @index = i4
                                    r4 = nil
                                  end
                                end
                              end
                            end
                          end
                        end
                      end
                    end
                  end
                end
              end
            end
          end
          s0 << r4
          if r4
            if has_terminal?(':]', false, index)
              r18 = instantiate_node(SyntaxNode,input, index...(index + 2))
              @index += 2
            else
              terminal_parse_failure(':]')
              r18 = nil
            end
            s0 << r18
          end
        end
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(BracketExpression0)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:bracket_expression][start_index] = r0

      r0
    end

_nt_character_class() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2888
    def _nt_character_class
      start_index = index
      if node_cache[:character_class].has_key?(index)
        cached = node_cache[:character_class][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('[', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('[')
        r1 = nil
      end
      s0 << r1
      if r1
        s2, i2 = [], index
        loop do
          i3, s3 = index, []
          i4 = index
          if has_terminal?(']', false, index)
            r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure(']')
            r5 = nil
          end
          if r5
            r4 = nil
          else
            @index = i4
            r4 = instantiate_node(SyntaxNode,input, index...index)
          end
          s3 << r4
          if r4
            i6 = index
            i7, s7 = index, []
            if has_terminal?('\', false, index)
              r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
              @index += 1
            else
              terminal_parse_failure('\')
              r8 = nil
            end
            s7 << r8
            if r8
              if index < input_length
                r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
                @index += 1
              else
                terminal_parse_failure("any character")
                r9 = nil
              end
              s7 << r9
            end
            if s7.last
              r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
              r7.extend(CharacterClass0)
            else
              @index = i7
              r7 = nil
            end
            if r7
              r6 = r7
            else
              r10 = _nt_bracket_expression
              if r10
                r6 = r10
              else
                i11, s11 = index, []
                i12 = index
                if has_terminal?('\', false, index)
                  r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
                  @index += 1
                else
                  terminal_parse_failure('\')
                  r13 = nil
                end
                if r13
                  r12 = nil
                else
                  @index = i12
                  r12 = instantiate_node(SyntaxNode,input, index...index)
                end
                s11 << r12
                if r12
                  if index < input_length
                    r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
                    @index += 1
                  else
                    terminal_parse_failure("any character")
                    r14 = nil
                  end
                  s11 << r14
                end
                if s11.last
                  r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
                  r11.extend(CharacterClass1)
                else
                  @index = i11
                  r11 = nil
                end
                if r11
                  r6 = r11
                else
                  @index = i6
                  r6 = nil
                end
              end
            end
            s3 << r6
          end
          if s3.last
            r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
            r3.extend(CharacterClass2)
          else
            @index = i3
            r3 = nil
          end
          if r3
            s2 << r3
          else
            break
          end
        end
        if s2.empty?
          @index = i2
          r2 = nil
        else
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
        end
        s0 << r2
        if r2
          if has_terminal?(']', false, index)
            r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure(']')
            r15 = nil
          end
          s0 << r15
        end
      end
      if s0.last
        r0 = instantiate_node(CharacterClass,input, i0...index, s0)
        r0.extend(CharacterClass3)
        r0.extend(CharacterClass4)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:character_class][start_index] = r0

      r0
    end

_nt_choice() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1059
    def _nt_choice
      start_index = index
      if node_cache[:choice].has_key?(index)
        cached = node_cache[:choice][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      r1 = _nt_alternative
      s0 << r1
      if r1
        s2, i2 = [], index
        loop do
          i3, s3 = index, []
          r5 = _nt_space
          if r5
            r4 = r5
          else
            r4 = instantiate_node(SyntaxNode,input, index...index)
          end
          s3 << r4
          if r4
            if has_terminal?('/', false, index)
              r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
              @index += 1
            else
              terminal_parse_failure('/')
              r6 = nil
            end
            s3 << r6
            if r6
              r8 = _nt_space
              if r8
                r7 = r8
              else
                r7 = instantiate_node(SyntaxNode,input, index...index)
              end
              s3 << r7
              if r7
                r9 = _nt_alternative
                s3 << r9
              end
            end
          end
          if s3.last
            r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
            r3.extend(Choice0)
          else
            @index = i3
            r3 = nil
          end
          if r3
            s2 << r3
          else
            break
          end
        end
        if s2.empty?
          @index = i2
          r2 = nil
        else
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
        end
        s0 << r2
      end
      if s0.last
        r0 = instantiate_node(Choice,input, i0...index, s0)
        r0.extend(Choice1)
        r0.extend(Choice2)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:choice][start_index] = r0

      r0
    end

_nt_comment_to_eol() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3876
    def _nt_comment_to_eol
      start_index = index
      if node_cache[:comment_to_eol].has_key?(index)
        cached = node_cache[:comment_to_eol][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('#', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('#')
        r1 = nil
      end
      s0 << r1
      if r1
        s2, i2 = [], index
        loop do
          i3, s3 = index, []
          i4 = index
          if has_terminal?("\n", false, index)
            r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure("\n")
            r5 = nil
          end
          if r5
            r4 = nil
          else
            @index = i4
            r4 = instantiate_node(SyntaxNode,input, index...index)
          end
          s3 << r4
          if r4
            if index < input_length
              r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
              @index += 1
            else
              terminal_parse_failure("any character")
              r6 = nil
            end
            s3 << r6
          end
          if s3.last
            r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
            r3.extend(CommentToEol0)
          else
            @index = i3
            r3 = nil
          end
          if r3
            s2 << r3
          else
            break
          end
        end
        r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
        s0 << r2
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(CommentToEol1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:comment_to_eol][start_index] = r0

      r0
    end

_nt_declaration() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 753
    def _nt_declaration
      start_index = index
      if node_cache[:declaration].has_key?(index)
        cached = node_cache[:declaration][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_parsing_rule
      if r1
        r0 = r1
      else
        r2 = _nt_include_declaration
        if r2
          r0 = r2
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:declaration][start_index] = r0

      r0
    end

_nt_declaration_sequence() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 680
    def _nt_declaration_sequence
      start_index = index
      if node_cache[:declaration_sequence].has_key?(index)
        cached = node_cache[:declaration_sequence][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      i1, s1 = index, []
      r2 = _nt_declaration
      s1 << r2
      if r2
        s3, i3 = [], index
        loop do
          i4, s4 = index, []
          r5 = _nt_space
          s4 << r5
          if r5
            r6 = _nt_declaration
            s4 << r6
          end
          if s4.last
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
            r4.extend(DeclarationSequence0)
          else
            @index = i4
            r4 = nil
          end
          if r4
            s3 << r4
          else
            break
          end
        end
        r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
        s1 << r3
      end
      if s1.last
        r1 = instantiate_node(DeclarationSequence,input, i1...index, s1)
        r1.extend(DeclarationSequence1)
        r1.extend(DeclarationSequence2)
      else
        @index = i1
        r1 = nil
      end
      if r1
        r0 = r1
      else
        if has_terminal?('', false, index)
          r7 = instantiate_node(SyntaxNode,input, index...(index + 0))
          r7.extend(DeclarationSequence3)
          @index += 0
        else
          terminal_parse_failure('')
          r7 = nil
        end
        if r7
          r0 = r7
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:declaration_sequence][start_index] = r0

      r0
    end

_nt_double_quoted_string() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2622
    def _nt_double_quoted_string
      start_index = index
      if node_cache[:double_quoted_string].has_key?(index)
        cached = node_cache[:double_quoted_string][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('"', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('"')
        r1 = nil
      end
      s0 << r1
      if r1
        s2, i2 = [], index
        loop do
          i3, s3 = index, []
          i4 = index
          if has_terminal?('"', false, index)
            r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure('"')
            r5 = nil
          end
          if r5
            r4 = nil
          else
            @index = i4
            r4 = instantiate_node(SyntaxNode,input, index...index)
          end
          s3 << r4
          if r4
            i6 = index
            if has_terminal?("\\\\", false, index)
              r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
              @index += 2
            else
              terminal_parse_failure("\\\\")
              r7 = nil
            end
            if r7
              r6 = r7
            else
              if has_terminal?('\"', false, index)
                r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
                @index += 2
              else
                terminal_parse_failure('\"')
                r8 = nil
              end
              if r8
                r6 = r8
              else
                if index < input_length
                  r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
                  @index += 1
                else
                  terminal_parse_failure("any character")
                  r9 = nil
                end
                if r9
                  r6 = r9
                else
                  @index = i6
                  r6 = nil
                end
              end
            end
            s3 << r6
          end
          if s3.last
            r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
            r3.extend(DoubleQuotedString0)
          else
            @index = i3
            r3 = nil
          end
          if r3
            s2 << r3
          else
            break
          end
        end
        r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
        s0 << r2
        if r2
          if has_terminal?('"', false, index)
            r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure('"')
            r10 = nil
          end
          s0 << r10
        end
      end
      if s0.last
        r0 = instantiate_node(Terminal,input, i0...index, s0)
        r0.extend(DoubleQuotedString1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:double_quoted_string][start_index] = r0

      r0
    end

_nt_grammar() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 501
    def _nt_grammar
      start_index = index
      if node_cache[:grammar].has_key?(index)
        cached = node_cache[:grammar][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('grammar', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
        @index += 7
      else
        terminal_parse_failure('grammar')
        r1 = nil
      end
      s0 << r1
      if r1
        r2 = _nt_space
        s0 << r2
        if r2
          r3 = _nt_grammar_name
          s0 << r3
          if r3
            r4 = _nt_space
            s0 << r4
            if r4
              i6, s6 = index, []
              if has_terminal?('do', false, index)
                r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
                @index += 2
              else
                terminal_parse_failure('do')
                r7 = nil
              end
              s6 << r7
              if r7
                r8 = _nt_space
                s6 << r8
              end
              if s6.last
                r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
                r6.extend(Grammar0)
              else
                @index = i6
                r6 = nil
              end
              if r6
                r5 = r6
              else
                r5 = instantiate_node(SyntaxNode,input, index...index)
              end
              s0 << r5
              if r5
                r9 = _nt_declaration_sequence
                s0 << r9
                if r9
                  r11 = _nt_space
                  if r11
                    r10 = r11
                  else
                    r10 = instantiate_node(SyntaxNode,input, index...index)
                  end
                  s0 << r10
                  if r10
                    if has_terminal?('end', false, index)
                      r12 = instantiate_node(SyntaxNode,input, index...(index + 3))
                      @index += 3
                    else
                      terminal_parse_failure('end')
                      r12 = nil
                    end
                    s0 << r12
                  end
                end
              end
            end
          end
        end
      end
      if s0.last
        r0 = instantiate_node(Grammar,input, i0...index, s0)
        r0.extend(Grammar1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:grammar][start_index] = r0

      r0
    end

_nt_grammar_name() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 600
    def _nt_grammar_name
      start_index = index
      if node_cache[:grammar_name].has_key?(index)
        cached = node_cache[:grammar_name][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('\G[A-Z]', true, index)
        r1 = true
        @index += 1
      else
        r1 = nil
      end
      s0 << r1
      if r1
        s2, i2 = [], index
        loop do
          r3 = _nt_alphanumeric_char
          if r3
            s2 << r3
          else
            break
          end
        end
        r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
        s0 << r2
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(GrammarName0)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:grammar_name][start_index] = r0

      r0
    end

_nt_include_declaration() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 796
    def _nt_include_declaration
      start_index = index
      if node_cache[:include_declaration].has_key?(index)
        cached = node_cache[:include_declaration][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('include', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
        @index += 7
      else
        terminal_parse_failure('include')
        r1 = nil
      end
      s0 << r1
      if r1
        r2 = _nt_space
        s0 << r2
        if r2
          if has_terminal?('\G[A-Z]', true, index)
            r3 = true
            @index += 1
          else
            r3 = nil
          end
          s0 << r3
          if r3
            s4, i4 = [], index
            loop do
              i5 = index
              r6 = _nt_alphanumeric_char
              if r6
                r5 = r6
              else
                if has_terminal?('::', false, index)
                  r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
                  @index += 2
                else
                  terminal_parse_failure('::')
                  r7 = nil
                end
                if r7
                  r5 = r7
                else
                  @index = i5
                  r5 = nil
                end
              end
              if r5
                s4 << r5
              else
                break
              end
            end
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
            s0 << r4
          end
        end
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(IncludeDeclaration0)
        r0.extend(IncludeDeclaration1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:include_declaration][start_index] = r0

      r0
    end

_nt_inline_module() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3557
    def _nt_inline_module
      start_index = index
      if node_cache[:inline_module].has_key?(index)
        cached = node_cache[:inline_module][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('{', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('{')
        r1 = nil
      end
      s0 << r1
      if r1
        s2, i2 = [], index
        loop do
          i3 = index
          r4 = _nt_inline_module
          if r4
            r3 = r4
          else
            i5, s5 = index, []
            i6 = index
            if has_terminal?('\G[{}]', true, index)
              r7 = true
              @index += 1
            else
              r7 = nil
            end
            if r7
              r6 = nil
            else
              @index = i6
              r6 = instantiate_node(SyntaxNode,input, index...index)
            end
            s5 << r6
            if r6
              if index < input_length
                r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
                @index += 1
              else
                terminal_parse_failure("any character")
                r8 = nil
              end
              s5 << r8
            end
            if s5.last
              r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
              r5.extend(InlineModule0)
            else
              @index = i5
              r5 = nil
            end
            if r5
              r3 = r5
            else
              @index = i3
              r3 = nil
            end
          end
          if r3
            s2 << r3
          else
            break
          end
        end
        r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
        s0 << r2
        if r2
          if has_terminal?('}', false, index)
            r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure('}')
            r9 = nil
          end
          s0 << r9
        end
      end
      if s0.last
        r0 = instantiate_node(InlineModule,input, i0...index, s0)
        r0.extend(InlineModule1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:inline_module][start_index] = r0

      r0
    end

_nt_keyword_inside_grammar() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3659
    def _nt_keyword_inside_grammar
      start_index = index
      if node_cache[:keyword_inside_grammar].has_key?(index)
        cached = node_cache[:keyword_inside_grammar][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      i1 = index
      if has_terminal?('rule', false, index)
        r2 = instantiate_node(SyntaxNode,input, index...(index + 4))
        @index += 4
      else
        terminal_parse_failure('rule')
        r2 = nil
      end
      if r2
        r1 = r2
      else
        if has_terminal?('end', false, index)
          r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
          @index += 3
        else
          terminal_parse_failure('end')
          r3 = nil
        end
        if r3
          r1 = r3
        else
          @index = i1
          r1 = nil
        end
      end
      s0 << r1
      if r1
        i4 = index
        r5 = _nt_non_space_char
        if r5
          r4 = nil
        else
          @index = i4
          r4 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r4
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(KeywordInsideGrammar0)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:keyword_inside_grammar][start_index] = r0

      r0
    end

_nt_label() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1747
    def _nt_label
      start_index = index
      if node_cache[:label].has_key?(index)
        cached = node_cache[:label][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_named_label
      if r1
        r0 = r1
      else
        r2 = _nt_null_label
        if r2
          r0 = r2
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:label][start_index] = r0

      r0
    end

_nt_labeled_expression_sequence_body() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1329
    def _nt_labeled_expression_sequence_body
      start_index = index
      if node_cache[:labeled_expression_sequence_body].has_key?(index)
        cached = node_cache[:labeled_expression_sequence_body][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      r0 = _nt_labeled_sequence_primary
      r0.extend(LabeledExpressionSequenceBody0)

      node_cache[:labeled_expression_sequence_body][start_index] = r0

      r0
    end

_nt_labeled_sequence_primary() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1655
    def _nt_labeled_sequence_primary
      start_index = index
      if node_cache[:labeled_sequence_primary].has_key?(index)
        cached = node_cache[:labeled_sequence_primary][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      r1 = _nt_named_label
      s0 << r1
      if r1
        r2 = _nt_sequence_primary
        s0 << r2
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(LabeledSequencePrimary0)
        r0.extend(LabeledSequencePrimary1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:labeled_sequence_primary][start_index] = r0

      r0
    end

_nt_module_declaration() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 305
    def _nt_module_declaration
      start_index = index
      if node_cache[:module_declaration].has_key?(index)
        cached = node_cache[:module_declaration][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      i1, s1 = index, []
      if has_terminal?('module', false, index)
        r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
        @index += 6
      else
        terminal_parse_failure('module')
        r2 = nil
      end
      s1 << r2
      if r2
        r3 = _nt_space
        s1 << r3
        if r3
          i4, s4 = index, []
          if has_terminal?('\G[A-Z]', true, index)
            r5 = true
            @index += 1
          else
            r5 = nil
          end
          s4 << r5
          if r5
            s6, i6 = [], index
            loop do
              r7 = _nt_alphanumeric_char
              if r7
                s6 << r7
              else
                break
              end
            end
            r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
            s4 << r6
            if r6
              s8, i8 = [], index
              loop do
                i9, s9 = index, []
                if has_terminal?('::', false, index)
                  r10 = instantiate_node(SyntaxNode,input, index...(index + 2))
                  @index += 2
                else
                  terminal_parse_failure('::')
                  r10 = nil
                end
                s9 << r10
                if r10
                  if has_terminal?('\G[A-Z]', true, index)
                    r11 = true
                    @index += 1
                  else
                    r11 = nil
                  end
                  s9 << r11
                  if r11
                    s12, i12 = [], index
                    loop do
                      r13 = _nt_alphanumeric_char
                      if r13
                        s12 << r13
                      else
                        break
                      end
                    end
                    r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
                    s9 << r12
                  end
                end
                if s9.last
                  r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
                  r9.extend(ModuleDeclaration0)
                else
                  @index = i9
                  r9 = nil
                end
                if r9
                  s8 << r9
                else
                  break
                end
              end
              r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
              s4 << r8
            end
          end
          if s4.last
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
            r4.extend(ModuleDeclaration1)
          else
            @index = i4
            r4 = nil
          end
          s1 << r4
          if r4
            r14 = _nt_space
            s1 << r14
          end
        end
      end
      if s1.last
        r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
        r1.extend(ModuleDeclaration2)
      else
        @index = i1
        r1 = nil
      end
      s0 << r1
      if r1
        i15 = index
        r16 = _nt_module_declaration
        if r16
          r15 = r16
        else
          r17 = _nt_grammar
          if r17
            r15 = r17
          else
            @index = i15
            r15 = nil
          end
        end
        s0 << r15
        if r15
          i18, s18 = index, []
          r19 = _nt_space
          s18 << r19
          if r19
            if has_terminal?('end', false, index)
              r20 = instantiate_node(SyntaxNode,input, index...(index + 3))
              @index += 3
            else
              terminal_parse_failure('end')
              r20 = nil
            end
            s18 << r20
          end
          if s18.last
            r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
            r18.extend(ModuleDeclaration3)
          else
            @index = i18
            r18 = nil
          end
          s0 << r18
        end
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(ModuleDeclaration4)
        r0.extend(ModuleDeclaration5)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:module_declaration][start_index] = r0

      r0
    end

_nt_module_or_grammar() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 224
    def _nt_module_or_grammar
      start_index = index
      if node_cache[:module_or_grammar].has_key?(index)
        cached = node_cache[:module_or_grammar][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_module_declaration
      if r1
        r0 = r1
      else
        r2 = _nt_grammar
        if r2
          r0 = r2
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:module_or_grammar][start_index] = r0

      r0
    end

_nt_named_label() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1793
    def _nt_named_label
      start_index = index
      if node_cache[:named_label].has_key?(index)
        cached = node_cache[:named_label][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      i1, s1 = index, []
      r2 = _nt_alpha_char
      s1 << r2
      if r2
        s3, i3 = [], index
        loop do
          r4 = _nt_alphanumeric_char
          if r4
            s3 << r4
          else
            break
          end
        end
        r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
        s1 << r3
      end
      if s1.last
        r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
        r1.extend(NamedLabel0)
      else
        @index = i1
        r1 = nil
      end
      s0 << r1
      if r1
        if has_terminal?(':', false, index)
          r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
          @index += 1
        else
          terminal_parse_failure(':')
          r5 = nil
        end
        s0 << r5
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(NamedLabel1)
        r0.extend(NamedLabel2)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:named_label][start_index] = r0

      r0
    end

_nt_node_class_declarations() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2135
    def _nt_node_class_declarations
      start_index = index
      if node_cache[:node_class_declarations].has_key?(index)
        cached = node_cache[:node_class_declarations][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      r1 = _nt_node_class_expression
      s0 << r1
      if r1
        r2 = _nt_trailing_inline_module
        s0 << r2
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(NodeClassDeclarations0)
        r0.extend(NodeClassDeclarations1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:node_class_declarations][start_index] = r0

      r0
    end

_nt_node_class_expression() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3306
    def _nt_node_class_expression
      start_index = index
      if node_cache[:node_class_expression].has_key?(index)
        cached = node_cache[:node_class_expression][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      i1, s1 = index, []
      r2 = _nt_space
      s1 << r2
      if r2
        if has_terminal?('<', false, index)
          r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
          @index += 1
        else
          terminal_parse_failure('<')
          r3 = nil
        end
        s1 << r3
        if r3
          s4, i4 = [], index
          loop do
            i5, s5 = index, []
            i6 = index
            if has_terminal?('>', false, index)
              r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
              @index += 1
            else
              terminal_parse_failure('>')
              r7 = nil
            end
            if r7
              r6 = nil
            else
              @index = i6
              r6 = instantiate_node(SyntaxNode,input, index...index)
            end
            s5 << r6
            if r6
              if index < input_length
                r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
                @index += 1
              else
                terminal_parse_failure("any character")
                r8 = nil
              end
              s5 << r8
            end
            if s5.last
              r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
              r5.extend(NodeClassExpression0)
            else
              @index = i5
              r5 = nil
            end
            if r5
              s4 << r5
            else
              break
            end
          end
          if s4.empty?
            @index = i4
            r4 = nil
          else
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
          end
          s1 << r4
          if r4
            if has_terminal?('>', false, index)
              r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
              @index += 1
            else
              terminal_parse_failure('>')
              r9 = nil
            end
            s1 << r9
          end
        end
      end
      if s1.last
        r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
        r1.extend(NodeClassExpression1)
        r1.extend(NodeClassExpression2)
      else
        @index = i1
        r1 = nil
      end
      if r1
        r0 = r1
      else
        if has_terminal?('', false, index)
          r10 = instantiate_node(SyntaxNode,input, index...(index + 0))
          r10.extend(NodeClassExpression3)
          @index += 0
        else
          terminal_parse_failure('')
          r10 = nil
        end
        if r10
          r0 = r10
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:node_class_expression][start_index] = r0

      r0
    end

_nt_non_space_char() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3724
    def _nt_non_space_char
      start_index = index
      if node_cache[:non_space_char].has_key?(index)
        cached = node_cache[:non_space_char][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      i1 = index
      r2 = _nt_space
      if r2
        r1 = nil
      else
        @index = i1
        r1 = instantiate_node(SyntaxNode,input, index...index)
      end
      s0 << r1
      if r1
        if index < input_length
          r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
          @index += 1
        else
          terminal_parse_failure("any character")
          r3 = nil
        end
        s0 << r3
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(NonSpaceChar0)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:non_space_char][start_index] = r0

      r0
    end

_nt_nonterminal() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2479
    def _nt_nonterminal
      start_index = index
      if node_cache[:nonterminal].has_key?(index)
        cached = node_cache[:nonterminal][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      i1 = index
      r2 = _nt_keyword_inside_grammar
      if r2
        r1 = nil
      else
        @index = i1
        r1 = instantiate_node(SyntaxNode,input, index...index)
      end
      s0 << r1
      if r1
        i3, s3 = index, []
        r4 = _nt_alpha_char
        s3 << r4
        if r4
          s5, i5 = [], index
          loop do
            r6 = _nt_alphanumeric_char
            if r6
              s5 << r6
            else
              break
            end
          end
          r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
          s3 << r5
        end
        if s3.last
          r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
          r3.extend(Nonterminal0)
        else
          @index = i3
          r3 = nil
        end
        s0 << r3
      end
      if s0.last
        r0 = instantiate_node(Nonterminal,input, i0...index, s0)
        r0.extend(Nonterminal1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:nonterminal][start_index] = r0

      r0
    end

_nt_null_label() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1859
    def _nt_null_label
      start_index = index
      if node_cache[:null_label].has_key?(index)
        cached = node_cache[:null_label][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      if has_terminal?('', false, index)
        r0 = instantiate_node(SyntaxNode,input, index...(index + 0))
        r0.extend(NullLabel0)
        @index += 0
      else
        terminal_parse_failure('')
        r0 = nil
      end

      node_cache[:null_label][start_index] = r0

      r0
    end

_nt_occurrence_range() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2224
    def _nt_occurrence_range
      start_index = index
      if node_cache[:occurrence_range].has_key?(index)
        cached = node_cache[:occurrence_range][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      r2 = _nt_space
      if r2
        r1 = r2
      else
        r1 = instantiate_node(SyntaxNode,input, index...index)
      end
      s0 << r1
      if r1
        s3, i3 = [], index
        loop do
          if has_terminal?('\G[0-9]', true, index)
            r4 = true
            @index += 1
          else
            r4 = nil
          end
          if r4
            s3 << r4
          else
            break
          end
        end
        r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
        s0 << r3
        if r3
          if has_terminal?('..', false, index)
            r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
            @index += 2
          else
            terminal_parse_failure('..')
            r5 = nil
          end
          s0 << r5
          if r5
            s6, i6 = [], index
            loop do
              if has_terminal?('\G[0-9]', true, index)
                r7 = true
                @index += 1
              else
                r7 = nil
              end
              if r7
                s6 << r7
              else
                break
              end
            end
            r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
            s0 << r6
          end
        end
      end
      if s0.last
        r0 = instantiate_node(OccurrenceRange,input, i0...index, s0)
        r0.extend(OccurrenceRange0)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:occurrence_range][start_index] = r0

      r0
    end

_nt_optional_suffix() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2083
    def _nt_optional_suffix
      start_index = index
      if node_cache[:optional_suffix].has_key?(index)
        cached = node_cache[:optional_suffix][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      if has_terminal?('?', false, index)
        r0 = instantiate_node(Optional,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('?')
        r0 = nil
      end

      node_cache[:optional_suffix][start_index] = r0

      r0
    end

_nt_optionally_labeled_sequence_primary() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1601
    def _nt_optionally_labeled_sequence_primary
      start_index = index
      if node_cache[:optionally_labeled_sequence_primary].has_key?(index)
        cached = node_cache[:optionally_labeled_sequence_primary][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_labeled_sequence_primary
      if r1
        r0 = r1
      else
        r2 = _nt_unlabeled_sequence_primary
        if r2
          r0 = r2
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:optionally_labeled_sequence_primary][start_index] = r0

      r0
    end

_nt_parenthesized_expression() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2403
    def _nt_parenthesized_expression
      start_index = index
      if node_cache[:parenthesized_expression].has_key?(index)
        cached = node_cache[:parenthesized_expression][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('(', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('(')
        r1 = nil
      end
      s0 << r1
      if r1
        r3 = _nt_space
        if r3
          r2 = r3
        else
          r2 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r2
        if r2
          r4 = _nt_parsing_expression
          s0 << r4
          if r4
            r6 = _nt_space
            if r6
              r5 = r6
            else
              r5 = instantiate_node(SyntaxNode,input, index...index)
            end
            s0 << r5
            if r5
              if has_terminal?(')', false, index)
                r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
                @index += 1
              else
                terminal_parse_failure(')')
                r7 = nil
              end
              s0 << r7
            end
          end
        end
      end
      if s0.last
        r0 = instantiate_node(ParenthesizedExpression,input, i0...index, s0)
        r0.extend(ParenthesizedExpression0)
        r0.extend(ParenthesizedExpression1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:parenthesized_expression][start_index] = r0

      r0
    end

_nt_parsing_expression() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 994
    def _nt_parsing_expression
      start_index = index
      if node_cache[:parsing_expression].has_key?(index)
        cached = node_cache[:parsing_expression][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_choice
      if r1
        r0 = r1
      else
        r2 = _nt_sequence
        if r2
          r0 = r2
        else
          r3 = _nt_primary
          if r3
            r0 = r3
          else
            @index = i0
            r0 = nil
          end
        end
      end

      node_cache[:parsing_expression][start_index] = r0

      r0
    end

_nt_parsing_rule() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 903
    def _nt_parsing_rule
      start_index = index
      if node_cache[:parsing_rule].has_key?(index)
        cached = node_cache[:parsing_rule][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('rule', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
        @index += 4
      else
        terminal_parse_failure('rule')
        r1 = nil
      end
      s0 << r1
      if r1
        r2 = _nt_space
        s0 << r2
        if r2
          r3 = _nt_nonterminal
          s0 << r3
          if r3
            r4 = _nt_space
            s0 << r4
            if r4
              i6, s6 = index, []
              if has_terminal?('do', false, index)
                r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
                @index += 2
              else
                terminal_parse_failure('do')
                r7 = nil
              end
              s6 << r7
              if r7
                r8 = _nt_space
                s6 << r8
              end
              if s6.last
                r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
                r6.extend(ParsingRule0)
              else
                @index = i6
                r6 = nil
              end
              if r6
                r5 = r6
              else
                r5 = instantiate_node(SyntaxNode,input, index...index)
              end
              s0 << r5
              if r5
                r9 = _nt_parsing_expression
                s0 << r9
                if r9
                  r10 = _nt_space
                  s0 << r10
                  if r10
                    if has_terminal?('end', false, index)
                      r11 = instantiate_node(SyntaxNode,input, index...(index + 3))
                      @index += 3
                    else
                      terminal_parse_failure('end')
                      r11 = nil
                    end
                    s0 << r11
                  end
                end
              end
            end
          end
        end
      end
      if s0.last
        r0 = instantiate_node(ParsingRule,input, i0...index, s0)
        r0.extend(ParsingRule1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:parsing_rule][start_index] = r0

      r0
    end

_nt_predicate_block() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3514
    def _nt_predicate_block
      start_index = index
      if node_cache[:predicate_block].has_key?(index)
        cached = node_cache[:predicate_block][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?('', false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 0))
        @index += 0
      else
        terminal_parse_failure('')
        r1 = nil
      end
      s0 << r1
      if r1
        r2 = _nt_inline_module
        s0 << r2
      end
      if s0.last
        r0 = instantiate_node(PredicateBlock,input, i0...index, s0)
        r0.extend(PredicateBlock0)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:predicate_block][start_index] = r0

      r0
    end

_nt_prefix() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2302
    def _nt_prefix
      start_index = index
      if node_cache[:prefix].has_key?(index)
        cached = node_cache[:prefix][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      if has_terminal?('&', false, index)
        r1 = instantiate_node(AndPredicate,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('&')
        r1 = nil
      end
      if r1
        r0 = r1
      else
        if has_terminal?('!', false, index)
          r2 = instantiate_node(NotPredicate,input, index...(index + 1))
          @index += 1
        else
          terminal_parse_failure('!')
          r2 = nil
        end
        if r2
          r0 = r2
        else
          if has_terminal?('~', false, index)
            r3 = instantiate_node(TransientPrefix,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure('~')
            r3 = nil
          end
          if r3
            r0 = r3
          else
            @index = i0
            r0 = nil
          end
        end
      end

      node_cache[:prefix][start_index] = r0

      r0
    end

_nt_primary() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1492
    def _nt_primary
      start_index = index
      if node_cache[:primary].has_key?(index)
        cached = node_cache[:primary][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      i1, s1 = index, []
      r2 = _nt_prefix
      s1 << r2
      if r2
        r3 = _nt_atomic
        s1 << r3
      end
      if s1.last
        r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
        r1.extend(Primary0)
        r1.extend(Primary1)
      else
        @index = i1
        r1 = nil
      end
      if r1
        r0 = r1
      else
        i4, s4 = index, []
        r5 = _nt_prefix
        s4 << r5
        if r5
          r7 = _nt_space
          if r7
            r6 = r7
          else
            r6 = instantiate_node(SyntaxNode,input, index...index)
          end
          s4 << r6
          if r6
            r8 = _nt_predicate_block
            s4 << r8
          end
        end
        if s4.last
          r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
          r4.extend(Primary2)
          r4.extend(Primary3)
        else
          @index = i4
          r4 = nil
        end
        if r4
          r0 = r4
        else
          i9, s9 = index, []
          r10 = _nt_atomic
          s9 << r10
          if r10
            r11 = _nt_suffix
            s9 << r11
            if r11
              r12 = _nt_node_class_declarations
              s9 << r12
            end
          end
          if s9.last
            r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
            r9.extend(Primary4)
            r9.extend(Primary5)
          else
            @index = i9
            r9 = nil
          end
          if r9
            r0 = r9
          else
            i13, s13 = index, []
            r14 = _nt_atomic
            s13 << r14
            if r14
              r15 = _nt_node_class_declarations
              s13 << r15
            end
            if s13.last
              r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
              r13.extend(Primary6)
              r13.extend(Primary7)
            else
              @index = i13
              r13 = nil
            end
            if r13
              r0 = r13
            else
              @index = i0
              r0 = nil
            end
          end
        end
      end

      node_cache[:primary][start_index] = r0

      r0
    end

_nt_quoted_string() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2580
    def _nt_quoted_string
      start_index = index
      if node_cache[:quoted_string].has_key?(index)
        cached = node_cache[:quoted_string][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_single_quoted_string
      if r1
        r0 = r1
        r0.extend(QuotedString0)
      else
        r2 = _nt_double_quoted_string
        if r2
          r0 = r2
          r0.extend(QuotedString0)
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:quoted_string][start_index] = r0

      r0
    end

_nt_repetition_suffix() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2167
    def _nt_repetition_suffix
      start_index = index
      if node_cache[:repetition_suffix].has_key?(index)
        cached = node_cache[:repetition_suffix][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      if has_terminal?('+', false, index)
        r1 = instantiate_node(OneOrMore,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure('+')
        r1 = nil
      end
      if r1
        r0 = r1
      else
        if has_terminal?('*', false, index)
          r2 = instantiate_node(ZeroOrMore,input, index...(index + 1))
          @index += 1
        else
          terminal_parse_failure('*')
          r2 = nil
        end
        if r2
          r0 = r2
        else
          r3 = _nt_occurrence_range
          if r3
            r0 = r3
          else
            @index = i0
            r0 = nil
          end
        end
      end

      node_cache[:repetition_suffix][start_index] = r0

      r0
    end

_nt_require_statement() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 127
    def _nt_require_statement
      start_index = index
      if node_cache[:require_statement].has_key?(index)
        cached = node_cache[:require_statement][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      r2 = _nt_space
      if r2
        r1 = r2
      else
        r1 = instantiate_node(SyntaxNode,input, index...index)
      end
      s0 << r1
      if r1
        if has_terminal?("require", false, index)
          r3 = instantiate_node(SyntaxNode,input, index...(index + 7))
          @index += 7
        else
          terminal_parse_failure("require")
          r3 = nil
        end
        s0 << r3
        if r3
          s4, i4 = [], index
          loop do
            if has_terminal?('\G[ \t]', true, index)
              r5 = true
              @index += 1
            else
              r5 = nil
            end
            if r5
              s4 << r5
            else
              break
            end
          end
          if s4.empty?
            @index = i4
            r4 = nil
          else
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
          end
          s0 << r4
          if r4
            s6, i6 = [], index
            loop do
              if has_terminal?('\G[^\n\r]', true, index)
                r7 = true
                @index += 1
              else
                r7 = nil
              end
              if r7
                s6 << r7
              else
                break
              end
            end
            if s6.empty?
              @index = i6
              r6 = nil
            else
              r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
            end
            s0 << r6
            if r6
              if has_terminal?('\G[\n\r]', true, index)
                r8 = true
                @index += 1
              else
                r8 = nil
              end
              s0 << r8
            end
          end
        end
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(RequireStatement0)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:require_statement][start_index] = r0

      r0
    end

_nt_sequence() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1172
    def _nt_sequence
      start_index = index
      if node_cache[:sequence].has_key?(index)
        cached = node_cache[:sequence][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      r1 = _nt_sequence_body
      s0 << r1
      if r1
        r2 = _nt_node_class_declarations
        s0 << r2
      end
      if s0.last
        r0 = instantiate_node(Sequence,input, i0...index, s0)
        r0.extend(Sequence0)
        r0.extend(Sequence1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:sequence][start_index] = r0

      r0
    end

_nt_sequence_body() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1204
    def _nt_sequence_body
      start_index = index
      if node_cache[:sequence_body].has_key?(index)
        cached = node_cache[:sequence_body][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_variable_length_sequence_body
      if r1
        r0 = r1
      else
        r2 = _nt_labeled_expression_sequence_body
        if r2
          r0 = r2
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:sequence_body][start_index] = r0

      r0
    end

_nt_sequence_primary() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1962
    def _nt_sequence_primary
      start_index = index
      if node_cache[:sequence_primary].has_key?(index)
        cached = node_cache[:sequence_primary][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      i1, s1 = index, []
      r2 = _nt_prefix
      s1 << r2
      if r2
        r3 = _nt_atomic
        s1 << r3
      end
      if s1.last
        r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
        r1.extend(SequencePrimary0)
        r1.extend(SequencePrimary1)
      else
        @index = i1
        r1 = nil
      end
      if r1
        r0 = r1
      else
        i4, s4 = index, []
        r5 = _nt_prefix
        s4 << r5
        if r5
          r7 = _nt_space
          if r7
            r6 = r7
          else
            r6 = instantiate_node(SyntaxNode,input, index...index)
          end
          s4 << r6
          if r6
            r8 = _nt_predicate_block
            s4 << r8
          end
        end
        if s4.last
          r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
          r4.extend(SequencePrimary2)
          r4.extend(SequencePrimary3)
        else
          @index = i4
          r4 = nil
        end
        if r4
          r0 = r4
        else
          i9, s9 = index, []
          r10 = _nt_atomic
          s9 << r10
          if r10
            r11 = _nt_suffix
            s9 << r11
          end
          if s9.last
            r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
            r9.extend(SequencePrimary4)
            r9.extend(SequencePrimary5)
          else
            @index = i9
            r9 = nil
          end
          if r9
            r0 = r9
          else
            r12 = _nt_atomic
            if r12
              r0 = r12
            else
              @index = i0
              r0 = nil
            end
          end
        end
      end

      node_cache[:sequence_primary][start_index] = r0

      r0
    end

_nt_single_quoted_string() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2749
    def _nt_single_quoted_string
      start_index = index
      if node_cache[:single_quoted_string].has_key?(index)
        cached = node_cache[:single_quoted_string][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      if has_terminal?("'", false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        terminal_parse_failure("'")
        r1 = nil
      end
      s0 << r1
      if r1
        s2, i2 = [], index
        loop do
          i3, s3 = index, []
          i4 = index
          if has_terminal?("'", false, index)
            r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure("'")
            r5 = nil
          end
          if r5
            r4 = nil
          else
            @index = i4
            r4 = instantiate_node(SyntaxNode,input, index...index)
          end
          s3 << r4
          if r4
            i6 = index
            if has_terminal?("\\\\", false, index)
              r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
              @index += 2
            else
              terminal_parse_failure("\\\\")
              r7 = nil
            end
            if r7
              r6 = r7
            else
              if has_terminal?("\\'", false, index)
                r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
                @index += 2
              else
                terminal_parse_failure("\\'")
                r8 = nil
              end
              if r8
                r6 = r8
              else
                if index < input_length
                  r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
                  @index += 1
                else
                  terminal_parse_failure("any character")
                  r9 = nil
                end
                if r9
                  r6 = r9
                else
                  @index = i6
                  r6 = nil
                end
              end
            end
            s3 << r6
          end
          if s3.last
            r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
            r3.extend(SingleQuotedString0)
          else
            @index = i3
            r3 = nil
          end
          if r3
            s2 << r3
          else
            break
          end
        end
        r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
        s0 << r2
        if r2
          if has_terminal?("'", false, index)
            r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
            @index += 1
          else
            terminal_parse_failure("'")
            r10 = nil
          end
          s0 << r10
        end
      end
      if s0.last
        r0 = instantiate_node(Terminal,input, i0...index, s0)
        r0.extend(SingleQuotedString1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:single_quoted_string][start_index] = r0

      r0
    end

_nt_space() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3826
    def _nt_space
      start_index = index
      if node_cache[:space].has_key?(index)
        cached = node_cache[:space][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      s0, i0 = [], index
      loop do
        i1 = index
        r2 = _nt_white
        if r2
          r1 = r2
        else
          r3 = _nt_comment_to_eol
          if r3
            r1 = r3
          else
            @index = i1
            r1 = nil
          end
        end
        if r1
          s0 << r1
        else
          break
        end
      end
      if s0.empty?
        @index = i0
        r0 = nil
      else
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
      end

      node_cache[:space][start_index] = r0

      r0
    end

_nt_suffix() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2053
    def _nt_suffix
      start_index = index
      if node_cache[:suffix].has_key?(index)
        cached = node_cache[:suffix][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_repetition_suffix
      if r1
        r0 = r1
      else
        r2 = _nt_optional_suffix
        if r2
          r0 = r2
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:suffix][start_index] = r0

      r0
    end

_nt_terminal() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 2539
    def _nt_terminal
      start_index = index
      if node_cache[:terminal].has_key?(index)
        cached = node_cache[:terminal][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      r1 = _nt_quoted_string
      if r1
        r0 = r1
      else
        r2 = _nt_character_class
        if r2
          r0 = r2
        else
          r3 = _nt_anything_symbol
          if r3
            r0 = r3
          else
            @index = i0
            r0 = nil
          end
        end
      end

      node_cache[:terminal][start_index] = r0

      r0
    end

_nt_trailing_inline_module() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3457
    def _nt_trailing_inline_module
      start_index = index
      if node_cache[:trailing_inline_module].has_key?(index)
        cached = node_cache[:trailing_inline_module][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      i1, s1 = index, []
      r2 = _nt_space
      s1 << r2
      if r2
        r3 = _nt_inline_module
        s1 << r3
      end
      if s1.last
        r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
        r1.extend(TrailingInlineModule0)
        r1.extend(TrailingInlineModule1)
      else
        @index = i1
        r1 = nil
      end
      if r1
        r0 = r1
      else
        if has_terminal?('', false, index)
          r4 = instantiate_node(SyntaxNode,input, index...(index + 0))
          r4.extend(TrailingInlineModule2)
          @index += 0
        else
          terminal_parse_failure('')
          r4 = nil
        end
        if r4
          r0 = r4
        else
          @index = i0
          r0 = nil
        end
      end

      node_cache[:trailing_inline_module][start_index] = r0

      r0
    end

_nt_treetop_file() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 43
    def _nt_treetop_file
      start_index = index
      if node_cache[:treetop_file].has_key?(index)
        cached = node_cache[:treetop_file][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      s1, i1 = [], index
      loop do
        i2, s2 = index, []
        r4 = _nt_space
        if r4
          r3 = r4
        else
          r3 = instantiate_node(SyntaxNode,input, index...index)
        end
        s2 << r3
        if r3
          r5 = _nt_require_statement
          s2 << r5
        end
        if s2.last
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
          r2.extend(TreetopFile0)
        else
          @index = i2
          r2 = nil
        end
        if r2
          s1 << r2
        else
          break
        end
      end
      r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
      s0 << r1
      if r1
        r7 = _nt_space
        if r7
          r6 = r7
        else
          r6 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r6
        if r6
          r8 = _nt_module_or_grammar
          s0 << r8
          if r8
            r10 = _nt_space
            if r10
              r9 = r10
            else
              r9 = instantiate_node(SyntaxNode,input, index...index)
            end
            s0 << r9
          end
        end
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(TreetopFile1)
        r0.extend(TreetopFile2)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:treetop_file][start_index] = r0

      r0
    end

_nt_unlabeled_sequence_primary() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1715
    def _nt_unlabeled_sequence_primary
      start_index = index
      if node_cache[:unlabeled_sequence_primary].has_key?(index)
        cached = node_cache[:unlabeled_sequence_primary][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      r1 = _nt_null_label
      s0 << r1
      if r1
        r2 = _nt_sequence_primary
        s0 << r2
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(UnlabeledSequencePrimary0)
        r0.extend(UnlabeledSequencePrimary1)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:unlabeled_sequence_primary][start_index] = r0

      r0
    end

_nt_variable_length_sequence_body() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 1260
    def _nt_variable_length_sequence_body
      start_index = index
      if node_cache[:variable_length_sequence_body].has_key?(index)
        cached = node_cache[:variable_length_sequence_body][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      r1 = _nt_optionally_labeled_sequence_primary
      s0 << r1
      if r1
        s2, i2 = [], index
        loop do
          i3, s3 = index, []
          r4 = _nt_space
          s3 << r4
          if r4
            r5 = _nt_optionally_labeled_sequence_primary
            s3 << r5
          end
          if s3.last
            r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
            r3.extend(VariableLengthSequenceBody0)
          else
            @index = i3
            r3 = nil
          end
          if r3
            s2 << r3
          else
            break
          end
        end
        if s2.empty?
          @index = i2
          r2 = nil
        else
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
        end
        s0 << r2
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(VariableLengthSequenceBody1)
        r0.extend(VariableLengthSequenceBody2)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:variable_length_sequence_body][start_index] = r0

      r0
    end

_nt_white() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 3954
    def _nt_white
      start_index = index
      if node_cache[:white].has_key?(index)
        cached = node_cache[:white][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      if has_terminal?('\G[ \t\n\r]', true, index)
        r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
        @index += 1
      else
        r0 = nil
      end

      node_cache[:white][start_index] = r0

      r0
    end

root() click to toggle source

    # File lib/treetop/compiler/metagrammar.rb, line 9
    def root
      @root ||= :treetop_file
    end