add Helper.java
[wix.git] / src / url.g
1 // URLs //////////////////////////////////////////////////////////////////////////////
2
3 #import tokens.g as tok
4
5 // "public" /////////////////////////////////////////////////////////////////////
6
7 Path::         = urlchar+
8 Email::        = username "@" Host
9 URL::          = method  "://" Login Host Port (()|"/"|"/" Path) (()|"#"|"#" Path)
10                    -> (~(urlc|[%\#]) | avoidOnUrlTail)
11
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 = [,.;)!]
16
17 // "private" ////////////////////////////////////////////////////////////////////
18
19 Login::      = username              "@"
20              | username ":" password "@"
21              | ()
22 Host         = IP::  tok.digit "." tok.digit "." tok.digit "." tok.digit
23              | DNS:: (part:: [a-zA-Z0-9\-]++) ++/ "."
24 Port::       = (":" `tok.Int)?
25
26 username::   = [a-zA-Z0-9;/?:&=$\-_.+]++
27 password::   = [a-zA-Z0-9;/?:&=$\-_.+]++
28 method::     = [+\-.a-z0-9]+
29 urlchar      = urlc
30              | "%":: "%" [0-9a-fA-F] [0-9a-fA-F]
31 urlc         = [a-zA-Z0-9;/?:&=$\-_.+]
32              | [@~,]               // technically illegal (RFC1738)