-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurl.rm
56 lines (41 loc) · 787 Bytes
/
url.rm
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
#include "chars.rm"
#include "eng.rm"
package url;
import digit,lc from chars;
import noun_singular from eng;
top: (url "\n"){20};
url:
"http://" hostport path;
url_wparams:
"http://" hostport path ("?" params)?;
hostport:
(dns | ip) (":" port)?;
dns:
(name "."){1,3} tld;
tld:
"com"|"edu"|"org"|"net";
port:
nonzero_digit
digit{0,4};
fragment:
name;
ip:
(ottff "."){3} ottff;
ottff:
nonzero_digit |
nonzero_digit digit |
"1" digit{2} |
"2" ("0"|"1"|"2"|"3"|"4") digit |
"25" ("0"|"1"|"2"|"3"|"4"|"5");
nonzero_digit:
"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9";
path: directory "/" label "." lc{3};
directory:
"/" label directory?;
label: noun_singular > /[^A-Za-z]/_/;
name: label > /_//;
params:
param |
param "&" params;
param:
lc "=" (label | digit{1,5});