@top url { Protocol? Host Port? Path? Query? }

Query {
    "?" queryPair ("&" queryPair)*
}

@tokens {
  Protocol { $[a-zA-Z]+ "://" }
  Path { ("/" $[a-zA-Z0-9\-_.]*)+ }
  queryPair { ($[a-zA-Z0-9]+ ("=" $[a-zA-Z0-9]*)?) }
  Port { ":" $[0-9]+ }
  Host { $[a-zA-Z0-9-_.]+ }

  // Protocol/host overlaps, so give proto explicit precedence
  @precedence { Protocol, Host }
}

@external propSource highlight from "./highlight"
