You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

content_type.rl 1.4KB

123456789101112131415161718192021222324252627282930313233343536
  1. %%{
  2. machine content_type;
  3. include smtp_whitespace "smtp_whitespace.rl";
  4. # https://tools.ietf.org/html/rfc2045#section-5.1
  5. ccontent = ctext | FWS | '(' @{ fcall balanced_ccontent; };
  6. balanced_ccontent := ccontent* ')' @{ fret; };
  7. comment = "(" (FWS? ccontent)* FWS? ")";
  8. CFWS = ((FWS? comment)+ FWS?) | FWS;
  9. qcontent = qtextSMTP | quoted_pairSMTP;
  10. quoted_string = (DQUOTE
  11. (((FWS? qcontent)* FWS?) >Quoted_Str_Start %Quoted_Str_End)
  12. DQUOTE);
  13. token = 0x21..0x27 | 0x2a..0x2b | 0x2c..0x2e | 0x30..0x39 | 0x41..0x5a | 0x5e..0x7e;
  14. value = (quoted_string | (token)+) >Param_Value_Start %Param_Value_End;
  15. attribute = (token+) >Param_Name_Start %Param_Name_End;
  16. parameter = CFWS? attribute FWS? "=" FWS? value CFWS?;
  17. ietf_token = token+;
  18. custom_x_token = 'x'i "-" token+;
  19. extension_token = ietf_token | custom_x_token;
  20. iana_token = token+;
  21. main_type = (extension_token) >Type_Start %Type_End;
  22. sub_type = (extension_token | iana_token) >Subtype_Start %Subtype_End;
  23. content_type = main_type ("/" sub_type)? (((CFWS? ";"+) | CFWS) parameter CFWS?)*;
  24. prepush {
  25. if (top >= st_storage.size) {
  26. st_storage.size = (top + 1) * 2;
  27. st_storage.data = realloc (st_storage.data, st_storage.size * sizeof (int));
  28. g_assert (st_storage.data != NULL);
  29. stack = st_storage.data;
  30. }
  31. }
  32. }%%