vz0      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./portable provisionalsimons@cryp.to"Case-insensitive variant of Parsec's 0 function. "Case-insensitive variant of Parsec's 1 function. Match a parser at least n times. Match a parser at least n times, but no more than m times. Helper function to generate 2-based instances for  the 3 class. %Match any character of the alphabet.  Match either "1" or "0". LMatch any 7-bit US-ASCII character except for NUL (ASCII value 0, that is). $Match the carriage return character \r. %Match returns the linefeed character \n. Match the Internet newline \r\n. .Match any US-ASCII control character. That is > any character with a decimal value in the range of [0..31,127]. !Match the double quote character """. ;Match any character that is valid in a hexadecimal number;  ['0'..'9'] and ['A'..'F','a'..'f'] that is. Match the tab ("\t" ) character. Match "linear white-space"$. That is any number of consecutive  , optionally followed by a   and (at least) one more  . Match any character. Match the space. *Match any printable ASCII character. (The "v" stands for  "visible"1.) That is any character in the decimal range of  [33..126].  Match either  or . Match a " quoted pair"#. Any characters (excluding CR and  LF) may be quoted. $Match a quoted string. The specials "\" and  """0 must be escaped inside a quoted string; CR and  LF are not allowed at all.    portable provisionalsimons@cryp.too9The SMTP parsers defined here correspond to the commands  specified in RFC2821, so I won't document them  individually.  !"#$%&'5An SMTP reply is a three-digit return code plus some  waste of bandwidth called "comments". This is what the ; list of strings is for; one string per line in the reply.  4 will append an "\r\n" end-of-line marker to : each entry in that list, so that the resulting string is $ ready to be sent back to the peer. Here is an example:  5 *Rfc2821> print $ Reply (Code Success MailSystem 0) 4 ["worked", "like", "a charm" ]  250-worked  250-like  250 a charm If the message is [], you'll get a really helpful  default text. ().The most general e-mail address has the form:  <[@ route,...:]user@domain>. This type, too,  supports 4 and 5. Note that a "shown" address  is always. enclosed in angular brackets. When comparing ? two mailboxes for equality, the hostname is case-insensitive. *+The `* parser will create this data type from a  string. Note that all command parsers expect their  input to be terminated with  . ,2When a valid command has been recognized, but the / argument parser fails, then this type will be  returned. The 6 contains the name of the % command (in all upper-case) and the 7 ' is, obviously, the error description. -./Optional argument ignored. 0 Might be []. 12345678 Might be [. 9 Might be Z. :;<=>?@AThe parameter may be []. BTriggered in case of / or when 6 is # used before we even have a state. CD-, 5, 4, 3, 2, and 1. EFGHreserved for the user IJKLMNOPreserved for the user QRSTUVWX&Parse a line of SMTP dialogue and run Y to  determine the =. In case of syntax errors,  ? or > will be returned.  Inputs must be terminated with  . See . Y For those who want to parse the + themselves.  Calling this function in R or S will  fail an assertion. If 8 is disabled, it will  return respectively @ and I again. ZnullPath = *) [] "" "" = "<>" [ postmaster = *) [] " postmaster" "" = "< postmaster>" \ Construct a (. Fails 8 if invalid numbers  are given. ]A reply constitutes "success" if the status code is  any of #, ", or  !. ^A reply constitutes "failure" if the status code is  either  or  . _ The replies 221 and 421 signify @. `8This parser recognizes any of the SMTP commands defined  below. Note that all$ command parsers expect their input  to be terminated with  . aThe parser name "data" was taken. bcdefghijklmnoMay have an optional  argument, but it is ignored. pqrstuvwxTODO(: Add IPv6 address and general literals yz{|}~1This is a useful addition: The parser accepts an }  or a . Make the string   terminated no matter what.  '\n' is expanded, otherwise   is appended. Note : that if the string was terminated incorrectly before, it ; still is. This function is useful when reading input with  System.IO.hGetLine which removes the end-of-line  delimiter. 4Construct a parser for a command without arguments.  Expects  ! 9Construct a parser for a command with an argument, which : the given parser will handle. The result of the argument : parser will be applied to the type constructor before it  is returned. Expects  ! o !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~oQWVUTSR=PONMLKJIHGFEDCBA@?><XY+;:9876543210/.-,)*Z['(%&$#"! \]^_`acdefgbijklmhnopqrstuvwxyz{|}~o$#"!  !"#$%&&'(()**+;:9876543210/.-,,-./0123456789:;<=PONMLKJIHGFEDCBA@?>>?@ABCDEFGHIJKLMNOPQWVUTSRRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~portable provisionalsimons@cryp.toCThis data type represents any of the header fields defined in this C RFC. Each of the various instances contains with the return value  of the corresponding parser. AThis data type repesents a parsed Internet Message as defined in ? this RFC. It consists of an arbitrary number of header lines,  represented in the * data type, and a message body, which may  be empty. ;A NameAddr is composed of an optional realname a mandatory  e-mail . Return Nothing if the given parser doesn't match. This = combinator is included in the latest parsec distribution as   optionMaybe , but ghc-6.6.1 apparently doesn' t have it. unfold = 'between (optional cfws) (optional cfws) 6Construct a parser for a message header line from the  header'"s name and a parser for the body. Like -, but allows the obsolete white-space rules. 5Match any US-ASCII non-whitespace control character. (Match any US-ASCII character except for r, n. Match any of the RFC's "special" characters: ()<>[]:;@,.\". Match a " quoted pair". All characters matched by  may be ' quoted. Note that the parsers returns both characters, the # backslash and the actual content. Match "folding whitespace". That is any combination of  and    followed by . ;Match any non-whitespace, non-control character except for "(",  ")", and "\"0. This is used to describe the legal content of  s. Note<: This parser accepts 8-bit characters, even though this is A not legal according to the RFC. Unfortunately, 8-bit content in ; comments has become fairly common in the real world, so we'll just  accept the fact. Match a "comments". That is any combination of ,  s, and & between brackets. Comments may nest. Match any combination of  and . <Match any US-ASCII character except for control characters,   , or space.  and  are made up of this. Match one or more ' characters and skip any preceeding or  trailing . Match % and skip any preceeding or trailing . Match two or more s interspersed by dots. @Match any non-whitespace, non-control US-ASCII character except  for "\" and """.  Match either  or . Match any number of  between double quotes. Any   preceeding or following the "atom" is skipped automatically.  Match either  or . Match either one or more s or an . @Match any non-whitespace, non-control US-ASCII character except  for "\" and """. Match any number of  tokens. "Unstructured text"% is used in free text fields such as . > Please note that any comments or whitespace that prefaces or  follows the actual  is included in the returned string. 0Parse a date and time specification of the form  # Thu, 19 Dec 2002 20:35:46 +0200  where the weekday specification "Thu," is optional. The parser  returns a 9:*, which is set to the appropriate values. & Note, though, that not all fields of 9: will C necessarily be set correctly! Obviously, when no weekday has been - provided, the parser will set this field to ; - regardless D of whether the day actually is a monday or not. Similarly, the day ( of the year will always be returned as 0. The timezone name will  always be empty: "".  Nor will the  parser perform any consistency checking.  It will accept   40 Apr 2002 13:12 +0100 as a perfectly valid date. BIn order to get all fields set to meaningful values, and in order  to verify the date'1s consistency, you will have to feed it into any ( of the conversion routines provided in  System.Time , such as  <5. (When doing this, keep in mind that most functions  return  local time+. This will not necessarily be the time you're  expecting.) This parser will match a  , optionally wrapped in folding  whitespace, or an  and return it's = value. 0This parser will the abbreviated weekday names ("Mon", "Tue", ...)  and return the appropriate = value. *This parser will match a date of the form " dd:mm:yyyy" and return : a tripple of the form (Int,Month,Int) - corresponding to  (year,month,day). 8This parser will match a four digit number and return it' s integer ( value. No range checking is performed. This parser will match a , optionally wrapped in  folding whitespace, or an  and return it's >  value. .This parser will the abbreviated month names ("Jan", "Feb", ...)  and return the appropriate > value. Match either an ., or a one or two digit number and return it. This parser will match a  specification followed by a  ;. It returns the tuple (TimeDiff,Int) corresponding to the ! return values of either parser. 6This parser will match a time-of-day specification of "hh:mm" or  "hh:mm:ss"' and return the corrsponding time as a ?@. 7This parser will match a two-digit number and return it' s integer ( value. No range checking is performed. 7This parser will match a two-digit number and return it' s integer ( value. No range checking is performed. 7This parser will match a two-digit number and return it' s integer ' value. No range checking takes place. <This parser will match a timezone specification of the form  "+hhmm" or "-hhmm" and return the zone's offset to UTC in  seconds as an integer.   is matched as well. Parse a single  or an address  and return the  address(es). Parse a  or an  and return the  address.  Parse an , optionally prefaced with a ,  and return the address.  Parse an  or an   and return the address. Parse a "group" of addresses. That is a  , followed & by a colon, optionally followed by a , followed by a C semicolon. The found address(es) are returned - what may be none.  Here is an example:  E parse group "" "my group: user1@example.org, user2@example.org;" This input comes out as: 4 Right ["user1@example.org","user2@example.org"] Parse and return a . Parse a list of & addresses, every two addresses being A separated by a comma, and return the list of found address(es). Parse a list of & addresses, every two addresses being A separated by a comma, and return the list of found address(es).  Parse an "address specification" . That is a  , followed  by an "@" character, followed by a . Return the complete  address as 6+, ignoring any whitespace or any comments. Parse and return a " local part" of an . That is either  a  or a . Parse and return a " domain part" of an . That is either  a  or a . Parse a "domain literal" . That is a "[" character, followed by  any amount of , followed by a terminating "]" 6 character. The complete string is returned verbatim. 4Parse and return any characters that are legal in a   . That is  or a . -Parse and return any ASCII characters except "[", "]", and  "\". CParse a complete message as defined by this RFC and it broken down E into the separate header fields and the message body. Header lines, B which contain syntax errors, will not cause the parser to abort. & Rather, these headers will appear as  s (which are  unparsed) in the resulting . A message must be really, . really badly broken for this parser to fail. CThis behaviour was chosen because it is impossible to predict what 8 the user of this module considers to be a fatal error; E traditionally, parsers are very forgiving when it comes to Internet  messages. 4If you want to implement a really strict parser, you'll have to put . the appropriate parser together yourself. You'll find that this is ! rather easy to do. Refer to the  parser for further details. AThis parser will return a message body as specified by this RFC; ! that is basically any number of  characters, which may be  divided into separate lines by  . ?This parser will parse an arbitrary number of header fields as 5 defined in this RFC. For each field, an appropriate  value ' is created, all of them making up the  list that this parser  returns. @If you look at the implementation of this parser, you will find  that it uses Parsec's A modifier around all of the fields. C The idea behind this is that fields, which contain syntax errors,  fall back to the catch-all . Thus, this parser will B hardly ever return a syntax error -- what conforms with the idea 0 that any message that can possibly be accepted should be. Parse a "Date:"/ header line and return the date it contains a  9:. Parse a "From:" header line and return the   address(es) contained in it. Parse a "Sender:" header line and return the  address  contained in it. Parse a " Reply-To:" header line and return the   address(es) contained in it. Parse a "To:" header line and return the   address(es) contained in it. Parse a "Cc:" header line and return the   address(es) contained in it. Parse a "Bcc:" header line and return the   address(es) contained in it. Parse a " Message-Id:" header line and return the   contained in it. Parse a " In-Reply-To:"$ header line and return the list of  s contained in it. Parse a " References:"$ header line and return the list of  s contained in it. Parse a " message ID:"' and return it. A message ID is almost  identical to an (, but with stricter rules about folding  and whitespace. Parse a "left ID" part of a . This is almost identical to  the / of an e-mail address, but with stricter rules  about folding and whitespace. Parse a "right ID" part of a . This is almost identical to  the 5 of an e-mail address, but with stricter rules about  folding and whitespace.  Parse one or more occurences of  or  and 3 return the concatenated string. This makes up the  of a  .  Parse one or more occurences of  or  and 3 return the concatenated string. This makes up the  of a  . Parse a "Subject:" header line and return it's contents verbatim. Parse a " Comments:" header line and return it's contents verbatim. Parse a " Keywords:"$ header line and return the list of s 7 found. Please not that each phrase is again a list of s, as  returned by the  parser. Parse a " Resent-Date:"$ header line and return the date it  contains as 9:. Parse a " Resent-From:" header line and return the   address(es) contained in it. Parse a "Resent-Sender:" header line and return the   address(es) contained in it. Parse a " Resent-To:" header line and return the   address contained in it. Parse a " Resent-Cc:" header line and return the   address(es) contained in it. Parse a " Resent-Bcc:" header line and return the  8 address(es) contained in it. (This list may be empty.) Parse a "Resent-Message-ID:" header line and return the   contained in it. BParse an arbitrary header field and return a tuple containing the   and # text of the header. The name will  not contain the terminating colon. @Parse and return an arbitrary header field name. That is one or  more  characters. 8Match and return any ASCII character except for control  characters, whitespace, and ":". Match the obsolete " quoted pair" syntax, which - unlike   - allowed any& ASCII character to be specified when C quoted. The parser will return both, the backslash and the actual  character. Match the obsolete "text" syntax, which - unlike  - allowed  "carriage returns" and " linefeeds". This is really weird; you @ better consult the RFC for details. The parser will return the 6 complete string, including those special characters. Match and return the obsolete "char" syntax, which - unlike   - did not allow "carriage return" and "linefeed". Match and return the obsolete "utext" syntax, which is identical  to . Match the obsolete "phrase" syntax, which - unlike  -  allows dots between tokens.  Match a " phrase list" syntax and return the list of 6s + that make up the phrase. In contrast to a , the  0 separates the individual words by commas. This 2 syntax is - as you will have guessed - obsolete. Parse and return an " obsolete fws" token. That is at least one  = character, followed by an arbitrary number (including zero)  of   followed by at least one more  character. Parse a , but allow for the obsolete folding syntax. Parse a 5 but allow for a two-digit number (obsolete) and the  obsolete folding syntax. Parse a , but allow for the obsolete folding syntax. Parse a , but allow for the obsolete folding syntax.  Parse a , but allow for the obsolete folding syntax.  Parse a , but allow for the obsolete folding syntax.  Parse a , but allow for the obsolete folding syntax.  AMatch the obsolete zone names and return the appropriate offset.  This parser will match the "obsolete angle address" syntax. This ! construct used to be known as a " route address" in earlier RFCs. : There are two differences between this construct and the  5: For one - as usual -, the obsolete form allows for < more liberal insertion of folding whitespace and comments. BSecondly, and more importantly, angle addresses used to allow the  (optional) specification of a "route". The newer version does not. ) Such a routing address looks like this:  5 <@example1.org,@example2.org:simons@example.org> EThe parser will return a tuple that - in case of the above address -  looks like this:  ; (["example1.org","example2.org"],"simons@example.org") BThe first part contains a list of hosts that constitute the route C part. This list may be empty! The second part of the tuple is the  actual  address. This parser parses the "route" part of   and  returns the list of 6%s that make up this route. Relies on   for the actual parsing. AThis parser parses a list of domain names, each of them prefaced  with an "at"7. Multiple names are separated by a comma. The list of  "s is returned - and may be empty. Parse the obsolete syntax of a , which allowed for @ more liberal insertion of folding whitespace and comments. The  actual string is returned. Parse the obsolete syntax of a , which allowed for more B liberal insertion of folding whitespace and comments. The actual  string is returned. 1This parser will match the obsolete syntax for a .  This one is quite weird: An  contains an arbitrary  number of .es - including none -, which are separated by E commas. But you may have multiple consecutive commas without giving  a . You may also have a valid  that  contains no  at all. On the other hand, you must have  at least one comma. #So, this input is perfectly valid:   "," 3But this one is - contrary to all intuition - not:   "simons@example.org"  Strange, isn't it? This parser is identical to  but parses a list of  es rather than #es. The main difference is that an   may contain #s. Please note that as of now, the = parser will return a simple list of addresses; the grouping  information is lost. Parse a ( header line but allow for the obsolete  folding syntax. Parse a ( header line but allow for the obsolete  folding syntax. Parse a ( header line but allow for the obsolete  folding syntax. Parse a ( header line but allow for the obsolete  folding syntax. Parse a ( header line but allow for the obsolete  folding syntax. Parse a ( header line but allow for the obsolete  folding syntax. Parse a ( header line but allow for the obsolete  folding syntax. Parse a ( header line but allow for the obsolete  folding syntax.  Parse an ( header line but allow for the obsolete ) folding and the obsolete phrase syntax. Parse a ( header line but allow for the obsolete ) folding and the obsolete phrase syntax.  Parses the " left part"* of a message ID, but allows the obsolete ! syntax, which is identical to a .   Parses the " right part"* of a message ID, but allows the obsolete ! syntax, which is identical to a . !Parse a ( header line but allow for the obsolete  folding syntax. "Parse a ( header line but allow for the obsolete  folding syntax. #Parse a ( header line but allow for the obsolete + folding syntax. Also, this parser accepts . $Parse a ( header line but allow for the obsolete  folding syntax. %Parse a ( header line but allow for the obsolete  folding syntax. &Parse a ( header line but allow for the obsolete  folding syntax. 'Parse a ( header line but allow for the obsolete  folding syntax. (Parse a ( header line but allow for the obsolete  folding syntax. )Parse a ( header line but allow for the obsolete  folding syntax. *Parse a ( header line but allow for the obsolete  folding syntax. +Parse a Resent-Reply-To header line but allow for the  obsolete folding syntax. ,-.Match  . /This parser is identical to  but allows the more ) liberal line-folding syntax between the " field_name" and the "field  text".       !"#$%&'()*+,-./      !"#$%&'()*+,-./      !"#$%&'()*+,-./B      !"#$%&'()*+,--./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~vwxu      !"#$%&'()*+)*,)-./01/23/45/67)89/6:;<=;<=;<>;<?;<@;<A;<B;<B)CDE hsemail-1.2%Text.ParserCombinators.Parsec.Rfc2234%Text.ParserCombinators.Parsec.Rfc2821%Text.ParserCombinators.Parsec.Rfc2822caseChar caseStringmanyNmanyNtoM parsec2readalphabit charactercrlfcrlfctldquotehexdightablwspoctetspvcharwsp quoted_pair quoted_string SmtpParserCategory MailSystem Unspecified4 Unspecified3 Connection InformationSyntax SuccessCodePermanentFailureTransientFailureIntermediateSuccessSuccessPreliminarySuccessUnused0SmtpCodeCode SmtpReplyReplyMailboxSmtpCmdWrongArgTurnQuitNoopHelpExpnVrfySamlSomlSendRsetDataRcptToMailFromEhloHeloSmtpdFSMEvent Unrecognized SyntaxErrorInShutdown SeeksHelpSayOK ResetState NotImplemenedNeedRcptToFirstNeedMailFromFirst NeedHeloFirstDeliver StartData AddRcptTo SetMailFrom SayEhloAgainSayEhlo SayHeloAgainSayHeloGreeting SessionStateHaveQuitHaveData HaveRcptTo HaveMailFromHaveHeloUnknownsmtpdFSM handleSmtpCmdnullPath postmasterreply isSuccess isFailure isShutdownsmtpCmdsmtpDatarsetquitturnheloehlomailrcptsendsomlsamlvrfyexpnhelpnoop from_pathto_pathpathmailbox local_partdomaina_d_l at_domainaddress_literal ipv4_literalipv4addr subdomain dot_stringatomsnumnumberwordfixCRLFmkCmd0mkCmd1 tokenListField ObsReceivedReceived ResentReplyToResentMessageID ResentBccResentCcResentTo ResentSender ResentFrom ResentDateDateKeywordsCommentsSubject References InReplyTo MessageIDBccCcToReplyTo ReturnPathSenderFrom OptionalFieldMessageNameAddr nameAddr_name nameAddr_addr maybeOptionunfoldheader obs_header no_ws_ctltextspecialsfwsctextcommentcfwsatextdot_atom dot_atom_textqtextqcontentphraseutext unstructured date_time day_of_weekday_namedateyearmonth month_namedaytime time_of_dayhourminutesecondzoneaddress name_addr angle_addrgroup display_name mailbox_list address_list addr_specdomain_literaldcontentdtextmessagebodyfields orig_datefromsenderreply_totoccbcc message_id in_reply_to referencesmsg_idid_leftid_right no_fold_quoteno_fold_literalsubjectcommentskeywords resent_date resent_from resent_sender resent_to resent_cc resent_bcc resent_msg_id return_pathreceived name_val_list name_val_pair item_name item_valueoptional_field field_nameftextobs_qpobs_textobs_char obs_utext obs_phraseobs_phrase_listobs_fwsobs_day_of_weekobs_year obs_monthobs_dayobs_hour obs_minute obs_secondobs_zoneobs_angle_addr obs_routeobs_domain_listobs_local_part obs_domain obs_mbox_list obs_addr_list obs_fields obs_orig_dateobs_from obs_sender obs_reply_toobs_toobs_ccobs_bccobs_message_idobs_in_reply_toobs_references obs_id_left obs_id_right obs_subject obs_comments obs_keywordsobs_resent_fromobs_resent_sendobs_resent_date obs_resent_to obs_resent_ccobs_resent_bccobs_resent_midobs_resent_reply obs_return obs_receivedobs_path obs_optional parsec-3.1.0Text.Parsec.CharcharstringText.Parsec.StringParserbaseGHC.ReadReadGHC.Showshow Text.ReadreadGHC.BaseStringText.Parsec.Error ParseErrorassertold-time-1.0.0.5 System.Time CalendarTimeMonday toClockTimeDayMonthTimeDiff"Text.ParserCombinators.Parsec.Primtry