Module: OracleSqlParser::Grammar::Update
- Includes:
- Treetop::Runtime
- Included in:
- Grammar, UpdateParser
- Defined in:
- lib/oracle-sql-parser/grammar/update.rb
Defined Under Namespace
Modules: UpdateCondition0, UpdateCurrentOf0, UpdateSetClause0, UpdateSetClause1, UpdateSetClause2, UpdateStatement0, UpdateStatement1, UpdateTargetClause0, UpdateTargetClause1, UpdateTargetColumn0, UpdateTargetColumn1, UpdateTargetTable0, UpdateTargetTable1, UpdateTargetTable2, UpdateTargetTable3, UpdateTargetTable4, UpdateTargetTable5, UpdateWhereClause0, UpdateWhereClause1
Instance Method Summary collapse
- #_nt_returning_clause ⇒ Object
- #_nt_search_condition ⇒ Object
- #_nt_update_condition ⇒ Object
- #_nt_update_current_of ⇒ Object
- #_nt_update_set_clause ⇒ Object
- #_nt_update_statement ⇒ Object
- #_nt_update_target_clause ⇒ Object
- #_nt_update_target_column ⇒ Object
- #_nt_update_target_table ⇒ Object
- #_nt_update_where_clause ⇒ Object
- #root ⇒ Object
Instance Method Details
#_nt_returning_clause ⇒ Object
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 753 def _nt_returning_clause start_index = index if node_cache[:returning_clause].has_key?(index) cached = node_cache[:returning_clause][index] if cached node_cache[:returning_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?('returning_clause', false, index)) r0 = instantiate_node(SyntaxNode,input, index...(index + match_len)) @index += match_len else terminal_parse_failure('\'returning_clause\'') r0 = nil end node_cache[:returning_clause][start_index] = r0 r0 end |
#_nt_search_condition ⇒ Object
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 735 def _nt_search_condition start_index = index if node_cache[:search_condition].has_key?(index) cached = node_cache[:search_condition][index] if cached node_cache[:search_condition][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end r0 = _nt_logical_condition node_cache[:search_condition][start_index] = r0 r0 end |
#_nt_update_condition ⇒ Object
675 676 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 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 675 def _nt_update_condition start_index = index if node_cache[:update_condition].has_key?(index) cached = node_cache[:update_condition][index] if cached node_cache[:update_condition][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_update_current_of if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 else r2 = _nt_search_condition r2.extend(UpdateCondition0) r2.extend(UpdateCondition0) if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 else @index = i0 r0 = nil end end node_cache[:update_condition][start_index] = r0 r0 end |
#_nt_update_current_of ⇒ Object
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 715 def _nt_update_current_of start_index = index if node_cache[:update_current_of].has_key?(index) cached = node_cache[:update_current_of][index] if cached node_cache[:update_current_of][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end r0 = _nt_current_of r0.extend(UpdateCurrentOf0) r0.extend(UpdateCurrentOf0) node_cache[:update_current_of][start_index] = r0 r0 end |
#_nt_update_set_clause ⇒ Object
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 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 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 440 def _nt_update_set_clause start_index = index if node_cache[:update_set_clause].has_key?(index) cached = node_cache[:update_set_clause][index] if cached node_cache[:update_set_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_set_keyword s0 << r1 if r1 r2 = _nt_space s0 << r2 if r2 r3 = _nt_update_target_column s0 << r3 if r3 s4, i4 = [], index loop do i5, s5 = index, [] r7 = _nt_space if r7 r6 = r7 else r6 = instantiate_node(SyntaxNode,input, index...index) end s5 << r6 if r6 if (match_len = has_terminal?(',', false, index)) r8 = true @index += match_len else terminal_parse_failure('\',\'') r8 = nil end s5 << r8 if r8 r10 = _nt_space if r10 r9 = r10 else r9 = instantiate_node(SyntaxNode,input, index...index) end s5 << r9 if r9 r11 = _nt_update_target_column s5 << r11 end end end if s5.last r5 = instantiate_node(SyntaxNode,input, i5...index, s5) r5.extend(UpdateSetClause0) else @index = i5 r5 = nil end if r5 s4 << r5 else break end end r4 = instantiate_node(SyntaxNode,input, i4...index, s4) s0 << r4 end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(UpdateSetClause1) r0.extend(UpdateSetClause2) else @index = i0 r0 = nil end node_cache[:update_set_clause][start_index] = r0 r0 end |
#_nt_update_statement ⇒ Object
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 41 def _nt_update_statement start_index = index if node_cache[:update_statement].has_key?(index) cached = node_cache[:update_statement][index] if cached node_cache[:update_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_update_target_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 r4 = _nt_update_set_clause s0 << r4 if r4 r6 = _nt_space if r6 r5 = r6 else r5 = instantiate_node(SyntaxNode,input, index...index) end s0 << r5 if r5 r8 = _nt_update_where_clause if r8 r7 = r8 else r7 = instantiate_node(SyntaxNode,input, index...index) end s0 << r7 if r7 r10 = _nt_returning_clause 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(UpdateStatement0) r0.extend(UpdateStatement1) else @index = i0 r0 = nil end node_cache[:update_statement][start_index] = r0 r0 end |
#_nt_update_target_clause ⇒ Object
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 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 129 def _nt_update_target_clause start_index = index if node_cache[:update_target_clause].has_key?(index) cached = node_cache[:update_target_clause][index] if cached node_cache[:update_target_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_update_keyword s0 << r1 if r1 r2 = _nt_space s0 << r2 if r2 r3 = _nt_update_target_table s0 << r3 end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(UpdateTargetClause0) r0.extend(UpdateTargetClause1) else @index = i0 r0 = nil end node_cache[:update_target_clause][start_index] = r0 r0 end |
#_nt_update_target_column ⇒ Object
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 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 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 550 def _nt_update_target_column start_index = index if node_cache[:update_target_column].has_key?(index) cached = node_cache[:update_target_column][index] if cached node_cache[:update_target_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_column_name 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_sql_expression s0 << r7 end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(UpdateTargetColumn0) r0.extend(UpdateTargetColumn1) else @index = i0 r0 = nil end node_cache[:update_target_column][start_index] = r0 r0 end |
#_nt_update_target_table ⇒ 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 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 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 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 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 213 def _nt_update_target_table start_index = index if node_cache[:update_target_table].has_key?(index) cached = node_cache[:update_target_table][index] if cached node_cache[:update_target_table][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_table_reference s2 << r3 if s2.last r2 = instantiate_node(SyntaxNode,input, i2...index, s2) r2.extend(UpdateTargetTable0) else @index = i2 r2 = nil end if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r1 = r2 else i4, s4 = index, [] if (match_len = has_terminal?('(', false, index)) r5 = true @index += match_len else terminal_parse_failure('\'(\'') r5 = nil end s4 << r5 if r5 r7 = _nt_space if r7 r6 = r7 else r6 = instantiate_node(SyntaxNode,input, index...index) end s4 << r6 if r6 r8 = _nt_subquery s4 << r8 if r8 r10 = _nt_space if r10 r9 = r10 else r9 = instantiate_node(SyntaxNode,input, index...index) end s4 << r9 if r9 if (match_len = has_terminal?(')', false, index)) r11 = true @index += match_len else terminal_parse_failure('\')\'') r11 = nil end s4 << r11 end end end end if s4.last r4 = instantiate_node(SyntaxNode,input, i4...index, s4) r4.extend(UpdateTargetTable1) else @index = i4 r4 = nil end if r4 r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true r1 = r4 else i12, s12 = index, [] r13 = _nt_table_keyword s12 << r13 if r13 r15 = _nt_space if r15 r14 = r15 else r14 = instantiate_node(SyntaxNode,input, index...index) end s12 << r14 if r14 if (match_len = has_terminal?('(', false, index)) r16 = true @index += match_len else terminal_parse_failure('\'(\'') r16 = nil end s12 << r16 if r16 r18 = _nt_space if r18 r17 = r18 else r17 = instantiate_node(SyntaxNode,input, index...index) end s12 << r17 if r17 r19 = _nt_subquery s12 << r19 if r19 r21 = _nt_space if r21 r20 = r21 else r20 = instantiate_node(SyntaxNode,input, index...index) end s12 << r20 if r20 if (match_len = has_terminal?(')', false, index)) r22 = true @index += match_len else terminal_parse_failure('\')\'') r22 = nil end s12 << r22 end end end end end end if s12.last r12 = instantiate_node(SyntaxNode,input, i12...index, s12) r12.extend(UpdateTargetTable2) else @index = i12 r12 = nil end if r12 r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true r1 = r12 else @index = i1 r1 = nil end end end s0 << r1 if r1 i24, s24 = index, [] r26 = _nt_space if r26 r25 = r26 else r25 = instantiate_node(SyntaxNode,input, index...index) end s24 << r25 if r25 r27 = _nt_t_alias s24 << r27 end if s24.last r24 = instantiate_node(SyntaxNode,input, i24...index, s24) r24.extend(UpdateTargetTable3) else @index = i24 r24 = nil end if r24 r23 = r24 else r23 = instantiate_node(SyntaxNode,input, index...index) end s0 << r23 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(UpdateTargetTable4) r0.extend(UpdateTargetTable5) else @index = i0 r0 = nil end node_cache[:update_target_table][start_index] = r0 r0 end |
#_nt_update_where_clause ⇒ Object
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 |
# File 'lib/oracle-sql-parser/grammar/update.rb', line 628 def _nt_update_where_clause start_index = index if node_cache[:update_where_clause].has_key?(index) cached = node_cache[:update_where_clause][index] if cached node_cache[:update_where_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_where_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_update_condition s0 << r4 end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(UpdateWhereClause0) r0.extend(UpdateWhereClause1) else @index = i0 r0 = nil end node_cache[:update_where_clause][start_index] = r0 r0 end |