module OracleSqlParser::Grammar::Condition::Comparison

Public Instance Methods

_nt_comparison_condition() click to toggle source
# File lib/oracle-sql-parser/grammar/condition/comparison.rb, line 18
def _nt_comparison_condition
  start_index = index
  if node_cache[:comparison_condition].has_key?(index)
    cached = node_cache[:comparison_condition][index]
    if cached
      node_cache[:comparison_condition][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0 = index
  r1 = _nt_simple_comparison_condition
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
    r0.extend(ComparisonCondition0)
    r0.extend(ComparisonCondition0)
  else
    r2 = _nt_group_comparison_condition
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
      r0.extend(ComparisonCondition0)
      r0.extend(ComparisonCondition0)
    else
      @index = i0
      r0 = nil
    end
  end

  node_cache[:comparison_condition][start_index] = r0

  r0
end
_nt_group_comparison_condition() click to toggle source
# File lib/oracle-sql-parser/grammar/condition/comparison.rb, line 54
def _nt_group_comparison_condition
  start_index = index
  if node_cache[:group_comparison_condition].has_key?(index)
    cached = node_cache[:group_comparison_condition][index]
    if cached
      node_cache[:group_comparison_condition][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  if (match_len = has_terminal?('group_comparison_condition', false, index))
    r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
    @index += match_len
  else
    terminal_parse_failure('\'group_comparison_condition\'')
    r0 = nil
  end

  node_cache[:group_comparison_condition][start_index] = r0

  r0
end
_nt_simple_comparison_condition() click to toggle source
# File lib/oracle-sql-parser/grammar/condition/comparison.rb, line 116
def _nt_simple_comparison_condition
  start_index = index
  if node_cache[:simple_comparison_condition].has_key?(index)
    cached = node_cache[:simple_comparison_condition][index]
    if cached
      node_cache[:simple_comparison_condition][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_expr
  s1 << r2
  if r2
    r4 = _nt_space
    if r4
      r3 = r4
    else
      r3 = instantiate_node(SyntaxNode,input, index...index)
    end
    s1 << r3
    if r3
      i5 = index
      if (match_len = has_terminal?('!=', false, index))
        r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
        @index += match_len
      else
        terminal_parse_failure('\'!=\'')
        r6 = nil
      end
      if r6
        r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
        r5 = r6
      else
        if (match_len = has_terminal?('^=', false, index))
          r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
          @index += match_len
        else
          terminal_parse_failure('\'^=\'')
          r7 = nil
        end
        if r7
          r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
          r5 = r7
        else
          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
          if r8
            r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
            r5 = r8
          else
            if (match_len = has_terminal?('>=', false, index))
              r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
              @index += match_len
            else
              terminal_parse_failure('\'>=\'')
              r9 = nil
            end
            if r9
              r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
              r5 = r9
            else
              if (match_len = has_terminal?('<=', false, index))
                r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                @index += match_len
              else
                terminal_parse_failure('\'<=\'')
                r10 = nil
              end
              if r10
                r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
                r5 = r10
              else
                if (match_len = has_terminal?('=', false, index))
                  r11 = true
                  @index += match_len
                else
                  terminal_parse_failure('\'=\'')
                  r11 = nil
                end
                if r11
                  r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
                  r5 = r11
                else
                  if (match_len = has_terminal?('>', false, index))
                    r12 = true
                    @index += match_len
                  else
                    terminal_parse_failure('\'>\'')
                    r12 = nil
                  end
                  if r12
                    r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
                    r5 = r12
                  else
                    if (match_len = has_terminal?('<', false, index))
                      r13 = true
                      @index += match_len
                    else
                      terminal_parse_failure('\'<\'')
                      r13 = nil
                    end
                    if r13
                      r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
                      r5 = r13
                    else
                      @index = i5
                      r5 = nil
                    end
                  end
                end
              end
            end
          end
        end
      end
      s1 << r5
      if r5
        r15 = _nt_space
        if r15
          r14 = r15
        else
          r14 = instantiate_node(SyntaxNode,input, index...index)
        end
        s1 << r14
        if r14
          r16 = _nt_expr
          s1 << r16
        end
      end
    end
  end
  if s1.last
    r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
    r1.extend(SimpleComparisonCondition0)
  else
    @index = i1
    r1 = nil
  end
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
    r0.extend(SimpleComparisonCondition2)
    r0.extend(SimpleComparisonCondition2)
  else
    i17, s17 = index, []
    if (match_len = has_terminal?('(', false, index))
      r18 = true
      @index += match_len
    else
      terminal_parse_failure('\'(\'')
      r18 = nil
    end
    s17 << r18
    if r18
      r20 = _nt_space
      if r20
        r19 = r20
      else
        r19 = instantiate_node(SyntaxNode,input, index...index)
      end
      s17 << r19
      if r19
        r21 = _nt_exprs
        s17 << r21
        if r21
          r23 = _nt_space
          if r23
            r22 = r23
          else
            r22 = instantiate_node(SyntaxNode,input, index...index)
          end
          s17 << r22
          if r22
            if (match_len = has_terminal?(')', false, index))
              r24 = true
              @index += match_len
            else
              terminal_parse_failure('\')\'')
              r24 = nil
            end
            s17 << r24
            if r24
              r26 = _nt_space
              if r26
                r25 = r26
              else
                r25 = instantiate_node(SyntaxNode,input, index...index)
              end
              s17 << r25
              if r25
                i27 = index
                if (match_len = has_terminal?('!=', false, index))
                  r28 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                  @index += match_len
                else
                  terminal_parse_failure('\'!=\'')
                  r28 = nil
                end
                if r28
                  r28 = SyntaxNode.new(input, (index-1)...index) if r28 == true
                  r27 = r28
                else
                  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
                  if r29
                    r29 = SyntaxNode.new(input, (index-1)...index) if r29 == true
                    r27 = r29
                  else
                    if (match_len = has_terminal?('<>', false, index))
                      r30 = instantiate_node(SyntaxNode,input, index...(index + match_len))
                      @index += match_len
                    else
                      terminal_parse_failure('\'<>\'')
                      r30 = nil
                    end
                    if r30
                      r30 = SyntaxNode.new(input, (index-1)...index) if r30 == true
                      r27 = r30
                    else
                      if (match_len = has_terminal?('=', false, index))
                        r31 = true
                        @index += match_len
                      else
                        terminal_parse_failure('\'=\'')
                        r31 = nil
                      end
                      if r31
                        r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
                        r27 = r31
                      else
                        @index = i27
                        r27 = nil
                      end
                    end
                  end
                end
                s17 << r27
                if r27
                  r33 = _nt_space
                  if r33
                    r32 = r33
                  else
                    r32 = instantiate_node(SyntaxNode,input, index...index)
                  end
                  s17 << r32
                  if r32
                    if (match_len = has_terminal?('(', false, index))
                      r34 = true
                      @index += match_len
                    else
                      terminal_parse_failure('\'(\'')
                      r34 = nil
                    end
                    s17 << r34
                    if r34
                      r36 = _nt_space
                      if r36
                        r35 = r36
                      else
                        r35 = instantiate_node(SyntaxNode,input, index...index)
                      end
                      s17 << r35
                      if r35
                        r37 = _nt_subquery
                        s17 << r37
                        if r37
                          r39 = _nt_space
                          if r39
                            r38 = r39
                          else
                            r38 = instantiate_node(SyntaxNode,input, index...index)
                          end
                          s17 << r38
                          if r38
                            if (match_len = has_terminal?(')', false, index))
                              r40 = true
                              @index += match_len
                            else
                              terminal_parse_failure('\')\'')
                              r40 = nil
                            end
                            s17 << r40
                          end
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
    if s17.last
      r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
      r17.extend(SimpleComparisonCondition1)
    else
      @index = i17
      r17 = nil
    end
    if r17
      r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
      r0 = r17
      r0.extend(SimpleComparisonCondition2)
      r0.extend(SimpleComparisonCondition2)
    else
      @index = i0
      r0 = nil
    end
  end

  node_cache[:simple_comparison_condition][start_index] = r0

  r0
end
root() click to toggle source
# File lib/oracle-sql-parser/grammar/condition/comparison.rb, line 8
def root
  @root ||= :comparison_condition
end