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

Path { ("/" (Placeholder | PathSegment))+ }

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

@tokens {
    Protocol { $[a-zA-Z]+ "://" }
    Host { $[a-zA-Z0-9-_.:\[\]]+ }
    @precedence { Protocol, Host }

    Placeholder { ":" ![/?#]+ }
    PathSegment { ![?#/]+ }
    @precedence { Placeholder, PathSegment }

    queryPair { ($[a-zA-Z0-9]+ ("=" $[a-zA-Z0-9]*)?) }
}

@external propSource highlight from "./highlight"
