diff --git a/examples/JSON/JSON-ab.ebnf b/examples/JSON/JSON-ab.ebnf new file mode 100644 index 0000000..da8c74f --- /dev/null +++ b/examples/JSON/JSON-ab.ebnf @@ -0,0 +1,36 @@ + ::= ( | )+ + + ::= ( '"' | "/" | "b" | "f" | "n" | "r" | "t" | | ) + ::= | "`" + ::= | | " " | "!" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*+" | "," | "-" | "." | "/" | ":" | ";" | "<" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "`" | "{" | "|" | "}" | "~" + ::= | | " " | "!" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*+" | "," | "-" | "." | "/" | ":" | ";" | "<" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "{" | "|" | "}" | "~" + + ::= "u" + + ::= "\" + ::= [0-9] + ::= [A-Z] | [a-z] | "_" + ::= '"' + +/* The ``json-value`` is any valid JSON value with the one exception that the */ +/* ``%x60`` character must be escaped. While it's encouraged that implementations */ +/* use any existing JSON parser for this grammar rule (after handling the escaped */ +/* literal characters), the grammar rule is shown below for completeness:: */ + + ::= + | + | + | + | + | + + ::= "null" + ::= "true" | "false" + ::= "-"? ( "0" | [1-9] [0-9]* ) ( "." [0-9]+ )? ( "e" ( "-" | "+" ) [0-9]+ )? + ::= "[" ( ( "," )* )? "]" + ::= "{" ( ( "," )* )? "}" + ::= ( | )* + + ::= ":" + ::= " "* + \ No newline at end of file diff --git a/examples/JSON/JSON.ebnf b/examples/JSON/JSON.ebnf new file mode 100644 index 0000000..318f5b6 --- /dev/null +++ b/examples/JSON/JSON.ebnf @@ -0,0 +1,38 @@ +quoted_string ::= quote ( unescaped_char | escaped_char )+ quote + +escaped_char ::= escape ( '"' | "/" | "b" | "f" | "n" | "r" | "t" | unicode | escape ) +escaped_literal ::= escaped_char | escape "`" +unescaped_char ::= digit | letter | " " | "!" | "#" | "$" | "%" | "&" | "(" | ")" | "*+" | "," | "-" | "." | "/" | ":" | ";" | "<" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "`" | "{" | "|" | "}" | "~" +unescaped_literal ::= digit | letter | " " | "!" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*+" | "," | "-" | "." | "/" | ":" | ";" | "<" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "{" | "|" | "}" | "~" + +unicode ::= "u" digit digit digit digit + +escape ::= "\" + +digit ::= [0-9] + +letter ::= [A-Z] | [a-z] | "_" +quote ::= '"' + +/* The ``json-value`` is any valid JSON value with the one exception that the */ +/* ``%x60`` character must be escaped. While it's encouraged that implementations */ +/* use any existing JSON parser for this grammar rule (after handling the escaped */ +/* literal characters), the grammar rule is shown below for completeness:: */ + + json_value ::= json_array + | json_boolean + | json_null + | json_number + | json_object + | json_string + + json_null ::= "null" + json_boolean ::= "true" | "false" + json_number ::= "-"? ( "0" | [1-9] [0-9]* ) ( "." [0-9]+ )? ( "e" ( "-" | "+" ) [0-9]+ )? + json_array ::= ws "[" ( ws json_value ws ( "," ws json_value ws )* )? "]" ws + json_object ::= ws "{" ws ( member ws ( "," ws member ws )* )? "}" ws + json_string ::= quote ( unescaped_literal | escaped_literal )* quote + + member ::= quoted_string ws ":" ws json_value + ws ::= " "* + \ No newline at end of file