Module: OracleSqlParser::Grammar::Select::Group
- Includes:
- Treetop::Runtime
- Included in:
- OracleSqlParser::Grammar::Select, GroupParser
- Defined in:
- lib/oracle-sql-parser/grammar/select/group.rb
Defined Under Namespace
Modules: GroupByClause0, GroupByClause1, GroupByClause2, GroupByClause3, GroupColumn0, GroupingExpressionList0, GroupingSetsClause0, RollupCubeClause0, RollupCubeClause1
Instance Method Summary collapse
- #_nt_group_by_clause ⇒ Object
- #_nt_group_column ⇒ Object
- #_nt_grouping_expression_list ⇒ Object
- #_nt_grouping_sets_clause ⇒ Object
- #_nt_rollup_cube_clause ⇒ Object
- #root ⇒ Object
Instance Method Details
#_nt_group_by_clause ⇒ Object
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 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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/oracle-sql-parser/grammar/select/group.rb', line 78 def _nt_group_by_clause start_index = index if node_cache[:group_by_clause].has_key?(index) cached = node_cache[:group_by_clause][index] if cached node_cache[:group_by_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_group_keyword s0 << r1 if r1 r2 = _nt_space s0 << r2 if r2 r3 = _nt_by_keyword s0 << r3 if r3 r4 = _nt_space s0 << r4 if r4 r5 = _nt_group_column s0 << r5 if r5 r7 = _nt_space if r7 r6 = r7 else r6 = instantiate_node(SyntaxNode,input, index...index) end s0 << r6 if r6 s8, i8 = [], index loop do i9, s9 = index, [] if (match_len = has_terminal?(',', false, index)) r10 = true @index += match_len else terminal_parse_failure('\',\'') r10 = nil end s9 << r10 if r10 r12 = _nt_space if r12 r11 = r12 else r11 = instantiate_node(SyntaxNode,input, index...index) end s9 << r11 if r11 r13 = _nt_group_column s9 << r13 if r13 r15 = _nt_space if r15 r14 = r15 else r14 = instantiate_node(SyntaxNode,input, index...index) end s9 << r14 end end end if s9.last r9 = instantiate_node(SyntaxNode,input, i9...index, s9) r9.extend(GroupByClause0) else @index = i9 r9 = nil end if r9 s8 << r9 else break end end r8 = instantiate_node(SyntaxNode,input, i8...index, s8) s0 << r8 if r8 i17, s17 = index, [] r18 = _nt_having_keyword s17 << r18 if r18 r19 = _nt_space s17 << r19 if r19 r20 = _nt_condition s17 << r20 end end if s17.last r17 = instantiate_node(SyntaxNode,input, i17...index, s17) r17.extend(GroupByClause1) else @index = i17 r17 = nil end if r17 r16 = r17 else r16 = instantiate_node(SyntaxNode,input, index...index) end s0 << r16 end end end end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(GroupByClause2) r0.extend(GroupByClause3) else @index = i0 r0 = nil end node_cache[:group_by_clause][start_index] = r0 r0 end |
#_nt_group_column ⇒ Object
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 |
# File 'lib/oracle-sql-parser/grammar/select/group.rb', line 213 def _nt_group_column start_index = index if node_cache[:group_column].has_key?(index) cached = node_cache[:group_column][index] if cached node_cache[:group_column][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_expr if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 r0.extend(GroupColumn0) r0.extend(GroupColumn0) else r2 = _nt_rollup_cube_clause if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 r0.extend(GroupColumn0) r0.extend(GroupColumn0) else r3 = _nt_grouping_sets_clause if r3 r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true r0 = r3 r0.extend(GroupColumn0) r0.extend(GroupColumn0) else @index = i0 r0 = nil end end end node_cache[:group_column][start_index] = r0 r0 end |
#_nt_grouping_expression_list ⇒ Object
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/oracle-sql-parser/grammar/select/group.rb', line 369 def _nt_grouping_expression_list start_index = index if node_cache[:grouping_expression_list].has_key?(index) cached = node_cache[:grouping_expression_list][index] if cached node_cache[:grouping_expression_list][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end r0 = _nt_expression_list r0.extend(GroupingExpressionList0) r0.extend(GroupingExpressionList0) node_cache[:grouping_expression_list][start_index] = r0 r0 end |
#_nt_grouping_sets_clause ⇒ Object
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/oracle-sql-parser/grammar/select/group.rb', line 338 def _nt_grouping_sets_clause start_index = index if node_cache[:grouping_sets_clause].has_key?(index) cached = node_cache[:grouping_sets_clause][index] if cached node_cache[:grouping_sets_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?('grouping_sets_clause', false, index)) r0 = instantiate_node(SyntaxNode,input, index...(index + match_len)) r0.extend(GroupingSetsClause0) @index += match_len else terminal_parse_failure('\'grouping_sets_clause\'') r0 = nil end node_cache[:grouping_sets_clause][start_index] = r0 r0 end |
#_nt_rollup_cube_clause ⇒ Object
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 |
# File 'lib/oracle-sql-parser/grammar/select/group.rb', line 276 def _nt_rollup_cube_clause start_index = index if node_cache[:rollup_cube_clause].has_key?(index) cached = node_cache[:rollup_cube_clause][index] if cached node_cache[:rollup_cube_clause][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_rollup_keyword if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r1 = r2 else r3 = _nt_cube_keyword 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 r5 = _nt_space if r5 r4 = r5 else r4 = instantiate_node(SyntaxNode,input, index...index) end s0 << r4 if r4 r6 = _nt_grouping_expression_list s0 << r6 end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(RollupCubeClause0) r0.extend(RollupCubeClause1) else @index = i0 r0 = nil end node_cache[:rollup_cube_clause][start_index] = r0 r0 end |