Module: OracleSqlParser::Grammar::Select::QueryBlock
- Includes:
- Treetop::Runtime
- Included in:
- OracleSqlParser::Grammar::Select, QueryBlockParser
- Defined in:
- lib/oracle-sql-parser/grammar/select/query_block.rb
Defined Under Namespace
Modules: ModelClause0, QueryBlock0, QueryBlock1, QueryBlock2, QueryBlock3, QueryBlock4, QueryBlock5, QueryBlock6, QueryBlock7, SelectColumn0, SelectColumn1, SelectColumn2, SelectColumn3, SelectList0, SelectList1, SelectList2, SelectOne0, SelectSource0, SelectSource1, SelectSources0, SelectSources1, SelectSources2, SelectTable0, SelectTable1, SelectTable2, SubqueryFactoringClause0
Instance Method Summary collapse
- #_nt_model_clause ⇒ Object
- #_nt_query_block ⇒ Object
- #_nt_select_column ⇒ Object
- #_nt_select_list ⇒ Object
- #_nt_select_one ⇒ Object
- #_nt_select_source ⇒ Object
- #_nt_select_sources ⇒ Object
- #_nt_select_table ⇒ Object
- #_nt_subquery_factoring_clause ⇒ Object
- #root ⇒ Object
Instance Method Details
#_nt_model_clause ⇒ Object
929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
# File 'lib/oracle-sql-parser/grammar/select/query_block.rb', line 929 def _nt_model_clause start_index = index if node_cache[:model_clause].has_key?(index) cached = node_cache[:model_clause][index] if cached node_cache[:model_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?('model_clause', false, index)) r0 = instantiate_node(SyntaxNode,input, index...(index + match_len)) r0.extend(ModelClause0) @index += match_len else terminal_parse_failure('\'model_clause\'') r0 = nil end node_cache[:model_clause][start_index] = r0 r0 end |
#_nt_query_block ⇒ Object
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 206 207 208 209 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 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 |
# File 'lib/oracle-sql-parser/grammar/select/query_block.rb', line 131 def _nt_query_block start_index = index if node_cache[:query_block].has_key?(index) cached = node_cache[:query_block][index] if cached node_cache[:query_block][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_subquery_factoring_clause s2 << r3 if r3 r4 = _nt_space s2 << r4 end if s2.last r2 = instantiate_node(SyntaxNode,input, i2...index, s2) r2.extend(QueryBlock0) else @index = i2 r2 = nil end if r2 r1 = r2 else r1 = instantiate_node(SyntaxNode,input, index...index) end s0 << r1 if r1 r5 = _nt_select_keyword s0 << r5 if r5 r6 = _nt_space s0 << r6 if r6 r8 = _nt_hint if r8 r7 = r8 else r7 = instantiate_node(SyntaxNode,input, index...index) end s0 << r7 if r7 i10, s10 = index, [] i11 = index r12 = _nt_all_keyword if r12 r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true r11 = r12 else r13 = _nt_distinct_keyword if r13 r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true r11 = r13 else r14 = _nt_unique_keyword if r14 r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true r11 = r14 else @index = i11 r11 = nil end end end s10 << r11 if r11 r15 = _nt_space s10 << r15 end if s10.last r10 = instantiate_node(SyntaxNode,input, i10...index, s10) r10.extend(QueryBlock1) else @index = i10 r10 = nil end if r10 r9 = r10 else r9 = instantiate_node(SyntaxNode,input, index...index) end s0 << r9 if r9 r16 = _nt_select_list s0 << r16 if r16 r17 = _nt_space s0 << r17 if r17 r18 = _nt_from_keyword s0 << r18 if r18 i20, s20 = index, [] r21 = _nt_space s20 << r21 if r21 r22 = _nt_select_sources s20 << r22 end if s20.last r20 = instantiate_node(SyntaxNode,input, i20...index, s20) r20.extend(QueryBlock2) else @index = i20 r20 = nil end if r20 r19 = r20 else r19 = instantiate_node(SyntaxNode,input, index...index) end s0 << r19 if r19 i24, s24 = index, [] r25 = _nt_space s24 << r25 if r25 r26 = _nt_where_clause s24 << r26 end if s24.last r24 = instantiate_node(SyntaxNode,input, i24...index, s24) r24.extend(QueryBlock3) else @index = i24 r24 = nil end if r24 r23 = r24 else r23 = instantiate_node(SyntaxNode,input, index...index) end s0 << r23 if r23 i28, s28 = index, [] r29 = _nt_space s28 << r29 if r29 r30 = _nt_group_by_clause s28 << r30 end if s28.last r28 = instantiate_node(SyntaxNode,input, i28...index, s28) r28.extend(QueryBlock4) else @index = i28 r28 = nil end if r28 r27 = r28 else r27 = instantiate_node(SyntaxNode,input, index...index) end s0 << r27 if r27 i32, s32 = index, [] r33 = _nt_space s32 << r33 if r33 r34 = _nt_model_clause s32 << r34 end if s32.last r32 = instantiate_node(SyntaxNode,input, i32...index, s32) r32.extend(QueryBlock5) else @index = i32 r32 = nil end if r32 r31 = r32 else r31 = instantiate_node(SyntaxNode,input, index...index) end s0 << r31 end end end end end end end end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(QueryBlock6) r0.extend(QueryBlock7) else @index = i0 r0 = nil end node_cache[:query_block][start_index] = r0 r0 end |
#_nt_select_column ⇒ Object
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 |
# File 'lib/oracle-sql-parser/grammar/select/query_block.rb', line 851 def _nt_select_column start_index = index if node_cache[:select_column].has_key?(index) cached = node_cache[:select_column][index] if cached node_cache[:select_column][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_expr s0 << r1 if r1 i3, s3 = index, [] r4 = _nt_space s3 << r4 if r4 i6, s6 = index, [] r7 = _nt_as_keyword s6 << r7 if r7 r8 = _nt_space s6 << r8 end if s6.last r6 = instantiate_node(SyntaxNode,input, i6...index, s6) r6.extend(SelectColumn0) else @index = i6 r6 = nil end if r6 r5 = r6 else r5 = instantiate_node(SyntaxNode,input, index...index) end s3 << r5 if r5 r9 = _nt_c_alias s3 << r9 end end if s3.last r3 = instantiate_node(SyntaxNode,input, i3...index, s3) r3.extend(SelectColumn1) 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(SelectColumn2) r0.extend(SelectColumn3) else @index = i0 r0 = nil end node_cache[:select_column][start_index] = r0 r0 end |
#_nt_select_list ⇒ Object
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 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 |
# File 'lib/oracle-sql-parser/grammar/select/query_block.rb', line 611 def _nt_select_list start_index = index if node_cache[:select_list].has_key?(index) cached = node_cache[:select_list][index] if cached node_cache[:select_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_select_one 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_select_one s3 << r9 end end end if s3.last r3 = instantiate_node(SyntaxNode,input, i3...index, s3) r3.extend(SelectList0) 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(SelectList1) r0.extend(SelectList2) else @index = i0 r0 = nil end node_cache[:select_list][start_index] = r0 r0 end |
#_nt_select_one ⇒ Object
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 |
# File 'lib/oracle-sql-parser/grammar/select/query_block.rb', line 695 def _nt_select_one start_index = index if node_cache[:select_one].has_key?(index) cached = node_cache[:select_one][index] if cached node_cache[:select_one][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_select_table if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 else r2 = _nt_select_column r2.extend(SelectOne0) r2.extend(SelectOne0) if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 else @index = i0 r0 = nil end end node_cache[:select_one][start_index] = r0 r0 end |
#_nt_select_source ⇒ Object
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 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 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
# File 'lib/oracle-sql-parser/grammar/select/query_block.rb', line 460 def _nt_select_source start_index = index if node_cache[:select_source].has_key?(index) cached = node_cache[:select_source][index] if cached node_cache[:select_source][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_join_clause if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 else i2, s2 = index, [] if (match_len = has_terminal?('(', false, index)) r3 = true @index += match_len else terminal_parse_failure('\'(\'') r3 = nil end s2 << r3 if r3 r5 = _nt_space if r5 r4 = r5 else r4 = instantiate_node(SyntaxNode,input, index...index) end s2 << r4 if r4 r6 = _nt_join_clause s2 << r6 if r6 r8 = _nt_space if r8 r7 = r8 else r7 = instantiate_node(SyntaxNode,input, index...index) end s2 << r7 if r7 if (match_len = has_terminal?(')', false, index)) r9 = true @index += match_len else terminal_parse_failure('\')\'') r9 = nil end s2 << r9 end end end end if s2.last r2 = instantiate_node(SyntaxNode,input, i2...index, s2) r2.extend(SelectSource0) else @index = i2 r2 = nil end if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 else r10 = _nt_table_reference if r10 r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true r0 = r10 else r11 = _nt_subquery r11.extend(SelectSource1) r11.extend(SelectSource1) if r11 r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true r0 = r11 else @index = i0 r0 = nil end end end end node_cache[:select_source][start_index] = r0 r0 end |
#_nt_select_sources ⇒ Object
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 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 |
# File 'lib/oracle-sql-parser/grammar/select/query_block.rb', line 365 def _nt_select_sources start_index = index if node_cache[:select_sources].has_key?(index) cached = node_cache[:select_sources][index] if cached node_cache[:select_sources][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_select_source 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_select_source s3 << r9 end end end if s3.last r3 = instantiate_node(SyntaxNode,input, i3...index, s3) r3.extend(SelectSources0) 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(SelectSources1) r0.extend(SelectSources2) else @index = i0 r0 = nil end node_cache[:select_sources][start_index] = r0 r0 end |
#_nt_select_table ⇒ Object
745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 |
# File 'lib/oracle-sql-parser/grammar/select/query_block.rb', line 745 def _nt_select_table start_index = index if node_cache[:select_table].has_key?(index) cached = node_cache[:select_table][index] if cached node_cache[:select_table][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_name s2 << r3 if r3 if (match_len = has_terminal?('.', false, index)) r4 = true @index += match_len else terminal_parse_failure('\'.\'') r4 = nil end s2 << r4 end if s2.last r2 = instantiate_node(SyntaxNode,input, i2...index, s2) r2.extend(SelectTable0) 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 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(SelectTable1) r0.extend(SelectTable2) else @index = i0 r0 = nil end node_cache[:select_table][start_index] = r0 r0 end |
#_nt_subquery_factoring_clause ⇒ Object
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
# File 'lib/oracle-sql-parser/grammar/select/query_block.rb', line 560 def _nt_subquery_factoring_clause start_index = index if node_cache[:subquery_factoring_clause].has_key?(index) cached = node_cache[:subquery_factoring_clause][index] if cached node_cache[:subquery_factoring_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?('subquery_factoring_clause', false, index)) r0 = instantiate_node(SyntaxNode,input, index...(index + match_len)) r0.extend(SubqueryFactoringClause0) @index += match_len else terminal_parse_failure('\'subquery_factoring_clause\'') r0 = nil end node_cache[:subquery_factoring_clause][start_index] = r0 r0 end |