Module: NQL::Syntax
Defined Under Namespace
Modules: Boolean0, Boolean1, Comparator0, Comparison0, Comparison1, Coordinator0, Primary0, Primary1, Primary2, Primary3, Text0, Text1
Instance Method Summary collapse
- #_nt_alphanumeric ⇒ Object
- #_nt_boolean ⇒ Object
- #_nt_comparator ⇒ Object
- #_nt_comparison ⇒ Object
- #_nt_coordinator ⇒ Object
- #_nt_expression ⇒ Object
- #_nt_primary ⇒ Object
- #_nt_space ⇒ Object
- #_nt_symbol ⇒ Object
- #_nt_text ⇒ Object
- #_nt_utf8 ⇒ Object
- #root ⇒ Object
Instance Method Details
#_nt_alphanumeric ⇒ Object
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
# File 'lib/nql/grammar.rb', line 721 def _nt_alphanumeric start_index = index if node_cache[:alphanumeric].has_key?(index) cached = node_cache[:alphanumeric][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end s0, i0 = [], index loop do if has_terminal?('\G[a-zA-Z0-9_.]', true, index) r1 = true @index += 1 else r1 = nil end if r1 s0 << r1 else break end end if s0.empty? @index = i0 r0 = nil else r0 = instantiate_node(SyntaxNode,input, i0...index, s0) end node_cache[:alphanumeric][start_index] = r0 r0 end |
#_nt_boolean ⇒ Object
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 |
# File 'lib/nql/grammar.rb', line 85 def _nt_boolean start_index = index if node_cache[:boolean].has_key?(index) cached = node_cache[:boolean][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_primary s0 << r1 if r1 r2 = _nt_space s0 << r2 if r2 r3 = _nt_coordinator s0 << r3 if r3 r4 = _nt_space s0 << r4 if r4 r5 = _nt_expression s0 << r5 end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Boolean0) r0.extend(Boolean1) else @index = i0 r0 = nil end node_cache[:boolean][start_index] = r0 r0 end |
#_nt_comparator ⇒ Object
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 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 |
# File 'lib/nql/grammar.rb', line 462 def _nt_comparator start_index = index if node_cache[:comparator].has_key?(index) cached = node_cache[:comparator][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end s0, i0 = [], index loop do i1 = index if has_terminal?('=', false, index) r2 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('=') r2 = nil end if r2 r1 = r2 else if has_terminal?('!=', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 2)) @index += 2 else terminal_parse_failure('!=') r3 = nil end if r3 r1 = r3 else if has_terminal?('>', false, index) r4 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('>') r4 = nil end if r4 r1 = r4 else if has_terminal?('>=', false, index) r5 = instantiate_node(SyntaxNode,input, index...(index + 2)) @index += 2 else terminal_parse_failure('>=') r5 = nil end if r5 r1 = r5 else if has_terminal?('<', false, index) r6 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('<') r6 = nil end if r6 r1 = r6 else if has_terminal?('<=', false, index) r7 = instantiate_node(SyntaxNode,input, index...(index + 2)) @index += 2 else terminal_parse_failure('<=') r7 = nil end if r7 r1 = r7 else if has_terminal?(':', false, index) r8 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(':') r8 = nil end if r8 r1 = r8 else if has_terminal?('!:', false, index) r9 = instantiate_node(SyntaxNode,input, index...(index + 2)) @index += 2 else terminal_parse_failure('!:') r9 = nil end if r9 r1 = r9 else if has_terminal?('~', false, index) r10 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('~') r10 = nil end if r10 r1 = r10 else @index = i1 r1 = nil end end end end end end end end end if r1 s0 << r1 else break end end if s0.empty? @index = i0 r0 = nil else r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Comparator0) end node_cache[:comparator][start_index] = r0 r0 end |
#_nt_comparison ⇒ Object
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 |
# File 'lib/nql/grammar.rb', line 401 def _nt_comparison start_index = index if node_cache[:comparison].has_key?(index) cached = node_cache[:comparison][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_alphanumeric s0 << r1 if r1 r2 = _nt_space s0 << r2 if r2 r3 = _nt_comparator s0 << r3 if r3 r4 = _nt_space s0 << r4 if r4 r5 = _nt_text s0 << r5 end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Comparison0) r0.extend(Comparison1) else @index = i0 r0 = nil end node_cache[:comparison][start_index] = r0 r0 end |
#_nt_coordinator ⇒ Object
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 |
# File 'lib/nql/grammar.rb', line 323 def _nt_coordinator start_index = index if node_cache[:coordinator].has_key?(index) cached = node_cache[:coordinator][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index if has_terminal?('|', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('|') r1 = nil end if r1 r0 = r1 r0.extend(Coordinator0) else if has_terminal?('&', false, index) r2 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('&') r2 = nil end if r2 r0 = r2 r0.extend(Coordinator0) else @index = i0 r0 = nil end end node_cache[:coordinator][start_index] = r0 r0 end |
#_nt_expression ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/nql/grammar.rb', line 12 def _nt_expression start_index = index if node_cache[:expression].has_key?(index) cached = node_cache[:expression][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_boolean if r1 r0 = r1 else r2 = _nt_primary if r2 r0 = r2 else @index = i0 r0 = nil end end node_cache[:expression][start_index] = r0 r0 end |
#_nt_primary ⇒ Object
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 |
# File 'lib/nql/grammar.rb', line 187 def _nt_primary start_index = index if node_cache[:primary].has_key?(index) cached = node_cache[:primary][index] if cached 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_space s1 << r2 if r2 r3 = _nt_comparison s1 << r3 if r3 r4 = _nt_space s1 << r4 end end if s1.last r1 = instantiate_node(SyntaxNode,input, i1...index, s1) r1.extend(Primary0) else @index = i1 r1 = nil end if r1 r0 = r1 r0.extend(Primary3) else i5, s5 = index, [] if has_terminal?('(', false, index) r6 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('(') r6 = nil end s5 << r6 if r6 r7 = _nt_space s5 << r7 if r7 r8 = _nt_comparison s5 << r8 if r8 r9 = _nt_space s5 << r9 if r9 if has_terminal?(')', false, index) r10 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(')') r10 = nil end s5 << r10 end end end end if s5.last r5 = instantiate_node(SyntaxNode,input, i5...index, s5) r5.extend(Primary1) else @index = i5 r5 = nil end if r5 r0 = r5 r0.extend(Primary3) else i11, s11 = index, [] if has_terminal?('(', false, index) r12 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('(') r12 = nil end s11 << r12 if r12 r13 = _nt_space s11 << r13 if r13 r14 = _nt_expression s11 << r14 if r14 r15 = _nt_space s11 << r15 if r15 if has_terminal?(')', false, index) r16 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(')') r16 = nil end s11 << r16 end end end end if s11.last r11 = instantiate_node(SyntaxNode,input, i11...index, s11) r11.extend(Primary2) else @index = i11 r11 = nil end if r11 r0 = r11 r0.extend(Primary3) else @index = i0 r0 = nil end end end node_cache[:primary][start_index] = r0 r0 end |
#_nt_space ⇒ Object
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 |
# File 'lib/nql/grammar.rb', line 758 def _nt_space start_index = index if node_cache[:space].has_key?(index) cached = node_cache[:space][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end s0, i0 = [], index loop do if has_terminal?(' ', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(' ') r1 = nil end if r1 s0 << r1 else break end end r0 = instantiate_node(SyntaxNode,input, i0...index, s0) node_cache[:space][start_index] = r0 r0 end |
#_nt_symbol ⇒ Object
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 |
# File 'lib/nql/grammar.rb', line 791 def _nt_symbol start_index = index if node_cache[:symbol].has_key?(index) cached = node_cache[:symbol][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('\G[><=+-\\/\\\\@#$%!?:]', true, index) r0 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else r0 = nil end node_cache[:symbol][start_index] = r0 r0 end |
#_nt_text ⇒ Object
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 670 671 672 673 674 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 708 709 710 711 712 713 714 715 716 717 718 719 |
# File 'lib/nql/grammar.rb', line 606 def _nt_text start_index = index if node_cache[:text].has_key?(index) cached = node_cache[:text][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] s1, i1 = [], index loop do i2 = index r3 = _nt_alphanumeric if r3 r2 = r3 else r4 = _nt_utf8 if r4 r2 = r4 else r5 = _nt_symbol if r5 r2 = r5 else @index = i2 r2 = nil end end end if r2 s1 << r2 else break end end if s1.empty? @index = i1 r1 = nil else r1 = instantiate_node(SyntaxNode,input, i1...index, s1) end s0 << r1 if r1 s6, i6 = [], index loop do i7, s7 = index, [] r8 = _nt_space s7 << r8 if r8 s9, i9 = [], index loop do i10 = index r11 = _nt_alphanumeric if r11 r10 = r11 else r12 = _nt_utf8 if r12 r10 = r12 else r13 = _nt_symbol if r13 r10 = r13 else @index = i10 r10 = nil end end end if r10 s9 << r10 else break end end if s9.empty? @index = i9 r9 = nil else r9 = instantiate_node(SyntaxNode,input, i9...index, s9) end s7 << r9 end if s7.last r7 = instantiate_node(SyntaxNode,input, i7...index, s7) r7.extend(Text0) else @index = i7 r7 = nil end if r7 s6 << r7 else break end end r6 = instantiate_node(SyntaxNode,input, i6...index, s6) s0 << r6 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Text1) else @index = i0 r0 = nil end node_cache[:text][start_index] = r0 r0 end |
#_nt_utf8 ⇒ Object
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 |
# File 'lib/nql/grammar.rb', line 814 def _nt_utf8 start_index = index if node_cache[:utf8].has_key?(index) cached = node_cache[:utf8][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('\G[\\u00c0\\u00c1\\u00c2\\u00c3\\u00c4\\u00c7\\u00c8\\u00c9\\u00ca\\u00cb\\u00cc\\u00cd\\u00ce\\u00cf\\u00d1\\u00d2\\u00d3\\u00d4\\u00d5\\u00d6\\u00d9\\u00da\\u00db\\u00dc\\u00e0\\u00e1\\u00e2\\u00e3\\u00e4\\u00e7\\u00e8\\u00e9\\u00ea\\u00eb\\u00ec\\u00ed\\u00ee\\u00ef\\u00f1\\u00f2\\u00f3\\u00f4\\u00f5\\u00f6\\u00f9\\u00fa\\u00fb\\u00fc]', true, index) r0 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else r0 = nil end node_cache[:utf8][start_index] = r0 r0 end |
#root ⇒ Object
8 9 10 |
# File 'lib/nql/grammar.rb', line 8 def root @root ||= :expression end |