Module: OracleSqlParser::Grammar::Select::Union
- Includes:
- Treetop::Runtime
- Included in:
- OracleSqlParser::Grammar::Select, UnionParser
- Defined in:
- lib/oracle-sql-parser/grammar/select/union.rb
Defined Under Namespace
Modules: SubqueriesWithUnion0, SubqueriesWithUnion1, SubqueriesWithUnion2, UnionAll0, UnionAll1, UnionAll2, UnionOrIntersectOrMinus0, UnionOrIntersectOrMinus1, UnionOrIntersectOrMinus2, UnionOrIntersectOrMinus3
Instance Method Summary collapse
- #_nt_subqueries_with_union ⇒ Object
- #_nt_union_all ⇒ Object
- #_nt_union_or_intersect_or_minus ⇒ Object
- #root ⇒ Object
Instance Method Details
#_nt_subqueries_with_union ⇒ Object
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 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 119 120 |
# File 'lib/oracle-sql-parser/grammar/select/union.rb', line 45 def _nt_subqueries_with_union start_index = index if node_cache[:subqueries_with_union].has_key?(index) cached = node_cache[:subqueries_with_union][index] if cached node_cache[:subqueries_with_union][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_query_block s0 << r1 if r1 r3 = _nt_space if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 if r2 s4, i4 = [], index loop do i5, s5 = index, [] r6 = _nt_union_or_intersect_or_minus s5 << r6 if r6 r8 = _nt_space if r8 r7 = r8 else r7 = instantiate_node(SyntaxNode,input, index...index) end s5 << r7 if r7 r9 = _nt_subquery s5 << r9 end end if s5.last r5 = instantiate_node(SyntaxNode,input, i5...index, s5) r5.extend(SubqueriesWithUnion0) else @index = i5 r5 = nil end if r5 s4 << r5 else break end end if s4.empty? @index = i4 r4 = nil else r4 = instantiate_node(SyntaxNode,input, i4...index, s4) end s0 << r4 end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(SubqueriesWithUnion1) r0.extend(SubqueriesWithUnion2) else @index = i0 r0 = nil end node_cache[:subqueries_with_union][start_index] = r0 r0 end |
#_nt_union_all ⇒ Object
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 |
# File 'lib/oracle-sql-parser/grammar/select/union.rb', line 252 def _nt_union_all start_index = index if node_cache[:union_all].has_key?(index) cached = node_cache[:union_all][index] if cached node_cache[:union_all][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_union_keyword s0 << r1 if r1 i3, s3 = index, [] r4 = _nt_space s3 << r4 if r4 r5 = _nt_all_keyword s3 << r5 end if s3.last r3 = instantiate_node(SyntaxNode,input, i3...index, s3) r3.extend(UnionAll0) else @index = i3 r3 = nil end if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(UnionAll1) r0.extend(UnionAll2) else @index = i0 r0 = nil end node_cache[:union_all][start_index] = r0 r0 end |
#_nt_union_or_intersect_or_minus ⇒ Object
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 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/oracle-sql-parser/grammar/select/union.rb', line 152 def _nt_union_or_intersect_or_minus start_index = index if node_cache[:union_or_intersect_or_minus].has_key?(index) cached = node_cache[:union_or_intersect_or_minus][index] if cached node_cache[:union_or_intersect_or_minus][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_union_all s1 << r2 if s1.last r1 = instantiate_node(SyntaxNode,input, i1...index, s1) r1.extend(UnionOrIntersectOrMinus0) else @index = i1 r1 = nil end if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 r0.extend(UnionOrIntersectOrMinus3) r0.extend(UnionOrIntersectOrMinus3) else i3, s3 = index, [] r4 = _nt_intersect_keyword s3 << r4 if s3.last r3 = instantiate_node(SyntaxNode,input, i3...index, s3) r3.extend(UnionOrIntersectOrMinus1) else @index = i3 r3 = nil end if r3 r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true r0 = r3 r0.extend(UnionOrIntersectOrMinus3) r0.extend(UnionOrIntersectOrMinus3) else i5, s5 = index, [] r6 = _nt_minus_keyword s5 << r6 if s5.last r5 = instantiate_node(SyntaxNode,input, i5...index, s5) r5.extend(UnionOrIntersectOrMinus2) else @index = i5 r5 = nil end if r5 r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true r0 = r5 r0.extend(UnionOrIntersectOrMinus3) r0.extend(UnionOrIntersectOrMinus3) else @index = i0 r0 = nil end end end node_cache[:union_or_intersect_or_minus][start_index] = r0 r0 end |