Module: OracleSqlParser::Grammar::Insert
- Includes:
- Treetop::Runtime
- Included in:
- Grammar, InsertParser
- Defined in:
- lib/oracle-sql-parser/grammar/insert.rb
Defined Under Namespace
Modules: DmlTableExpressionClause0, ExprOrDefault0, InsertColumnNames0, InsertColumnNames1, InsertColumnNames2, InsertIntoClause0, InsertIntoClause1, InsertIntoClause2, InsertStatement0, InsertStatement1, InsertValues0, InsertValues1, InsertValues2, SingleTableInsert0, SingleTableInsert1, SingleTableInsert2, ValuesClause0, ValuesClause1
Instance Method Summary collapse
- #_nt_dml_table_expression_clause ⇒ Object
- #_nt_error_logging_clause ⇒ Object
- #_nt_expr_or_default ⇒ Object
- #_nt_insert_column_names ⇒ Object
- #_nt_insert_into_clause ⇒ Object
- #_nt_insert_statement ⇒ Object
- #_nt_insert_values ⇒ Object
- #_nt_multi_table_insert ⇒ Object
- #_nt_single_table_insert ⇒ Object
- #_nt_values_clause ⇒ Object
- #root ⇒ Object
Instance Method Details
#_nt_dml_table_expression_clause ⇒ Object
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 717 def _nt_dml_table_expression_clause start_index = index if node_cache[:dml_table_expression_clause].has_key?(index) cached = node_cache[:dml_table_expression_clause][index] if cached node_cache[:dml_table_expression_clause][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end r0 = _nt_table_reference r0.extend(DmlTableExpressionClause0) r0.extend(DmlTableExpressionClause0) node_cache[:dml_table_expression_clause][start_index] = r0 r0 end |
#_nt_error_logging_clause ⇒ Object
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 761 def _nt_error_logging_clause start_index = index if node_cache[:error_logging_clause].has_key?(index) cached = node_cache[:error_logging_clause][index] if cached node_cache[:error_logging_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?('error_logging_clause', false, index)) r0 = instantiate_node(SyntaxNode,input, index...(index + match_len)) @index += match_len else terminal_parse_failure('\'error_logging_clause\'') r0 = nil end node_cache[:error_logging_clause][start_index] = r0 r0 end |
#_nt_expr_or_default ⇒ Object
677 678 679 680 681 682 683 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 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 677 def _nt_expr_or_default start_index = index if node_cache[:expr_or_default].has_key?(index) cached = node_cache[:expr_or_default][index] if cached node_cache[:expr_or_default][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 else r2 = _nt_default_keyword r2.extend(ExprOrDefault0) r2.extend(ExprOrDefault0) if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 else @index = i0 r0 = nil end end node_cache[:expr_or_default][start_index] = r0 r0 end |
#_nt_insert_column_names ⇒ Object
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 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 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 361 def _nt_insert_column_names start_index = index if node_cache[:insert_column_names].has_key?(index) cached = node_cache[:insert_column_names][index] if cached node_cache[:insert_column_names][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if (match_len = has_terminal?('(', false, index)) r1 = true @index += match_len else terminal_parse_failure('\'(\'') r1 = nil end 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_column_name s0 << r4 if r4 s5, i5 = [], index loop do i6, s6 = index, [] r8 = _nt_space if r8 r7 = r8 else r7 = instantiate_node(SyntaxNode,input, index...index) end s6 << r7 if r7 if (match_len = has_terminal?(',', false, index)) r9 = true @index += match_len else terminal_parse_failure('\',\'') r9 = nil end s6 << r9 if r9 r11 = _nt_space if r11 r10 = r11 else r10 = instantiate_node(SyntaxNode,input, index...index) end s6 << r10 if r10 r12 = _nt_column_name s6 << r12 end end end if s6.last r6 = instantiate_node(SyntaxNode,input, i6...index, s6) r6.extend(InsertColumnNames0) else @index = i6 r6 = nil end if r6 s5 << r6 else break end end r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 if (match_len = has_terminal?(')', false, index)) r13 = true @index += match_len else terminal_parse_failure('\')\'') r13 = nil end s0 << r13 end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(InsertColumnNames1) r0.extend(InsertColumnNames2) else @index = i0 r0 = nil end node_cache[:insert_column_names][start_index] = r0 r0 end |
#_nt_insert_into_clause ⇒ Object
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 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 263 def _nt_insert_into_clause start_index = index if node_cache[:insert_into_clause].has_key?(index) cached = node_cache[:insert_into_clause][index] if cached node_cache[:insert_into_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_into_keyword s0 << r1 if r1 r2 = _nt_space s0 << r2 if r2 r3 = _nt_dml_table_expression_clause s0 << r3 if r3 r4 = _nt_space s0 << r4 if r4 i6, s6 = index, [] r7 = _nt_t_alias s6 << r7 if r7 r8 = _nt_space s6 << r8 end if s6.last r6 = instantiate_node(SyntaxNode,input, i6...index, s6) r6.extend(InsertIntoClause0) else @index = i6 r6 = nil end if r6 r5 = r6 else r5 = instantiate_node(SyntaxNode,input, index...index) end s0 << r5 if r5 r10 = _nt_insert_column_names if r10 r9 = r10 else r9 = instantiate_node(SyntaxNode,input, index...index) end s0 << r9 end end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(InsertIntoClause1) r0.extend(InsertIntoClause2) else @index = i0 r0 = nil end node_cache[:insert_into_clause][start_index] = r0 r0 end |
#_nt_insert_statement ⇒ Object
28 29 30 31 32 33 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 83 84 85 86 87 88 89 90 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 28 def _nt_insert_statement start_index = index if node_cache[:insert_statement].has_key?(index) cached = node_cache[:insert_statement][index] if cached node_cache[:insert_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_insert_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 r5 = _nt_hint if r5 r4 = r5 else r4 = instantiate_node(SyntaxNode,input, index...index) end s0 << r4 if r4 i6 = index r7 = _nt_single_table_insert if r7 r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true r6 = r7 else r8 = _nt_multi_table_insert if r8 r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true r6 = r8 else @index = i6 r6 = nil end end s0 << r6 end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(InsertStatement0) r0.extend(InsertStatement1) else @index = i0 r0 = nil end node_cache[:insert_statement][start_index] = r0 r0 end |
#_nt_insert_values ⇒ Object
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 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 593 def _nt_insert_values start_index = index if node_cache[:insert_values].has_key?(index) cached = node_cache[:insert_values][index] if cached node_cache[:insert_values][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_or_default 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_expr_or_default s3 << r9 end end end if s3.last r3 = instantiate_node(SyntaxNode,input, i3...index, s3) r3.extend(InsertValues0) 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(InsertValues1) r0.extend(InsertValues2) else @index = i0 r0 = nil end node_cache[:insert_values][start_index] = r0 r0 end |
#_nt_multi_table_insert ⇒ Object
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 737 def _nt_multi_table_insert start_index = index if node_cache[:multi_table_insert].has_key?(index) cached = node_cache[:multi_table_insert][index] if cached node_cache[:multi_table_insert][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if (match_len = has_terminal?('multi_table_insert', false, index)) r0 = instantiate_node(SyntaxNode,input, index...(index + match_len)) @index += match_len else terminal_parse_failure('\'multi_table_insert\'') r0 = nil end node_cache[:multi_table_insert][start_index] = r0 r0 end |
#_nt_single_table_insert ⇒ Object
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 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 126 def _nt_single_table_insert start_index = index if node_cache[:single_table_insert].has_key?(index) cached = node_cache[:single_table_insert][index] if cached node_cache[:single_table_insert][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_insert_into_clause s0 << r1 if r1 r3 = _nt_space if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 if r2 i4 = index i5, s5 = index, [] r6 = _nt_values_clause s5 << r6 if r6 r8 = _nt_returning_clause if r8 r7 = r8 else r7 = instantiate_node(SyntaxNode,input, index...index) end s5 << r7 end if s5.last r5 = instantiate_node(SyntaxNode,input, i5...index, s5) r5.extend(SingleTableInsert0) else @index = i5 r5 = nil end if r5 r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true r4 = r5 else r9 = _nt_subquery if r9 r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true r4 = r9 else @index = i4 r4 = nil end end s0 << r4 if r4 r11 = _nt_space if r11 r10 = r11 else r10 = instantiate_node(SyntaxNode,input, index...index) end s0 << r10 if r10 r13 = _nt_error_logging_clause if r13 r12 = r13 else r12 = instantiate_node(SyntaxNode,input, index...index) end s0 << r12 end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(SingleTableInsert1) r0.extend(SingleTableInsert2) else @index = i0 r0 = nil end node_cache[:single_table_insert][start_index] = r0 r0 end |
#_nt_values_clause ⇒ Object
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 552 553 554 555 556 557 558 559 560 561 562 |
# File 'lib/oracle-sql-parser/grammar/insert.rb', line 485 def _nt_values_clause start_index = index if node_cache[:values_clause].has_key?(index) cached = node_cache[:values_clause][index] if cached node_cache[:values_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_values_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_insert_values 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(ValuesClause0) r0.extend(ValuesClause1) else @index = i0 r0 = nil end node_cache[:values_clause][start_index] = r0 r0 end |