classnetColarEmail::MsgParser

sys::Obj
  netColarEmail::MsgParser

MsgParser : Parse a Mail message (data) into a parse tree (to be used to build a MailMsg) See RFC 5322

aChars

const Int[] aChars := ...

isAtext

Bool isAtext(Int c)

0-9 a-z A-Z and aChars

isBodyChar

Bool isBodyChar(Int c)

text = %d1-9 / %d11 / %d12 / %d14-127

isQtext

Bool isQtext(Int c)

%d33 / %d35-91 /%d93-126

isVchar

Bool isVchar(Int char)

Printable characters

isWsp

Bool isWsp(Int char)

white space: space or tab

readAtext

MailNode readAtext(InStream in)

Read aText -> See isAtext()

readAtom

MailNode readAtom(InStream in)

Fandoc ERRORS:
Line 1 - Invalid annotation []

[CFWS] 1*atext [CFWS]

readBody

MailNode readBody(InStream in)

Fandoc ERRORS:
Line 2 - Invalid *emphasis*

Read the email body
body            =   (*(*998text CRLF) *998text) / obs-body

readCcontent

MailNode readCcontent(InStream in)

ctext / quoted-pair / comment

readCfws

MailNode readCfws(InStream in)

Fandoc ERRORS:
Line 1 - Invalid annotation []

(1*([FWS] comment) [FWS]) / FWS

readComment

MailNode readComment(InStream in)

Fandoc ERRORS:
Line 1 - Invalid annotation []

"(" *([FWS] ccontent) [FWS] ")"

readCtext

MailNode readCtext(InStream in)

%d33-39 / %d42-91 / %d93-126 /obs-ctext Not dealing with the obs-ctext for now (obsolete))

readDotAtom

MailNode readDotAtom(InStream in)

Fandoc ERRORS:
Line 1 - Invalid annotation []

dot-atom        =   [CFWS] dot-atom-text [CFWS]

readDotAtomText

MailNode readDotAtomText(InStream in)

dot-atom-text = 1*atext ("." 1atext)

readFoldingWs

MailNode readFoldingWs(InStream in)

space or tab or \r\n

readMessage

MailNode readMessage(InStream in)

Read a whole message (root node)

readPhrase

MailNode readPhrase(InStream in)

phrase = 1*word / obs-phrase Not dealing with obs-phrase yet

readQcontent

MailNode readQcontent(InStream in)

qcontent = qtext / quoted-pair

readQtext

MailNode readQtext(InStream in)

qtext = %d33 / %d35-91 /%d93-126 /obs-qtext Not dealing with obs-qtext for now

readQuotedPair

MailNode readQuotedPair(InStream in)

Quoted pair. Ex: \t

readQuotedString

MailNode readQuotedString(InStream in)

quoted-string   =   [CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS]
readUnfoldedLine

Str readUnfoldedLine(InStream in)

Read a folded line as a single line If the next line starts with whitespace (space or tab), it's a "folded" line

readUnstructured

MailNode readUnstructured(InStream in)

Fandoc ERRORS:
Line 1 - Invalid annotation []

unstructured    =   (*([FWS] VCHAR) *WSP) / obs-unstruct
Not dealing with obs-unstruct yet

readWord

MailNode readWord(InStream in)

word = atom / quoted-string

readWsp

MailNode readWsp(InStream in)

unread

Void unread(InStream in, Str str)

unreadNodes

Void unreadNodes(InStream in, MailNode[] nodes)