Last active
January 15, 2017 13:07
-
-
Save maurobringolf/c19300a5a6f9e3c65d281d8ac915b9a2 to your computer and use it in GitHub Desktop.
A first try at a EBNF for URLs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lowercase_letter = "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" | |
uppercase_letter = "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" | |
letter = lowercase_letter | uppercase_letter | |
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | |
alphanumeric = letter | digit | |
lowercase_alphanumeric = lowercase_letter | digit | |
hyphen = "-" | "_" | |
lowercase_word = lowercase_alphanumeric { lowercase_alphanumeric } | |
word = alphanumeric { alphanumeric } | |
word_with_hyphens = word { hyphen word } | |
number = digit { digit } | |
key_value_pair = word_with_hyphens "=" word_with_hyphens | |
domain_delimiter = "." | "-" | |
protocol = "http" | "https" | |
domain = lowercase_word { domain_delimiter lowercase_word } | |
port = ":" number | |
path = "/" { word_with_hyphens "/" } | |
parameters = "?" key_value_pair { "&" key_value_pair } | |
anchor = "#" word_with_hyphens | |
url = protocol "://" domain [ port ] path [ parameters ] [ anchor ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment