From 0756ad1fa7461cc7618c88a1c5962491e14f509f Mon Sep 17 00:00:00 2001 From: Mauro Iazzi Date: Wed, 8 Apr 2009 21:10:15 +0200 Subject: [PATCH] added overall message spec --- mime.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mime.lua b/mime.lua index c3daa26..3f37f9a 100644 --- a/mime.lua +++ b/mime.lua @@ -251,6 +251,24 @@ local address = function () } end +local overall_message = function () + setfenv(1, lpeg) + return { + -- overall message specification + -- + -- RRC 2822 Section 3.5: + -- + -- A message consists of header fields, optionally followed by a message + -- body. Lines in a message MUST be a maximum of 998 characters + -- excluding the CRLF, but it is RECOMMENDED that lines be limited to 78 + -- characters excluding the CRLF. + -- + -- this grammar does not enforce the 78 chars limit yet + ["message"] = (V"fields" + V"obs-fields") * (V"CRLF" * V"body")^-1, -- RFC 2822 Section 3.5 + ["body"] = (V"text"^-998 * V"CRLF")^0 * V"text"^-998, -- RFC 2822 Section 3.5 +} +end + local obs_strict = { ["obs-FWS"] = lpeg.P(false), ["obs-qp"] = lpeg.P(false), -- 2.11.4.GIT