Module: OracleSqlParser::Grammar::Delete

Includes:
Treetop::Runtime
Included in:
DeleteParser, Grammar
Defined in:
lib/oracle-sql-parser/grammar/delete.rb

Defined Under Namespace

Modules: DeleteCondition0, DeleteCondition1, DeleteCurrentOf0, DeleteFromClause0, DeleteFromClause1, DeleteStatement0, DeleteStatement1, DeleteStatement2, DeleteTarget0, DeleteTarget1, DeleteTarget2, DeleteTargetSubquery0, DeleteTargetSubquery1, DeleteTargetSubquery2

Instance Method Summary collapse

Instance Method Details

#_nt_delete_conditionObject



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/oracle-sql-parser/grammar/delete.rb', line 412

def _nt_delete_condition
  start_index = index
  if node_cache[:delete_condition].has_key?(index)
    cached = node_cache[:delete_condition][index]
    if cached
      node_cache[:delete_condition][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
    r2 = _nt_space
    s0 << r2
    if r2
      i3 = index
      r4 = _nt_search_condition
      if r4
        r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
        r3 = r4
      else
        r5 = _nt_delete_current_of
        if r5
          r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
          r3 = r5
        else
          @index = i3
          r3 = nil
        end
      end
      s0 << r3
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(DeleteCondition0)
    r0.extend(DeleteCondition1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:delete_condition][start_index] = r0

  r0
end

#_nt_delete_current_ofObject



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/oracle-sql-parser/grammar/delete.rb', line 468

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

  r0 = _nt_current_of
  r0.extend(DeleteCurrentOf0)
  r0.extend(DeleteCurrentOf0)

  node_cache[:delete_current_of][start_index] = r0

  r0
end

#_nt_delete_from_clauseObject



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
# File 'lib/oracle-sql-parser/grammar/delete.rb', line 140

def _nt_delete_from_clause
  start_index = index
  if node_cache[:delete_from_clause].has_key?(index)
    cached = node_cache[:delete_from_clause][index]
    if cached
      node_cache[:delete_from_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_from_keyword
  s0 << r1
  if r1
    r2 = _nt_space
    s0 << r2
    if r2
      r3 = _nt_delete_target
      s0 << r3
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(DeleteFromClause0)
    r0.extend(DeleteFromClause1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:delete_from_clause][start_index] = r0

  r0
end

#_nt_delete_statementObject



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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/oracle-sql-parser/grammar/delete.rb', line 53

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

  i0, s0 = index, []
  r1 = _nt_delete_keyword
  s0 << r1
  if r1
    r2 = _nt_space
    s0 << r2
    if r2
      r3 = _nt_delete_from_clause
      s0 << r3
      if r3
        i5, s5 = index, []
        r6 = _nt_space
        s5 << r6
        if r6
          r7 = _nt_delete_condition
          s5 << r7
        end
        if s5.last
          r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
          r5.extend(DeleteStatement0)
        else
          @index = i5
          r5 = nil
        end
        if r5
          r4 = r5
        else
          r4 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r4
        if r4
          r9 = _nt_returning_clause
          if r9
            r8 = r9
          else
            r8 = instantiate_node(SyntaxNode,input, index...index)
          end
          s0 << r8
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(DeleteStatement1)
    r0.extend(DeleteStatement2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:delete_statement][start_index] = r0

  r0
end

#_nt_delete_targetObject



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/oracle-sql-parser/grammar/delete.rb', line 210

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

  i0, s0 = index, []
  i1 = index
  r2 = _nt_table_reference
  if r2
    r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
    r1 = r2
  else
    r3 = _nt_delete_target_subquery
    if r3
      r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
      r1 = r3
    else
      @index = i1
      r1 = nil
    end
  end
  s0 << r1
  if r1
    i5, s5 = index, []
    r6 = _nt_space
    s5 << r6
    if r6
      r7 = _nt_t_alias
      s5 << r7
    end
    if s5.last
      r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
      r5.extend(DeleteTarget0)
    else
      @index = i5
      r5 = nil
    end
    if r5
      r4 = r5
    else
      r4 = instantiate_node(SyntaxNode,input, index...index)
    end
    s0 << r4
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(DeleteTarget1)
    r0.extend(DeleteTarget2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:delete_target][start_index] = r0

  r0
end

#_nt_delete_target_subqueryObject



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
# File 'lib/oracle-sql-parser/grammar/delete.rb', line 304

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

  i0, s0 = index, []
  i2, s2 = index, []
  r3 = _nt_table_keyword
  s2 << r3
  if r3
    r4 = _nt_space
    s2 << r4
  end
  if s2.last
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    r2.extend(DeleteTargetSubquery0)
  else
    @index = i2
    r2 = nil
  end
  if r2
    r1 = r2
  else
    r1 = instantiate_node(SyntaxNode,input, index...index)
  end
  s0 << r1
  if r1
    if (match_len = has_terminal?('(', false, index))
      r5 = true
      @index += match_len
    else
      terminal_parse_failure('\'(\'')
      r5 = nil
    end
    s0 << r5
    if r5
      r7 = _nt_space
      if r7
        r6 = r7
      else
        r6 = instantiate_node(SyntaxNode,input, index...index)
      end
      s0 << r6
      if r6
        r8 = _nt_subquery
        s0 << r8
        if r8
          r10 = _nt_space
          if r10
            r9 = r10
          else
            r9 = instantiate_node(SyntaxNode,input, index...index)
          end
          s0 << r9
          if r9
            if (match_len = has_terminal?(')', false, index))
              r11 = true
              @index += match_len
            else
              terminal_parse_failure('\')\'')
              r11 = nil
            end
            s0 << r11
          end
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(DeleteTargetSubquery1)
    r0.extend(DeleteTargetSubquery2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:delete_target_subquery][start_index] = r0

  r0
end

#rootObject



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

def root
  @root ||= :delete_statement
end