ENGINE-95 commit before translation to leg peg-mime
authorKrista Grothoff <krista@pep-project.org>
Wed, 21 Sep 2016 01:17:10 +0200
branchpeg-mime
changeset 1182179d3ba1053d
parent 1181 d5dcb3df9ef6
child 1183 9c5df64440d0
ENGINE-95 commit before translation to leg
mime-parser/mailmime.peg
     1.1 --- a/mime-parser/mailmime.peg	Tue Sep 20 09:57:22 2016 +0200
     1.2 +++ b/mime-parser/mailmime.peg	Wed Sep 21 01:17:10 2016 +0200
     1.3 @@ -61,11 +61,11 @@
     1.4  #VersionString           <-     Text* Digit Text* "." Text* Digit Text* 
     1.5  VersionString           <-      HeaderText
     1.6  ContentTypeString       <-      ContentType "/" ContentSubtype (";" Parameter)*
     1.7 -ContentDispoString      <-      HeaderText
     1.8 +ContentDispoString      <-      ContentDisposition
     1.9  TransfEncodeString      <-      "7bit" / "8bit" / "binary" /
    1.10                                  "quoted-printable" / "base64" /
    1.11 -                                IETFToken / XToken
    1.12 -ContentIDString         <-      HeaderText
    1.13 +                                XToken / IETFToken
    1.14 +ContentIDString         <-      MsgID
    1.15  ContentDescString       <-      HeaderText
    1.16  ExtensionString         <-      HeaderText
    1.17  
    1.18 @@ -77,16 +77,18 @@
    1.19  CompositeContentType    <-      "message" / "multipart" / 
    1.20                                  ExtensionToken
    1.21  ExtensionToken          <-      XToken / IETFToken
    1.22 -XToken                  <-      "X-" Text
    1.23 -IETFToken               <-      Text
    1.24 -ContentSubtype          <-      ExtensionToken / IANAToken
    1.25 -IANAToken               <-      Text
    1.26 +XToken                  <-      "X-" Token
    1.27 +IETFToken               <-      Token
    1.28 +ContentSubtype          <-      "mixed" / "digest" / "rfc822" / "alternative" / "related" /
    1.29 +                                "signed" / "encrypted" / "pgp-encrypted" / "pgp-keys" / "pgp-signature" 
    1.30 +                                / ExtensionToken / IANAToken
    1.31 +IANAToken               <-      Token
    1.32  
    1.33  Parameter               <-      RegularParameter / ExtendedParameter
    1.34  RegularParameter        <-      RegularParameterName "=" Value
    1.35  RegularParameterName    <-      Attribute Section?
    1.36  Value                   <-      Token / QuotedString
    1.37 -Token                   <-      SymbolNoTSpecials+
    1.38 +Token                   <-      (![TSpecials ASCII_CTL Space] ASCII_CHAR)?
    1.39  Attribute               <-      AttributeChar+
    1.40  AttributeChar           <-      (![NonAttributeChar] ASCII_Printable)
    1.41  NonAttributeChar        <-      Space / "*" / "'" / "%" / TSpecials
    1.42 @@ -102,7 +104,14 @@
    1.43  ExtOctet                <-      "%" HexDigit HexDigit
    1.44  
    1.45  
    1.46 -
    1.47 +ContentDisposition      <-      DispositionType *( ";" DispositionParm )
    1.48 +DispositionType         <-      "inline" / "attachment" / DispExtType
    1.49 +DispExtType             <-      Token
    1.50 +DispositionParm         <-      FilenameParm / DispositionExtParm
    1.51 +FilenameParm            <-      "filename" "=" Value / "filename*" "=" ExtValue
    1.52 +DispositionExtParm      <-      Token "=" Value / ExtToken "=" ExtValue
    1.53 +ExtToken                <-      Token "*"
    1.54 +ExtValue                <-      Value
    1.55  
    1.56  # Message-related headers (per RFC2822)
    1.57  MessageHeader           <-     ( MessageIDHeader /
    1.58 @@ -116,7 +125,7 @@
    1.59                                  MessageRefsHeader ) CRLF      
    1.60                                  
    1.61  MessageIDHeader         <-      MessageIDKey COLON IDString
    1.62 -MessageToHeader         <-      MessageToKey COLON < ToString >     {printf("To: %s\n", yytext, stderr);}
    1.63 +MessageToHeader         <-      MessageToKey COLON < ToString >     { printf("YO!!!\n"); printf("To: %s\n", yytext); }
    1.64  MessageFromHeader       <-      MessageFromKey COLON FromString
    1.65  MessageCCHeader         <-      MessageCCKey COLON CCString
    1.66  MessageBCCHeader        <-      MessageBCCKey COLON BCCString
    1.67 @@ -134,11 +143,11 @@
    1.68  MessageInReplyToKey     <-      'In-Reply-To'
    1.69  MessageRefsKey          <-      'References'  
    1.70  IDString                <-      MsgID CRLF
    1.71 -ToString                <-      AddressList
    1.72 +ToString                <-      AddressList { printf("YO1!!!\n"); }
    1.73  FromString              <-      MailboxList
    1.74  CCString                <-      AddressList
    1.75  BCCString               <-      AddressList
    1.76 -SubjString              <-      HeaderText
    1.77 +SubjString              <-      < HeaderText > { printf("*** Subject: %s\n", yytext); }
    1.78  ReplyToString           <-      AddressList
    1.79  InReplyToString         <-      MsgID+
    1.80  RefsString              <-      MsgID+
    1.81 @@ -146,11 +155,11 @@
    1.82  
    1.83  # RFC2822 Address Specification
    1.84  Address                 <-      Mailbox / Group
    1.85 -Mailbox                 <-      NameAddr / AddrSpec
    1.86 +Mailbox                 <-      (NameAddr / AddrSpec) { printf("YO2!!!\n"); }
    1.87  NameAddr                <-      DisplayName? AngleAddr
    1.88  AngleAddr               <-      CFWS? "<" AddrSpec ">" CFWS? / ObsAngleAddr
    1.89  Group                   <-      DisplayName ":" (MailboxList / CFWS)? ";" CFWS?
    1.90 -DisplayName             <-      Phrase
    1.91 +DisplayName             <-      Phrase 
    1.92  MailboxList             <-      (Mailbox ("," Mailbox)*) / ObsMBoxList
    1.93  AddressList             <-      (Address ("," Address)*) / ObsAddrList
    1.94  
    1.95 @@ -212,7 +221,7 @@
    1.96  QuotedPair          <-      "\\". / "\\" Text
    1.97  
    1.98  Text                <-      ( Word / Space )+
    1.99 -Word                <-      ( AlphaNum / Symbol )
   1.100 +Word                <-      ( AlphaNum / Symbol )+
   1.101  AlphaNum            <-      Alpha / Digit
   1.102  Alpha               <-      [a-zA-Z]
   1.103  Digit               <-      [0-9]
   1.104 @@ -221,7 +230,6 @@
   1.105  Space               <-      [' ' '\t']
   1.106  
   1.107  OrdinarySymbol      <-      ["!" "#" "$" "%" "&" "'" "*" "+" "\-" "/" "=" "?" "^" "_" "`" "{" "|" "}" "~" "\[" "\]" "@" ";" "." "<" ">" "\"" "(" ")" "," "\\"]
   1.108 -SymbolNoTSpecials   <-      ["!" "#" "$" "%" "&" "'" "*" "+" "-" "." "^" "_" "`" "{" "|" "}" "~"]
   1.109  CommentSymbols      <-      [\041-\047] / [\52-57] / [\072-\100] / [\133] / [\135-\140] / [\173-177]
   1.110  
   1.111  TSpecials           <-      !["."] (Specials / ["/" "?" "="])
   1.112 @@ -295,7 +303,7 @@
   1.113  UTF8Tail            <-      [\200-\277]
   1.114  
   1.115  RFCWord             <-      Atom / QuotedString
   1.116 -Phrase           <-      RFCWord+ / ObsPhrase
   1.117 +Phrase              <-      RFCWord+ / ObsPhrase
   1.118  ObsPhrase           <-      RFCWord (RFCWord / "." / CFWS)*
   1.119  
   1.120