1 // URLs //////////////////////////////////////////////////////////////////////////////
3 #import tokens.g as tok
5 // "public" /////////////////////////////////////////////////////////////////////
8 Email:: = username "@" Host
9 URL:: = method "://" Login Host Port (()|"/"|"/" Path) (()|"#"|"#" Path)
10 -> (~(urlc|[%\#]) | avoidOnUrlTail)
12 // An url must not end with these characters if it appears "bare"
13 // inline within a text block (ie without braces surrounding it).
14 // This ensures that punctuation doesn't "stick" to the end of the url.
15 avoidOnUrlTail = [,.;)!]
17 // "private" ////////////////////////////////////////////////////////////////////
19 Login:: = username "@"
20 | username ":" password "@"
22 Host = IP:: tok.digit "." tok.digit "." tok.digit "." tok.digit
23 | DNS:: (part:: [a-zA-Z0-9\-]++) ++/ "."
24 Port:: = (":" `tok.Int)?
26 username:: = [a-zA-Z0-9;/?:&=$\-_.+]++
27 password:: = [a-zA-Z0-9;/?:&=$\-_.+]++
28 method:: = [+\-.a-z0-9]+
30 | "%":: "%" [0-9a-fA-F] [0-9a-fA-F]
31 urlc = [a-zA-Z0-9;/?:&=$\-_.+]
32 | [@~,] // technically illegal (RFC1738)