Class: BELParser::Parsers::BELScript::Unset::Parser
- Inherits:
-
Object
- Object
- BELParser::Parsers::BELScript::Unset::Parser
- Includes:
- AST::Sexp, BELParser::Parsers::Buffer, Tracer, Enumerable
- Defined in:
- lib/bel_parser/parsers/bel_script/unset.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(content) ⇒ Parser
constructor
A new instance of Parser.
Methods included from Tracer
Methods included from AST::Sexp
#annotation_definition, #argument, #blank_line, build, #comment, #comment_line, #document_property, #domain, #function, #identifier, #keyword, #list, #list_item, #multi_identifier, #name, #namespace_definition, #nested_statement, #object, #observed_term, #parameter, #pattern, #prefix, #relationship, #set, #simple_statement, #statement, #string, #subject, #term, #unset, #uri, #url, #value
Methods included from BELParser::Parsers::Buffer
Constructor Details
#initialize(content) ⇒ Parser
Returns a new instance of Parser.
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 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 |
# File 'lib/bel_parser/parsers/bel_script/unset.rb', line 399 def initialize(content) @content = content # begin: ragel class << self attr_accessor :_bel_trans_keys private :_bel_trans_keys, :_bel_trans_keys= end self._bel_trans_keys = [ 0, 0, 85, 117, 78, 110, 83, 115, 69, 101, 84, 116, 48, 122, 9, 122, 48, 122, 10, 122, 0, 0, 0 ] class << self attr_accessor :_bel_key_spans private :_bel_key_spans, :_bel_key_spans= end self._bel_key_spans = [ 0, 33, 33, 33, 33, 33, 75, 114, 75, 113, 0 ] class << self attr_accessor :_bel_index_offsets private :_bel_index_offsets, :_bel_index_offsets= end self._bel_index_offsets = [ 0, 0, 34, 68, 102, 136, 170, 246, 361, 437, 551 ] class << self attr_accessor :_bel_indicies private :_bel_indicies, :_bel_indicies= end self._bel_indicies = [ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 6, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 7, 9, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 10, 10, 10, 10, 12, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 10, 10, 0 ] class << self attr_accessor :_bel_trans_targs private :_bel_trans_targs, :_bel_trans_targs= end self._bel_trans_targs = [ 2, 0, 3, 4, 5, 7, 9, 0, 8, 8, 0, 10, 9 ] class << self attr_accessor :_bel_trans_actions private :_bel_trans_actions, :_bel_trans_actions= end self._bel_trans_actions = [ 0, 0, 0, 0, 0, 0, 1, 3, 1, 0, 6, 7, 0 ] class << self attr_accessor :_bel_eof_actions private :_bel_eof_actions, :_bel_eof_actions= end self._bel_eof_actions = [ 0, 0, 0, 0, 0, 0, 0, 2, 4, 5, 8 ] class << self attr_accessor :bel_start end self.bel_start = 1; class << self attr_accessor :bel_first_final end self.bel_first_final = 7; class << self attr_accessor :bel_error end self.bel_error = 0; class << self attr_accessor :bel_en_ident_node end self.bel_en_ident_node = 6; class << self attr_accessor :bel_en_unset_ast_node end self.bel_en_unset_ast_node = 1; # end: ragel end |
Instance Method Details
#each ⇒ Object
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 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 720 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 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 |
# File 'lib/bel_parser/parsers/bel_script/unset.rb', line 563 def each @buffers = {} @incomplete = {} data = @content.unpack('C*') p = 0 pe = data.length eof = data.length # begin: ragel begin p ||= 0 pe ||= data.length cs = bel_start end begin testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 _eof_trans = 15 _again = 20 _test_eof = 30 _out = 40 while true if _goto_level <= 0 if p == pe _goto_level = _test_eof next end if cs == 0 _goto_level = _out next end end if _goto_level <= _resume _keys = cs << 1 _inds = _bel_index_offsets[cs] _slen = _bel_key_spans[cs] _wide = data[p].ord _trans = if ( _slen > 0 && _bel_trans_keys[_keys] <= _wide && _wide <= _bel_trans_keys[_keys + 1] ) then _bel_indicies[ _inds + _wide - _bel_trans_keys[_keys] ] else _bel_indicies[ _inds + _slen ] end cs = _bel_trans_targs[_trans] if _bel_trans_actions[_trans] != 0 case _bel_trans_actions[_trans] when 1 then begin trace('IDENTIFIER start_identifier') @identifier_started = true id_start = p; end when 7 then begin trace('IDENTIFIER end_identifier') id_end = p chars = data[id_start...id_end] completed = !chars.empty? ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end]) @buffers[:ident] = ast_node end when 3 then begin trace('IDENTIFIER an_ident_err') id_end = p chars = data[id_start...id_end] ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end]) @buffers[:ident] = ast_node end when 6 then begin trace('IDENTIFIER ident_node_err') id_end = p chars = data[id_start...id_end] ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end]) yield ast_node end end end end if _goto_level <= _again if cs == 0 _goto_level = _out next end p += 1 if p != pe _goto_level = _resume next end end if _goto_level <= _test_eof if p == eof case _bel_eof_actions[cs] when 8 then begin trace('IDENTIFIER yield_identifier') yield @buffers[:ident] end when 5 then begin trace('IDENTIFIER end_identifier') id_end = p chars = data[id_start...id_end] completed = !chars.empty? ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end]) @buffers[:ident] = ast_node end begin trace('IDENTIFIER yield_identifier') yield @buffers[:ident] end when 2 then begin trace('IDENTIFIER an_ident_eof') if @identifier_started id_end = p chars = data[id_start...id_end] completed = !chars.empty? ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end]) @buffers[:ident] = ast_node end end begin trace('UNSET add_name') key = @buffers.delete(:ident) @buffers[:unset_name] = key end begin trace('UNSET unset_end') name = @buffers.delete(:unset_name) unless name.nil? unset_node = unset(name, complete: name.complete) else unset_node = unset(complete: false) end @buffers[:unset] = unset_node end begin trace('UNSET yield_unset') yield @buffers[:unset] end when 4 then begin trace('IDENTIFIER end_identifier') id_end = p chars = data[id_start...id_end] completed = !chars.empty? ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end]) @buffers[:ident] = ast_node end begin trace('IDENTIFIER an_ident_eof') if @identifier_started id_end = p chars = data[id_start...id_end] completed = !chars.empty? ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end]) @buffers[:ident] = ast_node end end begin trace('UNSET add_name') key = @buffers.delete(:ident) @buffers[:unset_name] = key end begin trace('UNSET unset_end') name = @buffers.delete(:unset_name) unless name.nil? unset_node = unset(name, complete: name.complete) else unset_node = unset(complete: false) end @buffers[:unset] = unset_node end begin trace('UNSET yield_unset') yield @buffers[:unset] end end end end if _goto_level <= _out break end end end # end: ragel end |