; Paparazzi URL format v1.0.1
; BNF format as RFC 1738
; May 22, 2006 Nate Weaver (Wevah)

; Example
; paparazzi:(width=800,height=600)http://www.google.com/

paparazziurl   = "paparazzi:" [ params ] resourceurl

params         = "(" 1#param ")"

param          = paramname [ "=" paramvalue ]

paramname      = [ "min" | "max" | "crop" ] "width" |
                 [ "min" | "max" | "crop" ] "height" |
                 "nocrop"
                 
                 ; minwidth/minheight are equivalent to width/height
                 ; maxwidth/maxheight are equivalent to cropwidth/cropheight
                 ; nocrop sets crop values to infinity and has no value
                 ; unset values are left as-is

paramvalue     = *digit
                 ; may change in future versions if other parameters are created

resourceurl    = httpurl | httpsurl | fileurl
                 ; as per RFC 1738

; FILE

fileurl        = "file://" [ host | "localhost" ] "/" fpath
fpath          = fsegment *[ "/" fsegment ]
fsegment       = *[ uchar | "?" | ":" | "@" | "&" | "=" ]

; HTTP(S)

httpurl        = "http://" hostport [ "/" hpath [ "?" search ]]
httpsurl       = "https://" hostport [ "/" hpath [ "?" search ]]
hpath          = hsegment *[ "/" hsegment ]
hsegment       = *[ uchar | ";" | ":" | "@" | "&" | "=" ]
search         = *[ uchar | ";" | ":" | "@" | "&" | "=" ]

; Miscellaneous definitions

lowalpha       = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" |
                 "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" |
                 "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" |
                 "y" | "z"
hialpha        = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" |
                 "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" |
                 "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"

alpha          = lowalpha | hialpha

digit          = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
hex            = digit | "A" | "B" | "C" | "D" | "E" | "F" |
                 "a" | "b" | "c" | "d" | "e" | "f"
escape         = "%" hex hex

unreserved     = alpha | digit | safe | extra
uchar          = unreserved | escape