Module: OracleSqlParser::Grammar::Select::Join

Includes:
Treetop::Runtime
Included in:
OracleSqlParser::Grammar::Select, JoinParser
Defined in:
lib/oracle-sql-parser/grammar/select/join.rb

Defined Under Namespace

Modules: ColumnList0, ColumnList1, ColumnList2, CrossJoinClause0, CrossJoinClause1, CrossNaturalJoin0, CrossNaturalJoin1, CrossNaturalJoin2, CrossNaturalJoin3, CrossNaturalJoin4, InnerCrossJoinClause0, InnerJoin0, InnerJoinClause0, InnerJoinClause1, JoinClause0, JoinClause1, OnClause0, OnClause1, OnOrUsingClause0, OuterJoinClause0, OuterJoinClause1, OuterJoinClause2, OuterJoinClause3, OuterJoinType0, OuterJoinType1, OuterJoinType2, QueryPartitionClause0, UsingClause0, UsingClause1

Instance Method Summary collapse

Instance Method Details

#_nt_column_listObject



684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 684

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

  i0, s0 = index, []
  r1 = _nt_column_name
  s0 << r1
  if r1
    s2, i2 = [], index
    loop do
      i3, s3 = index, []
      r5 = _nt_space
      if r5
        r4 = r5
      else
        r4 = instantiate_node(SyntaxNode,input, index...index)
      end
      s3 << r4
      if r4
        if (match_len = has_terminal?(',', false, index))
          r6 = true
          @index += match_len
        else
          terminal_parse_failure('\',\'')
          r6 = nil
        end
        s3 << r6
        if r6
          r8 = _nt_space
          if r8
            r7 = r8
          else
            r7 = instantiate_node(SyntaxNode,input, index...index)
          end
          s3 << r7
          if r7
            r9 = _nt_column_name
            s3 << r9
          end
        end
      end
      if s3.last
        r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
        r3.extend(ColumnList0)
      else
        @index = i3
        r3 = nil
      end
      if r3
        s2 << r3
      else
        break
      end
    end
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    s0 << r2
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(ColumnList1)
    r0.extend(ColumnList2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:column_list][start_index] = r0

  r0
end

#_nt_cross_join_clauseObject



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 478

def _nt_cross_join_clause
  start_index = index
  if node_cache[:cross_join_clause].has_key?(index)
    cached = node_cache[:cross_join_clause][index]
    if cached
      node_cache[:cross_join_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_cross_natural_join
  s0 << r1
  if r1
    r2 = _nt_space
    s0 << r2
    if r2
      r3 = _nt_table_reference
      s0 << r3
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(CrossJoinClause0)
    r0.extend(CrossJoinClause1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:cross_join_clause][start_index] = r0

  r0
end

#_nt_cross_natural_joinObject



565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 565

def _nt_cross_natural_join
  start_index = index
  if node_cache[:cross_natural_join].has_key?(index)
    cached = node_cache[:cross_natural_join][index]
    if cached
      node_cache[:cross_natural_join][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, []
  r3 = _nt_cross_keyword
  s2 << r3
  if s2.last
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    r2.extend(CrossNaturalJoin0)
  else
    @index = i2
    r2 = nil
  end
  if r2
    r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
    r1 = r2
  else
    i4, s4 = index, []
    r5 = _nt_natural_keyword
    s4 << r5
    if r5
      i7, s7 = index, []
      r8 = _nt_space
      s7 << r8
      if r8
        r9 = _nt_inner_keyword
        s7 << r9
      end
      if s7.last
        r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
        r7.extend(CrossNaturalJoin1)
      else
        @index = i7
        r7 = nil
      end
      if r7
        r6 = r7
      else
        r6 = instantiate_node(SyntaxNode,input, index...index)
      end
      s4 << r6
    end
    if s4.last
      r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
      r4.extend(CrossNaturalJoin2)
    else
      @index = i4
      r4 = nil
    end
    if r4
      r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
      r1 = r4
    else
      @index = i1
      r1 = nil
    end
  end
  s0 << r1
  if r1
    r10 = _nt_space
    s0 << r10
    if r10
      r11 = _nt_join_keyword
      s0 << r11
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(CrossNaturalJoin3)
    r0.extend(CrossNaturalJoin4)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:cross_natural_join][start_index] = r0

  r0
end

#_nt_inner_cross_join_clauseObject



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
119
120
121
122
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 90

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

  i0 = index
  r1 = _nt_inner_join_clause
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
  else
    r2 = _nt_cross_join_clause
    r2.extend(InnerCrossJoinClause0)
    r2.extend(InnerCrossJoinClause0)
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
    else
      @index = i0
      r0 = nil
    end
  end

  node_cache[:inner_cross_join_clause][start_index] = r0

  r0
end

#_nt_inner_joinObject



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

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

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

  node_cache[:inner_join][start_index] = r0

  r0
end

#_nt_inner_join_clauseObject



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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 149

def _nt_inner_join_clause
  start_index = index
  if node_cache[:inner_join_clause].has_key?(index)
    cached = node_cache[:inner_join_clause][index]
    if cached
      node_cache[:inner_join_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_inner_join
  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_table_reference
      s0 << r4
      if r4
        r6 = _nt_space
        if r6
          r5 = r6
        else
          r5 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r5
        if r5
          r7 = _nt_on_or_using_clause
          s0 << r7
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(InnerJoinClause0)
    r0.extend(InnerJoinClause1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:inner_join_clause][start_index] = r0

  r0
end

#_nt_join_clauseObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 34

def _nt_join_clause
  start_index = index
  if node_cache[:join_clause].has_key?(index)
    cached = node_cache[:join_clause][index]
    if cached
      node_cache[:join_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_table_reference
  s0 << r1
  if r1
    r2 = _nt_space
    s0 << r2
    if r2
      i3 = index
      r4 = _nt_outer_join_clause
      if r4
        r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
        r3 = r4
      else
        r5 = _nt_inner_cross_join_clause
        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(JoinClause0)
    r0.extend(JoinClause1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:join_clause][start_index] = r0

  r0
end

#_nt_on_clauseObject



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

def _nt_on_clause
  start_index = index
  if node_cache[:on_clause].has_key?(index)
    cached = node_cache[:on_clause][index]
    if cached
      node_cache[:on_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_on_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_condition
      s0 << r4
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(OnClause0)
    r0.extend(OnClause1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:on_clause][start_index] = r0

  r0
end

#_nt_on_or_using_clauseObject



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

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

  i0 = index
  r1 = _nt_on_clause
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
  else
    r2 = _nt_using_clause
    r2.extend(OnOrUsingClause0)
    r2.extend(OnOrUsingClause0)
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
    else
      @index = i0
      r0 = nil
    end
  end

  node_cache[:on_or_using_clause][start_index] = r0

  r0
end

#_nt_outer_join_clauseObject



821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 821

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

  i0, s0 = index, []
  r2 = _nt_query_partition_clause
  if r2
    r1 = r2
  else
    r1 = instantiate_node(SyntaxNode,input, index...index)
  end
  s0 << r1
  if r1
    i3, s3 = index, []
    r5 = _nt_natural_keyword
    if r5
      r4 = r5
    else
      r4 = instantiate_node(SyntaxNode,input, index...index)
    end
    s3 << r4
    if r4
      r7 = _nt_space
      if r7
        r6 = r7
      else
        r6 = instantiate_node(SyntaxNode,input, index...index)
      end
      s3 << r6
      if r6
        r9 = _nt_outer_join_type
        if r9
          r8 = r9
        else
          r8 = instantiate_node(SyntaxNode,input, index...index)
        end
        s3 << r8
        if r8
          r11 = _nt_space
          if r11
            r10 = r11
          else
            r10 = instantiate_node(SyntaxNode,input, index...index)
          end
          s3 << r10
          if r10
            r12 = _nt_join_keyword
            s3 << r12
          end
        end
      end
    end
    if s3.last
      r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
      r3.extend(OuterJoinClause0)
    else
      @index = i3
      r3 = nil
    end
    s0 << r3
    if r3
      r13 = _nt_space
      s0 << r13
      if r13
        r14 = _nt_table_reference
        s0 << r14
        if r14
          r15 = _nt_space
          s0 << r15
          if r15
            i17, s17 = index, []
            r18 = _nt_query_partition_clause
            s17 << r18
            if r18
              r19 = _nt_space
              s17 << r19
            end
            if s17.last
              r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
              r17.extend(OuterJoinClause1)
            else
              @index = i17
              r17 = nil
            end
            if r17
              r16 = r17
            else
              r16 = instantiate_node(SyntaxNode,input, index...index)
            end
            s0 << r16
            if r16
              r20 = _nt_on_or_using_clause
              s0 << r20
            end
          end
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(OuterJoinClause2)
    r0.extend(OuterJoinClause3)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:outer_join_clause][start_index] = r0

  r0
end

#_nt_outer_join_typeObject



998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 998

def _nt_outer_join_type
  start_index = index
  if node_cache[:outer_join_type].has_key?(index)
    cached = node_cache[:outer_join_type][index]
    if cached
      node_cache[:outer_join_type][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_full_keyword
  if r2
    r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
    r1 = r2
  else
    r3 = _nt_left_keyword
    if r3
      r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
      r1 = r3
    else
      r4 = _nt_right_keyword
      if r4
        r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
        r1 = r4
      else
        @index = i1
        r1 = nil
      end
    end
  end
  s0 << r1
  if r1
    i6, s6 = index, []
    r7 = _nt_space
    s6 << r7
    if r7
      r8 = _nt_outer_keyword
      s6 << r8
    end
    if s6.last
      r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
      r6.extend(OuterJoinType0)
    else
      @index = i6
      r6 = nil
    end
    if r6
      r5 = r6
    else
      r5 = instantiate_node(SyntaxNode,input, index...index)
    end
    s0 << r5
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(OuterJoinType1)
    r0.extend(OuterJoinType2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:outer_join_type][start_index] = r0

  r0
end

#_nt_query_partition_clauseObject



947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 947

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

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

  node_cache[:query_partition_clause][start_index] = r0

  r0
end

#_nt_using_clauseObject



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
404
405
406
407
408
409
410
411
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
# File 'lib/oracle-sql-parser/grammar/select/join.rb', line 373

def _nt_using_clause
  start_index = index
  if node_cache[:using_clause].has_key?(index)
    cached = node_cache[:using_clause][index]
    if cached
      node_cache[:using_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_using_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
      if (match_len = has_terminal?('(', false, index))
        r4 = true
        @index += match_len
      else
        terminal_parse_failure('\'(\'')
        r4 = nil
      end
      s0 << r4
      if r4
        r6 = _nt_space
        if r6
          r5 = r6
        else
          r5 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r5
        if r5
          r7 = _nt_column_list
          s0 << r7
          if r7
            r9 = _nt_space
            if r9
              r8 = r9
            else
              r8 = instantiate_node(SyntaxNode,input, index...index)
            end
            s0 << r8
            if r8
              if (match_len = has_terminal?(')', false, index))
                r10 = true
                @index += match_len
              else
                terminal_parse_failure('\')\'')
                r10 = nil
              end
              s0 << r10
            end
          end
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(UsingClause0)
    r0.extend(UsingClause1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:using_clause][start_index] = r0

  r0
end

#rootObject



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

def root
  @root ||= :join_clause
end