# Autogenerated from a Treetop grammar. Edits may be lost.

module Procedo
  module Formula
    module Language
      include Treetop::Runtime

      def root
        @root ||= :expression
      end

      include Procedo::Formula::Nodes

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

        i0 = index
        r1 = _nt_conditive
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          r2 = _nt_additive
          if r2
            r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
            r0 = r2
          else
            r3 = _nt_primary
            if r3
              r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
              r0 = r3
            else
              @index = i0
              r0 = nil
            end
          end
        end

        node_cache[:expression][start_index] = r0

        r0
      end

      module Conditive0
        def test
          elements[0]
        end

        def space1
          elements[1]
        end

        def space2
          elements[3]
        end

        def if_true
          elements[4]
        end

        def space3
          elements[5]
        end

        def space4
          elements[7]
        end

        def if_false
          elements[8]
        end
      end

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

        i0, s0 = index, []
        r1 = _nt_boolean_expression
        s0 << r1
        if r1
          r2 = _nt_space
          s0 << r2
          if r2
            if (match_len = has_terminal?("?", false, index))
              r3 = true
              @index += match_len
            else
              terminal_parse_failure('"?"')
              r3 = nil
            end
            s0 << r3
            if r3
              r4 = _nt_space
              s0 << r4
              if r4
                r5 = _nt_argument
                s0 << r5
                if r5
                  r6 = _nt_space
                  s0 << r6
                  if r6
                    if (match_len = has_terminal?(":", false, index))
                      r7 = true
                      @index += match_len
                    else
                      terminal_parse_failure('":"')
                      r7 = nil
                    end
                    s0 << r7
                    if r7
                      r8 = _nt_space
                      s0 << r8
                      if r8
                        i9 = index
                        r10 = _nt_argument
                        if r10
                          r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
                          r9 = r10
                        else
                          r11 = _nt_conditive
                          if r11
                            r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
                            r9 = r11
                          else
                            @index = i9
                            r9 = nil
                          end
                        end
                        s0 << r9
                      end
                    end
                  end
                end
              end
            end
          end
        end
        if s0.last
          r0 = instantiate_node(Condition,input, i0...index, s0)
          r0.extend(Conditive0)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:conditive][start_index] = r0

        r0
      end

      module Multitive0
        def head
          elements[0]
        end

        def operand
          elements[4]
        end
      end

      module Multitive1
        def head
          elements[0]
        end

        def operand
          elements[4]
        end
      end

      def _nt_multitive
        start_index = index
        if node_cache[:multitive].has_key?(index)
          cached = node_cache[:multitive][index]
          if cached
            node_cache[:multitive][index] = 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_primary
        s1 << r2
        if r2
          r4 = _nt_space
          if r4
            r3 = r4
          else
            r3 = instantiate_node(SyntaxNode,input, index...index)
          end
          s1 << r3
          if r3
            if (match_len = has_terminal?("*", false, index))
              r5 = true
              @index += match_len
            else
              terminal_parse_failure('"*"')
              r5 = nil
            end
            s1 << r5
            if r5
              r7 = _nt_space
              if r7
                r6 = r7
              else
                r6 = instantiate_node(SyntaxNode,input, index...index)
              end
              s1 << r6
              if r6
                r8 = _nt_multitive
                s1 << r8
              end
            end
          end
        end
        if s1.last
          r1 = instantiate_node(Multiplication,input, i1...index, s1)
          r1.extend(Multitive0)
        else
          @index = i1
          r1 = nil
        end
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          i9, s9 = index, []
          r10 = _nt_primary
          s9 << r10
          if r10
            r12 = _nt_space
            if r12
              r11 = r12
            else
              r11 = instantiate_node(SyntaxNode,input, index...index)
            end
            s9 << r11
            if r11
              if (match_len = has_terminal?("/", false, index))
                r13 = true
                @index += match_len
              else
                terminal_parse_failure('"/"')
                r13 = nil
              end
              s9 << r13
              if r13
                r15 = _nt_space
                if r15
                  r14 = r15
                else
                  r14 = instantiate_node(SyntaxNode,input, index...index)
                end
                s9 << r14
                if r14
                  r16 = _nt_multitive
                  s9 << r16
                end
              end
            end
          end
          if s9.last
            r9 = instantiate_node(Division,input, i9...index, s9)
            r9.extend(Multitive1)
          else
            @index = i9
            r9 = nil
          end
          if r9
            r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
            r0 = r9
          else
            r17 = _nt_primary
            if r17
              r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
              r0 = r17
            else
              @index = i0
              r0 = nil
            end
          end
        end

        node_cache[:multitive][start_index] = r0

        r0
      end

      module Additive0
        def head
          elements[0]
        end

        def operand
          elements[4]
        end
      end

      module Additive1
        def head
          elements[0]
        end

        def operand
          elements[4]
        end
      end

      def _nt_additive
        start_index = index
        if node_cache[:additive].has_key?(index)
          cached = node_cache[:additive][index]
          if cached
            node_cache[:additive][index] = 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_multitive
        s1 << r2
        if r2
          r4 = _nt_space
          if r4
            r3 = r4
          else
            r3 = instantiate_node(SyntaxNode,input, index...index)
          end
          s1 << r3
          if r3
            if (match_len = has_terminal?("+", false, index))
              r5 = true
              @index += match_len
            else
              terminal_parse_failure('"+"')
              r5 = nil
            end
            s1 << r5
            if r5
              r7 = _nt_space
              if r7
                r6 = r7
              else
                r6 = instantiate_node(SyntaxNode,input, index...index)
              end
              s1 << r6
              if r6
                r8 = _nt_additive
                s1 << r8
              end
            end
          end
        end
        if s1.last
          r1 = instantiate_node(Addition,input, i1...index, s1)
          r1.extend(Additive0)
        else
          @index = i1
          r1 = nil
        end
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          i9, s9 = index, []
          r10 = _nt_multitive
          s9 << r10
          if r10
            r12 = _nt_space
            if r12
              r11 = r12
            else
              r11 = instantiate_node(SyntaxNode,input, index...index)
            end
            s9 << r11
            if r11
              if (match_len = has_terminal?("-", false, index))
                r13 = true
                @index += match_len
              else
                terminal_parse_failure('"-"')
                r13 = nil
              end
              s9 << r13
              if r13
                r15 = _nt_space
                if r15
                  r14 = r15
                else
                  r14 = instantiate_node(SyntaxNode,input, index...index)
                end
                s9 << r14
                if r14
                  r16 = _nt_additive
                  s9 << r16
                end
              end
            end
          end
          if s9.last
            r9 = instantiate_node(Substraction,input, i9...index, s9)
            r9.extend(Additive1)
          else
            @index = i9
            r9 = nil
          end
          if r9
            r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
            r0 = r9
          else
            r17 = _nt_multitive
            if r17
              r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
              r0 = r17
            else
              @index = i0
              r0 = nil
            end
          end
        end

        node_cache[:additive][start_index] = r0

        r0
      end

      module Primary0
        def expression
          elements[2]
        end
      end

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

        i0 = index
        r1 = _nt_numeric
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          r2 = _nt_reading
          if r2
            r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
            r0 = r2
          else
            r3 = _nt_string_expression
            if r3
              r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
              r0 = r3
            else
              r4 = _nt_object
              if r4
                r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
                r0 = r4
              else
                r5 = _nt_interpolation
                if r5
                  r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
                  r0 = r5
                else
                  i6, s6 = index, []
                  if (match_len = has_terminal?("(", false, index))
                    r7 = true
                    @index += match_len
                  else
                    terminal_parse_failure('"("')
                    r7 = nil
                  end
                  s6 << r7
                  if r7
                    r9 = _nt_space
                    if r9
                      r8 = r9
                    else
                      r8 = instantiate_node(SyntaxNode,input, index...index)
                    end
                    s6 << r8
                    if r8
                      r10 = _nt_expression
                      s6 << r10
                      if r10
                        r12 = _nt_space
                        if r12
                          r11 = r12
                        else
                          r11 = instantiate_node(SyntaxNode,input, index...index)
                        end
                        s6 << r11
                        if r11
                          if (match_len = has_terminal?(")", false, index))
                            r13 = true
                            @index += match_len
                          else
                            terminal_parse_failure('")"')
                            r13 = nil
                          end
                          s6 << r13
                        end
                      end
                    end
                  end
                  if s6.last
                    r6 = instantiate_node(Expression,input, i6...index, s6)
                    r6.extend(Primary0)
                  else
                    @index = i6
                    r6 = nil
                  end
                  if r6
                    r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
                    r0 = r6
                  else
                    @index = i0
                    r0 = nil
                  end
                end
              end
            end
          end
        end

        node_cache[:primary][start_index] = r0

        r0
      end

      module StringExpression0
        def string_body
          elements[1]
        end
      end

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

        i0, s0 = index, []
        if (match_len = has_terminal?("'", false, index))
          r1 = true
          @index += match_len
        else
          terminal_parse_failure('"\'"')
          r1 = nil
        end
        s0 << r1
        if r1
          s2, i2 = [], index
          loop do
            r3 = _nt_string_part
            if r3
              s2 << r3
            else
              break
            end
          end
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
          s0 << r2
          if r2
            if (match_len = has_terminal?("'", false, index))
              r4 = true
              @index += match_len
            else
              terminal_parse_failure('"\'"')
              r4 = nil
            end
            s0 << r4
          end
        end
        if s0.last
          r0 = instantiate_node(StringExpression,input, i0...index, s0)
          r0.extend(StringExpression0)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:string_expression][start_index] = r0

        r0
      end

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

        i0 = index
        r1 = _nt_interpolation
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          r2 = _nt_text
          if r2
            r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
            r0 = r2
          else
            @index = i0
            r0 = nil
          end
        end

        node_cache[:string_part][start_index] = r0

        r0
      end

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

        s0, i0 = [], index
        loop do
          if has_terminal?(@regexps[gr = '\A["_"a-zA-Z0-9\\s\\n]'] ||= Regexp.new(gr), :regexp, index)
            r1 = true
            @index += 1
          else
            terminal_parse_failure('["_"a-zA-Z0-9\\s\\n]')
            r1 = nil
          end
          if r1
            s0 << r1
          else
            break
          end
        end
        if s0.empty?
          @index = i0
          r0 = nil
        else
          r0 = instantiate_node(Text,input, i0...index, s0)
        end

        node_cache[:text][start_index] = r0

        r0
      end

      module Interpolation0
        def expression
          elements[2]
        end
      end

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

        i0, s0 = index, []
        if (match_len = has_terminal?("%\{", false, index))
          r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
          @index += match_len
        else
          terminal_parse_failure('"%\\{"')
          r1 = nil
        end
        s0 << r1
        if r1
          r3 = _nt_space
          if r3
            r2 = r3
          else
            r2 = instantiate_node(SyntaxNode,input, index...index)
          end
          s0 << r2
          if r2
            r4 = _nt_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 (match_len = has_terminal?("\}", false, index))
                  r7 = true
                  @index += match_len
                else
                  terminal_parse_failure('"\\}"')
                  r7 = nil
                end
                s0 << r7
              end
            end
          end
        end
        if s0.last
          r0 = instantiate_node(Interpolation,input, i0...index, s0)
          r0.extend(Interpolation0)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:interpolation][start_index] = r0

        r0
      end

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

        i0 = index
        r1 = _nt_numeric
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          r2 = _nt_symbol
          if r2
            r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
            r0 = r2
          else
            r3 = _nt_reading
            if r3
              r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
              r0 = r3
            else
              r4 = _nt_object
              if r4
                r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
                r0 = r4
              else
                r5 = _nt_variable
                if r5
                  r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
                  r0 = r5
                else
                  r6 = _nt_expression
                  if r6
                    r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
                    r0 = r6
                  else
                    @index = i0
                    r0 = nil
                  end
                end
              end
            end
          end
        end

        node_cache[:argument][start_index] = r0

        r0
      end

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

        i0 = index
        r1 = _nt_function_call
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          r2 = _nt_environment_variable
          if r2
            r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
            r0 = r2
          else
            @index = i0
            r0 = nil
          end
        end

        node_cache[:object][start_index] = r0

        r0
      end

      module Reading0
        def unit
          elements[1]
        end
      end

      module Reading1
        def object
          elements[0]
        end

        def indicator
          elements[2]
        end

        def options
          elements[3]
        end
      end

      module Reading2
        def unit
          elements[1]
        end
      end

      module Reading3
        def object
          elements[0]
        end

        def indicator
          elements[2]
        end

        def options
          elements[3]
        end
      end

      def _nt_reading
        start_index = index
        if node_cache[:reading].has_key?(index)
          cached = node_cache[:reading][index]
          if cached
            node_cache[:reading][index] = 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_object
        s1 << r2
        if r2
          if (match_len = has_terminal?("..", false, index))
            r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
            @index += match_len
          else
            terminal_parse_failure('".."')
            r3 = nil
          end
          s1 << r3
          if r3
            r4 = _nt_indicator
            s1 << r4
            if r4
              i6, s6 = index, []
              if (match_len = has_terminal?("(", false, index))
                r7 = true
                @index += match_len
              else
                terminal_parse_failure('"("')
                r7 = nil
              end
              s6 << r7
              if r7
                r8 = _nt_unit
                s6 << r8
                if r8
                  if (match_len = has_terminal?(")", false, index))
                    r9 = true
                    @index += match_len
                  else
                    terminal_parse_failure('")"')
                    r9 = nil
                  end
                  s6 << r9
                end
              end
              if s6.last
                r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
                r6.extend(Reading0)
              else
                @index = i6
                r6 = nil
              end
              if r6
                r5 = r6
              else
                r5 = instantiate_node(SyntaxNode,input, index...index)
              end
              s1 << r5
            end
          end
        end
        if s1.last
          r1 = instantiate_node(IndividualReading,input, i1...index, s1)
          r1.extend(Reading1)
        else
          @index = i1
          r1 = nil
        end
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          i10, s10 = index, []
          r11 = _nt_object
          s10 << r11
          if r11
            if (match_len = has_terminal?(".", false, index))
              r12 = true
              @index += match_len
            else
              terminal_parse_failure('"."')
              r12 = nil
            end
            s10 << r12
            if r12
              r13 = _nt_indicator
              s10 << r13
              if r13
                i15, s15 = index, []
                if (match_len = has_terminal?("(", false, index))
                  r16 = true
                  @index += match_len
                else
                  terminal_parse_failure('"("')
                  r16 = nil
                end
                s15 << r16
                if r16
                  r17 = _nt_unit
                  s15 << r17
                  if r17
                    if (match_len = has_terminal?(")", false, index))
                      r18 = true
                      @index += match_len
                    else
                      terminal_parse_failure('")"')
                      r18 = nil
                    end
                    s15 << r18
                  end
                end
                if s15.last
                  r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
                  r15.extend(Reading2)
                else
                  @index = i15
                  r15 = nil
                end
                if r15
                  r14 = r15
                else
                  r14 = instantiate_node(SyntaxNode,input, index...index)
                end
                s10 << r14
              end
            end
          end
          if s10.last
            r10 = instantiate_node(WholeReading,input, i10...index, s10)
            r10.extend(Reading3)
          else
            @index = i10
            r10 = nil
          end
          if r10
            r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
            r0 = r10
          else
            @index = i0
            r0 = nil
          end
        end

        node_cache[:reading][start_index] = r0

        r0
      end

      module EnvironmentVariable0
      end

      module EnvironmentVariable1
      end

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

        i0, s0 = index, []
        if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
          r1 = true
          @index += 1
        else
          terminal_parse_failure('[A-Z]')
          r1 = nil
        end
        s0 << r1
        if r1
          s2, i2 = [], index
          loop do
            if has_terminal?(@regexps[gr = '\A[A-Z0-9]'] ||= Regexp.new(gr), :regexp, index)
              r3 = true
              @index += 1
            else
              terminal_parse_failure('[A-Z0-9]')
              r3 = nil
            end
            if r3
              s2 << r3
            else
              break
            end
          end
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
          s0 << r2
          if r2
            s4, i4 = [], index
            loop do
              i5, s5 = index, []
              if (match_len = has_terminal?("_", false, index))
                r6 = true
                @index += match_len
              else
                terminal_parse_failure('"_"')
                r6 = nil
              end
              s5 << r6
              if r6
                s7, i7 = [], index
                loop do
                  if has_terminal?(@regexps[gr = '\A[A-Z0-9]'] ||= Regexp.new(gr), :regexp, index)
                    r8 = true
                    @index += 1
                  else
                    terminal_parse_failure('[A-Z0-9]')
                    r8 = nil
                  end
                  if r8
                    s7 << r8
                  else
                    break
                  end
                end
                if s7.empty?
                  @index = i7
                  r7 = nil
                else
                  r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
                end
                s5 << r7
              end
              if s5.last
                r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
                r5.extend(EnvironmentVariable0)
              else
                @index = i5
                r5 = nil
              end
              if r5
                s4 << r5
              else
                break
              end
            end
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
            s0 << r4
          end
        end
        if s0.last
          r0 = instantiate_node(EnvironmentVariable,input, i0...index, s0)
          r0.extend(EnvironmentVariable1)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:environment_variable][start_index] = r0

        r0
      end

      module Variable0
      end

      module Variable1
      end

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

        i0, s0 = index, []
        if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
          r1 = true
          @index += 1
        else
          terminal_parse_failure('[a-z]')
          r1 = nil
        end
        s0 << r1
        if r1
          s2, i2 = [], index
          loop do
            if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
              r3 = true
              @index += 1
            else
              terminal_parse_failure('[a-z0-9]')
              r3 = nil
            end
            if r3
              s2 << r3
            else
              break
            end
          end
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
          s0 << r2
          if r2
            s4, i4 = [], index
            loop do
              i5, s5 = index, []
              if (match_len = has_terminal?("_", false, index))
                r6 = true
                @index += match_len
              else
                terminal_parse_failure('"_"')
                r6 = nil
              end
              s5 << r6
              if r6
                s7, i7 = [], index
                loop do
                  if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
                    r8 = true
                    @index += 1
                  else
                    terminal_parse_failure('[a-z0-9]')
                    r8 = nil
                  end
                  if r8
                    s7 << r8
                  else
                    break
                  end
                end
                if s7.empty?
                  @index = i7
                  r7 = nil
                else
                  r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
                end
                s5 << r7
              end
              if s5.last
                r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
                r5.extend(Variable0)
              else
                @index = i5
                r5 = nil
              end
              if r5
                s4 << r5
              else
                break
              end
            end
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
            s0 << r4
          end
        end
        if s0.last
          r0 = instantiate_node(Variable,input, i0...index, s0)
          r0.extend(Variable1)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:variable][start_index] = r0

        r0
      end

      module Indicator0
      end

      module Indicator1
      end

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

        i0, s0 = index, []
        if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
          r1 = true
          @index += 1
        else
          terminal_parse_failure('[a-z]')
          r1 = nil
        end
        s0 << r1
        if r1
          s2, i2 = [], index
          loop do
            if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
              r3 = true
              @index += 1
            else
              terminal_parse_failure('[a-z0-9]')
              r3 = nil
            end
            if r3
              s2 << r3
            else
              break
            end
          end
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
          s0 << r2
          if r2
            s4, i4 = [], index
            loop do
              i5, s5 = index, []
              if (match_len = has_terminal?("_", false, index))
                r6 = true
                @index += match_len
              else
                terminal_parse_failure('"_"')
                r6 = nil
              end
              s5 << r6
              if r6
                s7, i7 = [], index
                loop do
                  if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
                    r8 = true
                    @index += 1
                  else
                    terminal_parse_failure('[a-z0-9]')
                    r8 = nil
                  end
                  if r8
                    s7 << r8
                  else
                    break
                  end
                end
                if s7.empty?
                  @index = i7
                  r7 = nil
                else
                  r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
                end
                s5 << r7
              end
              if s5.last
                r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
                r5.extend(Indicator0)
              else
                @index = i5
                r5 = nil
              end
              if r5
                s4 << r5
              else
                break
              end
            end
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
            s0 << r4
          end
        end
        if s0.last
          r0 = instantiate_node(Indicator,input, i0...index, s0)
          r0.extend(Indicator1)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:indicator][start_index] = r0

        r0
      end

      module Unit0
      end

      module Unit1
      end

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

        i0, s0 = index, []
        if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
          r1 = true
          @index += 1
        else
          terminal_parse_failure('[a-z]')
          r1 = nil
        end
        s0 << r1
        if r1
          s2, i2 = [], index
          loop do
            if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
              r3 = true
              @index += 1
            else
              terminal_parse_failure('[a-z0-9]')
              r3 = nil
            end
            if r3
              s2 << r3
            else
              break
            end
          end
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
          s0 << r2
          if r2
            s4, i4 = [], index
            loop do
              i5, s5 = index, []
              if (match_len = has_terminal?("_", false, index))
                r6 = true
                @index += match_len
              else
                terminal_parse_failure('"_"')
                r6 = nil
              end
              s5 << r6
              if r6
                s7, i7 = [], index
                loop do
                  if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
                    r8 = true
                    @index += 1
                  else
                    terminal_parse_failure('[a-z0-9]')
                    r8 = nil
                  end
                  if r8
                    s7 << r8
                  else
                    break
                  end
                end
                if s7.empty?
                  @index = i7
                  r7 = nil
                else
                  r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
                end
                s5 << r7
              end
              if s5.last
                r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
                r5.extend(Unit0)
              else
                @index = i5
                r5 = nil
              end
              if r5
                s4 << r5
              else
                break
              end
            end
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
            s0 << r4
          end
        end
        if s0.last
          r0 = instantiate_node(Unit,input, i0...index, s0)
          r0.extend(Unit1)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:unit][start_index] = r0

        r0
      end

      module Numeric0
      end

      module Numeric1
      end

      module Numeric2
      end

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

        i0, s0 = index, []
        i1 = index
        i2, s2 = index, []
        if has_terminal?(@regexps[gr = '\A[1-9]'] ||= Regexp.new(gr), :regexp, index)
          r3 = true
          @index += 1
        else
          terminal_parse_failure('[1-9]')
          r3 = nil
        end
        s2 << r3
        if r3
          s4, i4 = [], index
          loop do
            if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
              r5 = true
              @index += 1
            else
              terminal_parse_failure('[0-9]')
              r5 = nil
            end
            if r5
              s4 << r5
            else
              break
            end
          end
          r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
          s2 << r4
        end
        if s2.last
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
          r2.extend(Numeric0)
        else
          @index = i2
          r2 = nil
        end
        if r2
          r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
          r1 = r2
        else
          if (match_len = has_terminal?("0", false, index))
            r6 = true
            @index += match_len
          else
            terminal_parse_failure('"0"')
            r6 = nil
          end
          if r6
            r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
            r1 = r6
          else
            @index = i1
            r1 = nil
          end
        end
        s0 << r1
        if r1
          i8, s8 = index, []
          if (match_len = has_terminal?(".", false, index))
            r9 = true
            @index += match_len
          else
            terminal_parse_failure('"."')
            r9 = nil
          end
          s8 << r9
          if r9
            s10, i10 = [], index
            loop do
              if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
                r11 = true
                @index += 1
              else
                terminal_parse_failure('[0-9]')
                r11 = nil
              end
              if r11
                s10 << r11
              else
                break
              end
            end
            if s10.empty?
              @index = i10
              r10 = nil
            else
              r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
            end
            s8 << r10
          end
          if s8.last
            r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
            r8.extend(Numeric1)
          else
            @index = i8
            r8 = nil
          end
          if r8
            r7 = r8
          else
            r7 = instantiate_node(SyntaxNode,input, index...index)
          end
          s0 << r7
        end
        if s0.last
          r0 = instantiate_node(Numeric,input, i0...index, s0)
          r0.extend(Numeric2)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:numeric][start_index] = r0

        r0
      end

      module Symbol0
      end

      module Symbol1
      end

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

        i0, s0 = index, []
        if (match_len = has_terminal?(":", false, index))
          r1 = true
          @index += match_len
        else
          terminal_parse_failure('":"')
          r1 = nil
        end
        s0 << r1
        if r1
          if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
            r2 = true
            @index += 1
          else
            terminal_parse_failure('[a-z]')
            r2 = nil
          end
          s0 << r2
          if r2
            s3, i3 = [], index
            loop do
              if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
                r4 = true
                @index += 1
              else
                terminal_parse_failure('[a-z0-9]')
                r4 = nil
              end
              if r4
                s3 << r4
              else
                break
              end
            end
            r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
            s0 << r3
            if r3
              s5, i5 = [], index
              loop do
                i6, s6 = index, []
                if (match_len = has_terminal?("_", false, index))
                  r7 = true
                  @index += match_len
                else
                  terminal_parse_failure('"_"')
                  r7 = nil
                end
                s6 << r7
                if r7
                  s8, i8 = [], index
                  loop do
                    if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
                      r9 = true
                      @index += 1
                    else
                      terminal_parse_failure('[a-z0-9]')
                      r9 = nil
                    end
                    if r9
                      s8 << r9
                    else
                      break
                    end
                  end
                  if s8.empty?
                    @index = i8
                    r8 = nil
                  else
                    r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
                  end
                  s6 << r8
                end
                if s6.last
                  r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
                  r6.extend(Symbol0)
                else
                  @index = i6
                  r6 = nil
                end
                if r6
                  s5 << r6
                else
                  break
                end
              end
              r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
              s0 << r5
            end
          end
        end
        if s0.last
          r0 = instantiate_node(Symbol,input, i0...index, s0)
          r0.extend(Symbol1)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:symbol][start_index] = r0

        r0
      end

      module FunctionCall0
        def argument
          elements[3]
        end
      end

      module FunctionCall1
        def first_arg
          elements[0]
        end

        def other_args
          elements[1]
        end
      end

      module FunctionCall2
        def function_name
          elements[0]
        end

        def args
          elements[3]
        end
      end

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

        i0, s0 = index, []
        r1 = _nt_function_name
        s0 << r1
        if r1
          if (match_len = has_terminal?("(", false, index))
            r2 = true
            @index += match_len
          else
            terminal_parse_failure('"("')
            r2 = nil
          end
          s0 << r2
          if r2
            r4 = _nt_space
            if r4
              r3 = r4
            else
              r3 = instantiate_node(SyntaxNode,input, index...index)
            end
            s0 << r3
            if r3
              i6, s6 = index, []
              r7 = _nt_argument
              s6 << r7
              if r7
                s8, i8 = [], index
                loop do
                  i9, s9 = index, []
                  r11 = _nt_space
                  if r11
                    r10 = r11
                  else
                    r10 = instantiate_node(SyntaxNode,input, index...index)
                  end
                  s9 << r10
                  if r10
                    if (match_len = has_terminal?(",", false, index))
                      r12 = true
                      @index += match_len
                    else
                      terminal_parse_failure('","')
                      r12 = nil
                    end
                    s9 << r12
                    if r12
                      r14 = _nt_space
                      if r14
                        r13 = r14
                      else
                        r13 = instantiate_node(SyntaxNode,input, index...index)
                      end
                      s9 << r13
                      if r13
                        r15 = _nt_argument
                        s9 << r15
                      end
                    end
                  end
                  if s9.last
                    r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
                    r9.extend(FunctionCall0)
                  else
                    @index = i9
                    r9 = nil
                  end
                  if r9
                    s8 << r9
                  else
                    break
                  end
                end
                r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
                s6 << r8
              end
              if s6.last
                r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
                r6.extend(FunctionCall1)
              else
                @index = i6
                r6 = nil
              end
              if r6
                r5 = r6
              else
                r5 = instantiate_node(SyntaxNode,input, index...index)
              end
              s0 << r5
              if r5
                r17 = _nt_space
                if r17
                  r16 = r17
                else
                  r16 = instantiate_node(SyntaxNode,input, index...index)
                end
                s0 << r16
                if r16
                  if (match_len = has_terminal?(")", false, index))
                    r18 = true
                    @index += match_len
                  else
                    terminal_parse_failure('")"')
                    r18 = nil
                  end
                  s0 << r18
                end
              end
            end
          end
        end
        if s0.last
          r0 = instantiate_node(FunctionCall,input, i0...index, s0)
          r0.extend(FunctionCall2)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:function_call][start_index] = r0

        r0
      end

      module FunctionName0
      end

      module FunctionName1
      end

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

        i0, s0 = index, []
        if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
          r1 = true
          @index += 1
        else
          terminal_parse_failure('[a-z]')
          r1 = nil
        end
        s0 << r1
        if r1
          s2, i2 = [], index
          loop do
            if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
              r3 = true
              @index += 1
            else
              terminal_parse_failure('[a-z0-9]')
              r3 = nil
            end
            if r3
              s2 << r3
            else
              break
            end
          end
          r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
          s0 << r2
          if r2
            s4, i4 = [], index
            loop do
              i5, s5 = index, []
              if (match_len = has_terminal?("_", false, index))
                r6 = true
                @index += match_len
              else
                terminal_parse_failure('"_"')
                r6 = nil
              end
              s5 << r6
              if r6
                s7, i7 = [], index
                loop do
                  if has_terminal?(@regexps[gr = '\A[a-z0-9]'] ||= Regexp.new(gr), :regexp, index)
                    r8 = true
                    @index += 1
                  else
                    terminal_parse_failure('[a-z0-9]')
                    r8 = nil
                  end
                  if r8
                    s7 << r8
                  else
                    break
                  end
                end
                if s7.empty?
                  @index = i7
                  r7 = nil
                else
                  r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
                end
                s5 << r7
              end
              if s5.last
                r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
                r5.extend(FunctionName0)
              else
                @index = i5
                r5 = nil
              end
              if r5
                s4 << r5
              else
                break
              end
            end
            r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
            s0 << r4
          end
        end
        if s0.last
          r0 = instantiate_node(FunctionName,input, i0...index, s0)
          r0.extend(FunctionName1)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:function_name][start_index] = r0

        r0
      end

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

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

        node_cache[:space][start_index] = r0

        r0
      end

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

        i0 = index
        r1 = _nt_disjunctive
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          r2 = _nt_test
          if r2
            r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
            r0 = r2
          else
            @index = i0
            r0 = nil
          end
        end

        node_cache[:boolean_expression][start_index] = r0

        r0
      end

      module Conjonctive0
        def head
          elements[0]
        end

        def operand
          elements[4]
        end
      end

      module Conjonctive1
        def head
          elements[0]
        end

        def space1
          elements[1]
        end

        def space2
          elements[3]
        end

        def operand
          elements[4]
        end
      end

      module Conjonctive2
        def head
          elements[0]
        end

        def operand
          elements[4]
        end
      end

      module Conjonctive3
        def head
          elements[0]
        end

        def space1
          elements[1]
        end

        def space2
          elements[3]
        end

        def operand
          elements[4]
        end
      end

      def _nt_conjonctive
        start_index = index
        if node_cache[:conjonctive].has_key?(index)
          cached = node_cache[:conjonctive][index]
          if cached
            node_cache[:conjonctive][index] = 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_test
        s1 << r2
        if r2
          r4 = _nt_space
          if r4
            r3 = r4
          else
            r3 = instantiate_node(SyntaxNode,input, index...index)
          end
          s1 << r3
          if r3
            if (match_len = has_terminal?("&", false, index))
              r5 = true
              @index += match_len
            else
              terminal_parse_failure('"&"')
              r5 = nil
            end
            s1 << r5
            if r5
              r7 = _nt_space
              if r7
                r6 = r7
              else
                r6 = instantiate_node(SyntaxNode,input, index...index)
              end
              s1 << r6
              if r6
                r8 = _nt_conjonctive
                s1 << r8
              end
            end
          end
        end
        if s1.last
          r1 = instantiate_node(Conjunction,input, i1...index, s1)
          r1.extend(Conjonctive0)
        else
          @index = i1
          r1 = nil
        end
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          i9, s9 = index, []
          r10 = _nt_test
          s9 << r10
          if r10
            r11 = _nt_space
            s9 << r11
            if r11
              if (match_len = has_terminal?("and", false, index))
                r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                @index += match_len
              else
                terminal_parse_failure('"and"')
                r12 = nil
              end
              s9 << r12
              if r12
                r13 = _nt_space
                s9 << r13
                if r13
                  r14 = _nt_conjonctive
                  s9 << r14
                end
              end
            end
          end
          if s9.last
            r9 = instantiate_node(Conjunction,input, i9...index, s9)
            r9.extend(Conjonctive1)
          else
            @index = i9
            r9 = nil
          end
          if r9
            r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
            r0 = r9
          else
            i15, s15 = index, []
            r16 = _nt_test
            s15 << r16
            if r16
              r18 = _nt_space
              if r18
                r17 = r18
              else
                r17 = instantiate_node(SyntaxNode,input, index...index)
              end
              s15 << r17
              if r17
                if (match_len = has_terminal?("||", false, index))
                  r19 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                  @index += match_len
                else
                  terminal_parse_failure('"||"')
                  r19 = nil
                end
                s15 << r19
                if r19
                  r21 = _nt_space
                  if r21
                    r20 = r21
                  else
                    r20 = instantiate_node(SyntaxNode,input, index...index)
                  end
                  s15 << r20
                  if r20
                    r22 = _nt_conjonctive
                    s15 << r22
                  end
                end
              end
            end
            if s15.last
              r15 = instantiate_node(ExclusiveDisjunction,input, i15...index, s15)
              r15.extend(Conjonctive2)
            else
              @index = i15
              r15 = nil
            end
            if r15
              r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
              r0 = r15
            else
              i23, s23 = index, []
              r24 = _nt_test
              s23 << r24
              if r24
                r25 = _nt_space
                s23 << r25
                if r25
                  if (match_len = has_terminal?("or", false, index))
                    r26 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                    @index += match_len
                  else
                    terminal_parse_failure('"or"')
                    r26 = nil
                  end
                  s23 << r26
                  if r26
                    r27 = _nt_space
                    s23 << r27
                    if r27
                      r28 = _nt_conjonctive
                      s23 << r28
                    end
                  end
                end
              end
              if s23.last
                r23 = instantiate_node(ExclusiveDisjunction,input, i23...index, s23)
                r23.extend(Conjonctive3)
              else
                @index = i23
                r23 = nil
              end
              if r23
                r23 = SyntaxNode.new(input, (index-1)...index) if r23 == true
                r0 = r23
              else
                r29 = _nt_test
                if r29
                  r29 = SyntaxNode.new(input, (index-1)...index) if r29 == true
                  r0 = r29
                else
                  @index = i0
                  r0 = nil
                end
              end
            end
          end
        end

        node_cache[:conjonctive][start_index] = r0

        r0
      end

      module Disjunctive0
        def head
          elements[0]
        end

        def operand
          elements[4]
        end
      end

      def _nt_disjunctive
        start_index = index
        if node_cache[:disjunctive].has_key?(index)
          cached = node_cache[:disjunctive][index]
          if cached
            node_cache[:disjunctive][index] = 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_conjonctive
        s1 << r2
        if r2
          r4 = _nt_space
          if r4
            r3 = r4
          else
            r3 = instantiate_node(SyntaxNode,input, index...index)
          end
          s1 << r3
          if r3
            if (match_len = has_terminal?("|", false, index))
              r5 = true
              @index += match_len
            else
              terminal_parse_failure('"|"')
              r5 = nil
            end
            s1 << r5
            if r5
              r7 = _nt_space
              if r7
                r6 = r7
              else
                r6 = instantiate_node(SyntaxNode,input, index...index)
              end
              s1 << r6
              if r6
                r8 = _nt_disjunctive
                s1 << r8
              end
            end
          end
        end
        if s1.last
          r1 = instantiate_node(Disjunction,input, i1...index, s1)
          r1.extend(Disjunctive0)
        else
          @index = i1
          r1 = nil
        end
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          r9 = _nt_conjonctive
          if r9
            r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
            r0 = r9
          else
            @index = i0
            r0 = nil
          end
        end

        node_cache[:disjunctive][start_index] = r0

        r0
      end

      module Test0
        def boolean_expression
          elements[1]
        end
      end

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

        i0 = index
        r1 = _nt_negative
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          r2 = _nt_comparative
          if r2
            r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
            r0 = r2
          else
            r3 = _nt_indicative
            if r3
              r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
              r0 = r3
            else
              r4 = _nt_presence
              if r4
                r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
                r0 = r4
              else
                i5, s5 = index, []
                if (match_len = has_terminal?("(", false, index))
                  r6 = true
                  @index += match_len
                else
                  terminal_parse_failure('"("')
                  r6 = nil
                end
                s5 << r6
                if r6
                  r7 = _nt_boolean_expression
                  s5 << r7
                  if r7
                    if (match_len = has_terminal?(")", false, index))
                      r8 = true
                      @index += match_len
                    else
                      terminal_parse_failure('")"')
                      r8 = nil
                    end
                    s5 << r8
                  end
                end
                if s5.last
                  r5 = instantiate_node(BooleanExpression,input, i5...index, s5)
                  r5.extend(Test0)
                else
                  @index = i5
                  r5 = nil
                end
                if r5
                  r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
                  r0 = r5
                else
                  @index = i0
                  r0 = nil
                end
              end
            end
          end
        end

        node_cache[:test][start_index] = r0

        r0
      end

      module Comparative0
        def head
          elements[0]
        end

        def operator
          elements[2]
        end

        def operand
          elements[4]
        end
      end

      module Comparative1
        def head
          elements[0]
        end

        def operator
          elements[2]
        end

        def operand
          elements[4]
        end
      end

      module Comparative2
        def head
          elements[0]
        end

        def operator
          elements[2]
        end

        def operand
          elements[4]
        end
      end

      module Comparative3
        def head
          elements[0]
        end

        def operator
          elements[2]
        end

        def operand
          elements[4]
        end
      end

      module Comparative4
        def head
          elements[0]
        end

        def operator
          elements[2]
        end

        def operand
          elements[4]
        end
      end

      module Comparative5
        def head
          elements[0]
        end

        def operator
          elements[2]
        end

        def operand
          elements[4]
        end
      end

      def _nt_comparative
        start_index = index
        if node_cache[:comparative].has_key?(index)
          cached = node_cache[:comparative][index]
          if cached
            node_cache[:comparative][index] = 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_primary
        s1 << r2
        if r2
          r4 = _nt_space
          if r4
            r3 = r4
          else
            r3 = instantiate_node(SyntaxNode,input, index...index)
          end
          s1 << r3
          if r3
            if (match_len = has_terminal?(">", false, index))
              r5 = true
              @index += match_len
            else
              terminal_parse_failure('">"')
              r5 = nil
            end
            s1 << r5
            if r5
              r7 = _nt_space
              if r7
                r6 = r7
              else
                r6 = instantiate_node(SyntaxNode,input, index...index)
              end
              s1 << r6
              if r6
                r8 = _nt_primary
                s1 << r8
              end
            end
          end
        end
        if s1.last
          r1 = instantiate_node(StrictSuperiorityComparison,input, i1...index, s1)
          r1.extend(Comparative0)
        else
          @index = i1
          r1 = nil
        end
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          i9, s9 = index, []
          r10 = _nt_primary
          s9 << r10
          if r10
            r12 = _nt_space
            if r12
              r11 = r12
            else
              r11 = instantiate_node(SyntaxNode,input, index...index)
            end
            s9 << r11
            if r11
              if (match_len = has_terminal?("<", false, index))
                r13 = true
                @index += match_len
              else
                terminal_parse_failure('"<"')
                r13 = nil
              end
              s9 << r13
              if r13
                r15 = _nt_space
                if r15
                  r14 = r15
                else
                  r14 = instantiate_node(SyntaxNode,input, index...index)
                end
                s9 << r14
                if r14
                  r16 = _nt_primary
                  s9 << r16
                end
              end
            end
          end
          if s9.last
            r9 = instantiate_node(StrictInferiortyComparison,input, i9...index, s9)
            r9.extend(Comparative1)
          else
            @index = i9
            r9 = nil
          end
          if r9
            r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
            r0 = r9
          else
            i17, s17 = index, []
            r18 = _nt_primary
            s17 << r18
            if r18
              r20 = _nt_space
              if r20
                r19 = r20
              else
                r19 = instantiate_node(SyntaxNode,input, index...index)
              end
              s17 << r19
              if r19
                if (match_len = has_terminal?(">=", false, index))
                  r21 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                  @index += match_len
                else
                  terminal_parse_failure('">="')
                  r21 = nil
                end
                s17 << r21
                if r21
                  r23 = _nt_space
                  if r23
                    r22 = r23
                  else
                    r22 = instantiate_node(SyntaxNode,input, index...index)
                  end
                  s17 << r22
                  if r22
                    r24 = _nt_primary
                    s17 << r24
                  end
                end
              end
            end
            if s17.last
              r17 = instantiate_node(SuperiorityComparison,input, i17...index, s17)
              r17.extend(Comparative2)
            else
              @index = i17
              r17 = nil
            end
            if r17
              r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
              r0 = r17
            else
              i25, s25 = index, []
              r26 = _nt_primary
              s25 << r26
              if r26
                r28 = _nt_space
                if r28
                  r27 = r28
                else
                  r27 = instantiate_node(SyntaxNode,input, index...index)
                end
                s25 << r27
                if r27
                  if (match_len = has_terminal?("<=", false, index))
                    r29 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                    @index += match_len
                  else
                    terminal_parse_failure('"<="')
                    r29 = nil
                  end
                  s25 << r29
                  if r29
                    r31 = _nt_space
                    if r31
                      r30 = r31
                    else
                      r30 = instantiate_node(SyntaxNode,input, index...index)
                    end
                    s25 << r30
                    if r30
                      r32 = _nt_primary
                      s25 << r32
                    end
                  end
                end
              end
              if s25.last
                r25 = instantiate_node(InferiorityComparison,input, i25...index, s25)
                r25.extend(Comparative3)
              else
                @index = i25
                r25 = nil
              end
              if r25
                r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
                r0 = r25
              else
                i33, s33 = index, []
                r34 = _nt_primary
                s33 << r34
                if r34
                  r36 = _nt_space
                  if r36
                    r35 = r36
                  else
                    r35 = instantiate_node(SyntaxNode,input, index...index)
                  end
                  s33 << r35
                  if r35
                    if (match_len = has_terminal?("==", false, index))
                      r37 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                      @index += match_len
                    else
                      terminal_parse_failure('"=="')
                      r37 = nil
                    end
                    s33 << r37
                    if r37
                      r39 = _nt_space
                      if r39
                        r38 = r39
                      else
                        r38 = instantiate_node(SyntaxNode,input, index...index)
                      end
                      s33 << r38
                      if r38
                        r40 = _nt_primary
                        s33 << r40
                      end
                    end
                  end
                end
                if s33.last
                  r33 = instantiate_node(EqualityComparison,input, i33...index, s33)
                  r33.extend(Comparative4)
                else
                  @index = i33
                  r33 = nil
                end
                if r33
                  r33 = SyntaxNode.new(input, (index-1)...index) if r33 == true
                  r0 = r33
                else
                  i41, s41 = index, []
                  r42 = _nt_primary
                  s41 << r42
                  if r42
                    r44 = _nt_space
                    if r44
                      r43 = r44
                    else
                      r43 = instantiate_node(SyntaxNode,input, index...index)
                    end
                    s41 << r43
                    if r43
                      if (match_len = has_terminal?("!=", false, index))
                        r45 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                        @index += match_len
                      else
                        terminal_parse_failure('"!="')
                        r45 = nil
                      end
                      s41 << r45
                      if r45
                        r47 = _nt_space
                        if r47
                          r46 = r47
                        else
                          r46 = instantiate_node(SyntaxNode,input, index...index)
                        end
                        s41 << r46
                        if r46
                          r48 = _nt_primary
                          s41 << r48
                        end
                      end
                    end
                  end
                  if s41.last
                    r41 = instantiate_node(DifferenceComparison,input, i41...index, s41)
                    r41.extend(Comparative5)
                  else
                    @index = i41
                    r41 = nil
                  end
                  if r41
                    r41 = SyntaxNode.new(input, (index-1)...index) if r41 == true
                    r0 = r41
                  else
                    @index = i0
                    r0 = nil
                  end
                end
              end
            end
          end
        end

        node_cache[:comparative][start_index] = r0

        r0
      end

      module Presence0
        def object
          elements[0]
        end
      end

      module Presence1
        def variable
          elements[0]
        end
      end

      def _nt_presence
        start_index = index
        if node_cache[:presence].has_key?(index)
          cached = node_cache[:presence][index]
          if cached
            node_cache[:presence][index] = 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_object
        s1 << r2
        if r2
          if (match_len = has_terminal?("?", false, index))
            r3 = true
            @index += match_len
          else
            terminal_parse_failure('"?"')
            r3 = nil
          end
          s1 << r3
        end
        if s1.last
          r1 = instantiate_node(ActorPresenceTest,input, i1...index, s1)
          r1.extend(Presence0)
        else
          @index = i1
          r1 = nil
        end
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          i4, s4 = index, []
          r5 = _nt_variable
          s4 << r5
          if r5
            if (match_len = has_terminal?("?", false, index))
              r6 = true
              @index += match_len
            else
              terminal_parse_failure('"?"')
              r6 = nil
            end
            s4 << r6
          end
          if s4.last
            r4 = instantiate_node(VariablePresenceTest,input, i4...index, s4)
            r4.extend(Presence1)
          else
            @index = i4
            r4 = nil
          end
          if r4
            r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
            r0 = r4
          else
            @index = i0
            r0 = nil
          end
        end

        node_cache[:presence][start_index] = r0

        r0
      end

      module Indicative0
        def object
          elements[0]
        end

        def indicator
          elements[2]
        end
      end

      module Indicative1
        def object
          elements[0]
        end

        def indicator
          elements[2]
        end
      end

      def _nt_indicative
        start_index = index
        if node_cache[:indicative].has_key?(index)
          cached = node_cache[:indicative][index]
          if cached
            node_cache[:indicative][index] = 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_object
        s1 << r2
        if r2
          if (match_len = has_terminal?(".", false, index))
            r3 = true
            @index += match_len
          else
            terminal_parse_failure('"."')
            r3 = nil
          end
          s1 << r3
          if r3
            r4 = _nt_indicator
            s1 << r4
            if r4
              if (match_len = has_terminal?("?", false, index))
                r5 = true
                @index += match_len
              else
                terminal_parse_failure('"?"')
                r5 = nil
              end
              s1 << r5
            end
          end
        end
        if s1.last
          r1 = instantiate_node(IndicatorPresenceTest,input, i1...index, s1)
          r1.extend(Indicative0)
        else
          @index = i1
          r1 = nil
        end
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          i6, s6 = index, []
          r7 = _nt_object
          s6 << r7
          if r7
            if (match_len = has_terminal?("..", false, index))
              r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
              @index += match_len
            else
              terminal_parse_failure('".."')
              r8 = nil
            end
            s6 << r8
            if r8
              r9 = _nt_indicator
              s6 << r9
              if r9
                if (match_len = has_terminal?("?", false, index))
                  r10 = true
                  @index += match_len
                else
                  terminal_parse_failure('"?"')
                  r10 = nil
                end
                s6 << r10
              end
            end
          end
          if s6.last
            r6 = instantiate_node(IndividualIndicatorPresenceTest,input, i6...index, s6)
            r6.extend(Indicative1)
          else
            @index = i6
            r6 = nil
          end
          if r6
            r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
            r0 = r6
          else
            @index = i0
            r0 = nil
          end
        end

        node_cache[:indicative][start_index] = r0

        r0
      end

      module Negative0
        def negated_test
          elements[1]
        end
      end

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

        i0, s0 = index, []
        if (match_len = has_terminal?("!", false, index))
          r1 = true
          @index += match_len
        else
          terminal_parse_failure('"!"')
          r1 = nil
        end
        s0 << r1
        if r1
          r2 = _nt_negated_test
          s0 << r2
        end
        if s0.last
          r0 = instantiate_node(NegativeTest,input, i0...index, s0)
          r0.extend(Negative0)
        else
          @index = i0
          r0 = nil
        end

        node_cache[:negative][start_index] = r0

        r0
      end

      module NegatedTest0
        def boolean_expression
          elements[1]
        end
      end

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

        i0 = index
        r1 = _nt_indicative
        if r1
          r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
          r0 = r1
        else
          r2 = _nt_presence
          if r2
            r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
            r0 = r2
          else
            i3, s3 = index, []
            if (match_len = has_terminal?("(", false, index))
              r4 = true
              @index += match_len
            else
              terminal_parse_failure('"("')
              r4 = nil
            end
            s3 << r4
            if r4
              r5 = _nt_boolean_expression
              s3 << r5
              if r5
                if (match_len = has_terminal?(")", false, index))
                  r6 = true
                  @index += match_len
                else
                  terminal_parse_failure('")"')
                  r6 = nil
                end
                s3 << r6
              end
            end
            if s3.last
              r3 = instantiate_node(BooleanExpression,input, i3...index, s3)
              r3.extend(NegatedTest0)
            else
              @index = i3
              r3 = nil
            end
            if r3
              r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
              r0 = r3
            else
              @index = i0
              r0 = nil
            end
          end
        end

        node_cache[:negated_test][start_index] = r0

        r0
      end
    end

    class LanguageParser < Treetop::Runtime::CompiledParser
      include Language
    end
  end
end
