-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathURL.rsc
More file actions
119 lines (71 loc) · 2.92 KB
/
URL.rsc
File metadata and controls
119 lines (71 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@synopsis{Implements RFC1738 for URL syntax and maps them to `loc` values.}
@pitfalls{
This was taken over literall from RFC1738 but not tested.
}
module lang::paths::URL
extend lang::paths::MailAddress;
lexical URL
= http: "http://" HostPort ( "/" Hpath ( "?" Search)?)?
| ftp: "ftp://" Login ("/" Fpath (";type=" FtpType)?)?
| news: "news:" GroupPart
| nntp: "nntp://" HostPort "/" Group ("/" Digit+)?
| telnet: "telnet://" Login "/"?
| gopher: "gopher://" HostPort ( "/" ( Gtype ( Selector ("%09" Search ("%09" GopherPlusString)? )? )? )? )?
| waisdatabase: "wais://" HostPort "/" Database
| waisindex: "wais://" HostPort "/" Database "?" Search
| waisdoc: "wais://" HostPort "/" Database "/" Wtype "/" Wpath
| mailto: "mailto:" Encoded822addr
| file: "file://" (Host | "localhost")? "/" Fpath
| prospero: "prospero://" HostPort "/" Ppath *[ Fieldspec ]
| other: Scheme ":" SchemePart
;
lexical Ppath = {Psegment "/"}+;
lexical Psegment = (Uchar | [?:@&=])*;
lexical Fieldspec = ";" FieldName "=" FieldValue;
lexical FieldName = (Uchar | [?:@&])*;
lexical FieldValue = (Uchar | [?:@&])*;
lexical Database = Uchar*;
lexical Wtype = Uchar*;
lexical Wpath = Uchar*;
lexical GroupPart = "*" | Group | Article;
lexical Group = Alpha (Alpha | Digit | [\-.+_])*;
lexical Article = (Uchar | [;/?:&=])* "@" Host;
lexical Encoded822addr = Xchar+; // further defined in RFC822
lexical Gtype = Xchar;
lexical Selector = Xchar*;
lexical GopherPlusString = Xchar*;
lexical Hpath = {Hsegment "/"}+;
lexical Hsegment = (Uchar | [;:@&=])*;
lexical Search = (Uchar | [;:@&=])*;
lexical Fpath = {Fsegment "/"}+;
lexical Fsegment= (Uchar | [?:@&=])*;
lexical FtpType = [AIDaid];
lexical Scheme = [a-z0-9+\-.]+;
lexical SchemePart = Xchar* | IpSchemePart;
lexical IpSchemePart = "//" Login ("/" UrlPath);
lexical Login = ( User ( ":" Password )? "@" )? HostPort;
lexical HostPort = Host ( ":" Port )?;
lexical Host = HostName | HostNumber;
lexical HostName = (DomainLabel ".")* TopLabel;
lexical DomainLabel = {AlphaDigit "-"}+;
lexical TopLabel = Alpha {AlphaDigit "-"}+;
lexical HostNumber = Digit+ "." Digit+ "." Digit+ "." Digit+;
lexical Port = Digit+;
lexical User = (Uchar | [;?&=])*;
lexical Password = (Uchar | [;?&=])*;
lexical UrlPath = Xchar* ; //depends on protocol see section 3.1 of RFC1738
lexical Alpha = LowAlpha | HighAlpha;
lexical AlphaDigit = Alpha | Digit;
lexical LowAlpha = [a-z];
lexical HighAlpha = [A-Z];
lexical Digit = [0-9];
lexical Safe = [$ \- _ . +];
lexical Extra = [!*\'(),];
lexical National = [{}|\\^~\[\]`];
lexical Punctuation = [\<\>#%\"];
lexical Reserved = [;/?:@&=];
lexical Hex = Digit | [A-Fa-f];
lexical Escape = "%" Hex Hex;
lexical Unreserved = Alpha | Digit | Safe | Extra;
lexical Uchar = Unreserved | Escape;
lexical Xchar = Unreserved | Reserved | Escape;