Skip to content

Commit 2435bfa

Browse files
committed
formalized email addresses
1 parent 134ab0a commit 2435bfa

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
@synopsis{This encodes the mail address part of RFC822}
2+
@pitfalls{
3+
This was taken over literally from RFC822 but not tested.
4+
}
5+
module lang::paths::MailAddress
6+
7+
lexical Address
8+
= adressee: Mailbox
9+
| namedList: Group
10+
;
11+
12+
lexical Group = Phrase ":" {Mailbox ","}+ ";";
13+
14+
lexical Mailbox
15+
= simpleAddress: AddrSpec
16+
| nameAndAddrSpec: Phrase RouteAddr
17+
;
18+
19+
lexical RouteAddr = "\<" Route? AddrSpec "\>";
20+
21+
lexical Route = {Domain "@"}+ ":"; // hard to interpret original: 1#("@" domain) ":"
22+
23+
lexical AddrSpec = globalAddress: LocalPart "@" Domain;
24+
25+
lexical LocalPart = uninterpretedCasePreserved: {Word "."}+ ;
26+
27+
lexical Domain = {SubDomain "."}+;
28+
29+
lexical SubDomain = DomainRef | DomainLiteral;
30+
31+
lexical DomainLiteral = "[" (Dtext | QuotedPair)* "]";
32+
33+
lexical Dtext = (![\\\]\[\n\r\ ] + [\ ])+;
34+
35+
lexical DomainRef = Atom;
36+
37+
lexical Phrase = Word+;
38+
39+
lexical Atom = ![] - [()\<\>@,;:|\".\[\]] - [\a00-a20] - [\ ];
40+
41+
lexical Specials = [()\<\>@,;:|\".\[\]];
42+
43+
lexical Controls = [\a00-\a20];
44+
45+
lexical Word = Atom | QuotedString;
46+
47+
lexical QuotedString = "\"" (Qtext | QuotedPair)* "\"";
48+
49+
lexical Qtext = (![\\\"\n\r] + [\ ])+;
50+
51+
lexical QuotedPair = "\\" CHAR;
52+
53+
lexical CHAR = [\a00-\a7F]; // All of ASCII

‎src/org/rascalmpl/library/lang/paths/URL.rsc‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
@synopsis{Implements RFC1738 for URL syntax and maps them to `loc` values.}
2+
@pitfalls{
3+
This was taken over literall from RFC1738 but not tested.
4+
}
25
module lang::paths::URL
36

7+
extend lang::paths::MailAddress;
48
lexical URL
59
= http: "http://" HostPort ( "/" Hpath ( "?" Search)?)?
610
| ftp: "ftp://" Login ("/" Fpath (";type=" FtpType)?)?

0 commit comments

Comments
 (0)