Module: OracleSqlParser::Grammar::Condition

Includes:
Between, Comparison, Compound, Exists, FloatingPoint, In, IsOfType, Multiset, Null, PatternMatching, Treetop::Runtime
Included in:
ConditionParser, Grammar
Defined in:
lib/oracle-sql-parser/grammar/condition.rb,
lib/oracle-sql-parser/grammar/condition/in.rb,
lib/oracle-sql-parser/grammar/condition/null.rb,
lib/oracle-sql-parser/grammar/condition/exists.rb,
lib/oracle-sql-parser/grammar/condition/between.rb,
lib/oracle-sql-parser/grammar/condition/compound.rb,
lib/oracle-sql-parser/grammar/condition/multiset.rb,
lib/oracle-sql-parser/grammar/condition/comparison.rb,
lib/oracle-sql-parser/grammar/condition/is_of_type.rb,
lib/oracle-sql-parser/grammar/condition/floating_point.rb,
lib/oracle-sql-parser/grammar/condition/pattern_matching.rb

Defined Under Namespace

Modules: Between, Comparison, Compound, Condition0, Exists, FloatingPoint, In, IsOfType, LogicalCondition0, LogicalCondition1, LogicalCondition2, LogicalCondition3, LogicalCondition4, Multiset, Null, PatternMatching, WhereClause0, WhereClause1 Classes: BetweenParser, ComparisonParser, CompoundParser, ExistsParser, FloatingPointParser, InParser, IsOfTypeParser, MultisetParser, NullParser, PatternMatchingParser

Instance Method Summary collapse

Methods included from IsOfType

#_nt_is_of_type_condition, #_nt_only_and_type, #_nt_type, #_nt_types

Methods included from In

#_nt_in_condition

Methods included from Exists

#_nt_exists_condition

Methods included from Between

#_nt_between_condition

Methods included from Compound

#_nt_compound_condition

Methods included from Null

#_nt_null_condition

Methods included from PatternMatching

#_nt_like_condition, #_nt_pattern_maching_condition, #_nt_regexp_like_condition

Methods included from Multiset

#_nt_is_a_set_condition, #_nt_is_empty_condition, #_nt_member_condition, #_nt_mutiset_condition, #_nt_nested_table, #_nt_submultiset_condition

Methods included from FloatingPoint

#_nt_floating_point_condition

Methods included from Comparison

#_nt_comparison_condition, #_nt_group_comparison_condition, #_nt_simple_comparison_condition

Instance Method Details

#_nt_conditionObject



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/oracle-sql-parser/grammar/condition.rb', line 95

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

  i0 = index
  r1 = _nt_comparison_condition
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
  else
    r2 = _nt_floating_point_condition
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
    else
      r3 = _nt_model_condition
      if r3
        r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
        r0 = r3
      else
        r4 = _nt_mutiset_condition
        if r4
          r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
          r0 = r4
        else
          r5 = _nt_pattern_maching_condition
          if r5
            r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
            r0 = r5
          else
            r6 = _nt_null_condition
            if r6
              r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
              r0 = r6
            else
              r7 = _nt_xml_condition
              if r7
                r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
                r0 = r7
              else
                r8 = _nt_compound_condition
                if r8
                  r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
                  r0 = r8
                else
                  r9 = _nt_between_condition
                  if r9
                    r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
                    r0 = r9
                  else
                    r10 = _nt_exists_condition
                    if r10
                      r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
                      r0 = r10
                    else
                      r11 = _nt_in_condition
                      if r11
                        r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
                        r0 = r11
                      else
                        r12 = _nt_is_of_type_condition
                        r12.extend(Condition0)
                        r12.extend(Condition0)
                        if r12
                          r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
                          r0 = r12
                        else
                          @index = i0
                          r0 = nil
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  end

  node_cache[:condition][start_index] = r0

  r0
end

#_nt_logical_conditionObject



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/oracle-sql-parser/grammar/condition.rb', line 252

def _nt_logical_condition
  start_index = index
  if node_cache[:logical_condition].has_key?(index)
    cached = node_cache[:logical_condition][index]
    if cached
      node_cache[:logical_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_not_keyword
  s1 << r2
  if r2
    r4 = _nt_space
    if r4
      r3 = r4
    else
      r3 = instantiate_node(SyntaxNode,input, index...index)
    end
    s1 << r3
    if r3
      r5 = _nt_condition
      s1 << r5
    end
  end
  if s1.last
    r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
    r1.extend(LogicalCondition0)
  else
    @index = i1
    r1 = nil
  end
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
    r0.extend(LogicalCondition4)
    r0.extend(LogicalCondition4)
  else
    i6, s6 = index, []
    r7 = _nt_condition
    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_and_keyword
        s6 << r10
        if r10
          r12 = _nt_space
          if r12
            r11 = r12
          else
            r11 = instantiate_node(SyntaxNode,input, index...index)
          end
          s6 << r11
          if r11
            r13 = _nt_condition
            s6 << r13
          end
        end
      end
    end
    if s6.last
      r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
      r6.extend(LogicalCondition1)
    else
      @index = i6
      r6 = nil
    end
    if r6
      r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
      r0 = r6
      r0.extend(LogicalCondition4)
      r0.extend(LogicalCondition4)
    else
      i14, s14 = index, []
      r15 = _nt_condition
      s14 << r15
      if r15
        r17 = _nt_space
        if r17
          r16 = r17
        else
          r16 = instantiate_node(SyntaxNode,input, index...index)
        end
        s14 << r16
        if r16
          r18 = _nt_or_keyword
          s14 << r18
          if r18
            r20 = _nt_space
            if r20
              r19 = r20
            else
              r19 = instantiate_node(SyntaxNode,input, index...index)
            end
            s14 << r19
            if r19
              r21 = _nt_condition
              s14 << r21
            end
          end
        end
      end
      if s14.last
        r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
        r14.extend(LogicalCondition2)
      else
        @index = i14
        r14 = nil
      end
      if r14
        r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
        r0 = r14
        r0.extend(LogicalCondition4)
        r0.extend(LogicalCondition4)
      else
        i22, s22 = index, []
        r23 = _nt_condition
        s22 << r23
        if s22.last
          r22 = instantiate_node(SyntaxNode,input, i22...index, s22)
          r22.extend(LogicalCondition3)
        else
          @index = i22
          r22 = nil
        end
        if r22
          r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
          r0 = r22
          r0.extend(LogicalCondition4)
          r0.extend(LogicalCondition4)
        else
          @index = i0
          r0 = nil
        end
      end
    end
  end

  node_cache[:logical_condition][start_index] = r0

  r0
end

#_nt_model_conditionObject



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/oracle-sql-parser/grammar/condition.rb', line 405

def _nt_model_condition
  start_index = index
  if node_cache[:model_condition].has_key?(index)
    cached = node_cache[:model_condition][index]
    if cached
      node_cache[:model_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?('model_condition', false, index))
    r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
    @index += match_len
  else
    terminal_parse_failure('\'model_condition\'')
    r0 = nil
  end

  node_cache[:model_condition][start_index] = r0

  r0
end

#_nt_where_clauseObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/oracle-sql-parser/grammar/condition.rb', line 48

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

  i0, s0 = index, []
  r1 = _nt_where_keyword
  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_logical_condition
      s0 << r4
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(WhereClause0)
    r0.extend(WhereClause1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:where_clause][start_index] = r0

  r0
end

#_nt_xml_conditionObject



429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/oracle-sql-parser/grammar/condition.rb', line 429

def _nt_xml_condition
  start_index = index
  if node_cache[:xml_condition].has_key?(index)
    cached = node_cache[:xml_condition][index]
    if cached
      node_cache[:xml_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?('xml_condition', false, index))
    r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
    @index += match_len
  else
    terminal_parse_failure('\'xml_condition\'')
    r0 = nil
  end

  node_cache[:xml_condition][start_index] = r0

  r0
end

#rootObject



8
9
10
# File 'lib/oracle-sql-parser/grammar/condition.rb', line 8

def root
  @root ||= :where_clause
end