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
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
|
# File 'lib/mail/parsers/date_time_parser.rb', line 665
def self.parse(data)
data = data.dup.force_encoding(Encoding::ASCII_8BIT) if data.respond_to?(:force_encoding)
raise Mail::Field::NilParseError.new(Mail::DateTimeElement) if data.nil?
date_time = DateTimeStruct.new([])
date_s = time_s = nil
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])
_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 1
begin
date_s = p
end
when 13
begin
date_time.time_string = chars(data, time_s, p - 1)
end
when 9
begin
end
when 4
begin
end
when 3
begin
begin
stack[top] = cs
top += 1
cs = 91
_goto_level = _again
next
end
end
when 12
begin
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
when 8
begin
date_s = p
end
begin
begin
stack[top] = cs
top += 1
cs = 91
_goto_level = _again
next
end
end
when 6
begin
date_time.date_string = chars(data, date_s, p - 1)
end
begin
time_s = p
end
when 14
begin
date_time.time_string = chars(data, time_s, p - 1)
end
begin
begin
stack[top] = cs
top += 1
cs = 91
_goto_level = _again
next
end
end
when 10
begin
end
begin
begin
stack[top] = cs
top += 1
cs = 91
_goto_level = _again
next
end
end
when 11
begin
end
begin
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
when 5
begin
end
begin
begin
stack[top] = cs
top += 1
cs = 91
_goto_level = _again
next
end
end
when 2
begin
begin
stack[top] = cs
top += 1
cs = 91
_goto_level = _again
next
end
end
begin
date_s = p
end
when 7
begin
end
begin
date_time.date_string = chars(data, date_s, p - 1)
end
begin
time_s = p
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 13
begin
date_time.time_string = chars(data, time_s, p - 1)
end
when 4
begin
end
end
end
end
if _goto_level <= _out
break
end
end
end
if p != eof || cs < 103
raise Mail::Field::IncompleteParseError.new(Mail::DateTimeElement, data, p)
end
date_time
end
|