Module: Mail::Parsers::ContentLocationParser
- Extended by:
- Mail::ParserTools
- Defined in:
- lib/mail/parsers/content_location_parser.rb
Defined Under Namespace
Classes: ContentLocationStruct
Class Attribute Summary collapse
-
._eof_actions ⇒ Object
Returns the value of attribute _eof_actions.
-
._index_offsets ⇒ Object
Returns the value of attribute _index_offsets.
-
._indicies ⇒ Object
Returns the value of attribute _indicies.
-
._key_spans ⇒ Object
Returns the value of attribute _key_spans.
-
._trans_actions ⇒ Object
Returns the value of attribute _trans_actions.
-
._trans_keys ⇒ Object
Returns the value of attribute _trans_keys.
-
._trans_targs ⇒ Object
Returns the value of attribute _trans_targs.
-
.en_comment_tail ⇒ Object
Returns the value of attribute en_comment_tail.
-
.en_main ⇒ Object
Returns the value of attribute en_main.
-
.error ⇒ Object
Returns the value of attribute error.
-
.first_final ⇒ Object
Returns the value of attribute first_final.
-
.start ⇒ Object
Returns the value of attribute start.
Class Method Summary collapse
Methods included from Mail::ParserTools
Class Attribute Details
._eof_actions ⇒ Object
Returns the value of attribute _eof_actions.
552 553 554 |
# File 'lib/mail/parsers/content_location_parser.rb', line 552 def _eof_actions @_eof_actions end |
._index_offsets ⇒ Object
Returns the value of attribute _index_offsets.
53 54 55 |
# File 'lib/mail/parsers/content_location_parser.rb', line 53 def _index_offsets @_index_offsets end |
._indicies ⇒ Object
Returns the value of attribute _indicies.
66 67 68 |
# File 'lib/mail/parsers/content_location_parser.rb', line 66 def _indicies @_indicies end |
._key_spans ⇒ Object
Returns the value of attribute _key_spans.
40 41 42 |
# File 'lib/mail/parsers/content_location_parser.rb', line 40 def _key_spans @_key_spans end |
._trans_actions ⇒ Object
Returns the value of attribute _trans_actions.
534 535 536 |
# File 'lib/mail/parsers/content_location_parser.rb', line 534 def _trans_actions @_trans_actions end |
._trans_keys ⇒ Object
Returns the value of attribute _trans_keys.
17 18 19 |
# File 'lib/mail/parsers/content_location_parser.rb', line 17 def _trans_keys @_trans_keys end |
._trans_targs ⇒ Object
Returns the value of attribute _trans_targs.
516 517 518 |
# File 'lib/mail/parsers/content_location_parser.rb', line 516 def _trans_targs @_trans_targs end |
.en_comment_tail ⇒ Object
Returns the value of attribute en_comment_tail.
578 579 580 |
# File 'lib/mail/parsers/content_location_parser.rb', line 578 def en_comment_tail @en_comment_tail end |
.en_main ⇒ Object
Returns the value of attribute en_main.
582 583 584 |
# File 'lib/mail/parsers/content_location_parser.rb', line 582 def en_main @en_main end |
.error ⇒ Object
Returns the value of attribute error.
573 574 575 |
# File 'lib/mail/parsers/content_location_parser.rb', line 573 def error @error end |
.first_final ⇒ Object
Returns the value of attribute first_final.
569 570 571 |
# File 'lib/mail/parsers/content_location_parser.rb', line 569 def first_final @first_final end |
.start ⇒ Object
Returns the value of attribute start.
565 566 567 |
# File 'lib/mail/parsers/content_location_parser.rb', line 565 def start @start end |
Class Method Details
.parse(data) ⇒ Object
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 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 806 807 808 809 810 811 |
# File 'lib/mail/parsers/content_location_parser.rb', line 588 def self.parse(data) data = data.dup.force_encoding(Encoding::ASCII_8BIT) if data.respond_to?(:force_encoding) content_location = ContentLocationStruct.new(nil) return content_location if Mail::Utilities.blank?(data) # Parser state disp_type_s = param_attr_s = param_attr = qstr_s = qstr = param_val_s = nil # 5.1 Variables Used by Ragel p = 0 eof = pe = data.length stack = [] begin p ||= 0 pe ||= data.length cs = start top = 0 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 = _index_offsets[cs] _slen = _key_spans[cs] _wide = data[p].ord _trans = if ( _slen > 0 && _trans_keys[_keys] <= _wide && _wide <= _trans_keys[_keys + 1] ) then _indicies[ _inds + _wide - _trans_keys[_keys] ] else _indicies[ _inds + _slen ] end cs = _trans_targs[_trans] if _trans_actions[_trans] != 0 case _trans_actions[_trans] when 13 then begin qstr_s = p end when 3 then begin content_location.location = chars(data, qstr_s, p-1) end when 1 then begin token_string_s = p end when 11 then begin content_location.location = chars(data, token_string_s, p-1) end when 4 then begin end when 7 then begin end when 2 then begin begin stack[top] = cs top+= 1 cs = 20 _goto_level = _again next end end when 10 then begin begin top -= 1 cs = stack[top] _goto_level = _again next end end when 15 then begin qstr_s = p end begin content_location.location = chars(data, qstr_s, p-1) end when 14 then begin qstr_s = p end begin content_location.location = chars(data, token_string_s, p-1) end when 12 then begin content_location.location = chars(data, token_string_s, p-1) end begin begin stack[top] = cs top+= 1 cs = 20 _goto_level = _again next end end when 5 then begin end begin token_string_s = p end when 6 then begin end begin begin stack[top] = cs top+= 1 cs = 20 _goto_level = _again next end end when 8 then begin end begin begin stack[top] = cs top+= 1 cs = 20 _goto_level = _again next end end when 9 then begin end begin begin top -= 1 cs = stack[top] _goto_level = _again next end end when 17 then begin begin stack[top] = cs top+= 1 cs = 20 _goto_level = _again next end end begin content_location.location = chars(data, token_string_s, p-1) end when 16 then begin qstr_s = p end begin content_location.location = chars(data, token_string_s, p-1) end begin begin stack[top] = cs top+= 1 cs = 20 _goto_level = _again next end 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 _eof_actions[cs] when 11 then begin content_location.location = chars(data, token_string_s, p-1) end when 4 then begin end end end end if _goto_level <= _out break end end end if p != eof || cs < 32 raise Mail::Field::IncompleteParseError.new(Mail::ContentLocationElement, data, p) end content_location end |