123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657openCore(*
module RFC2822 = struct
let unfold str =
let lexbuf = Lexing.from_string str in
let bigbuffer = Bigbuffer.create (String.length str) in
Lexer.field_unstructured_unfold bigbuffer lexbuf;
Bigbuffer.contents bigbuffer
;;
let fold str =
let lexbuf = Lexing.from_string str in
let bigbuffer = Bigbuffer.create (String.length str) in
Lexer.field_unstructured_fold bigbuffer lexbuf;
Bigbuffer.contents bigbuffer
;;
TEST_MODULE "Folding_and_unfolding" = struct
TEST = (fold "a\n b\nc") = " a\n b\n c"
TEST = (fold " a\n b\nc") = " a\n b\n c"
TEST = (fold "\ta\n b\nc") = "\ta\n b\n c"
TEST = (unfold " a\n b\nc d") = "a b c d"
end
end
*)moduleRFC2045=structmoduleToken=structinclude(Mimestring.Case_insensitive:Mimestring.S)letis_validstr=(not(String.is_emptystr))&&String.for_allstr~f:(function|'('|')'|'<'|'>'|'@'|','|';'|':'|'\\'|'"'|'/'|'['|']'|'?'|'='->false(* '\n', '\r', ' ' are excluded by the following: *)|'\033'..'\126'->true|_->false);;letis_valid_or_quotestr=ifis_validstrthenstrelseMimestring.quotestrendend