@top url { Protocol Host Port? Path Query } Protocol { "http://" | "https://" } Path { (Slash PathSegment)* } Query { Question (QueryPair)* } QueryPair { Amp? QueryName Equal QueryValue } @tokens { Port { ":" $[0-9]+ } Host { $[a-zA-Z0-9-_.]+ } QueryName { $[a-zA-Z0-9-_.]+ } QueryValue { $[a-zA-Z0-9-_./]+ } PathSegment { $[a-zA-Z0-9-_.]+ } Slash { "/" } Question { "?" } Equal { "=" } Amp { "&" } }