initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# Grammar for subset of JSON - doesn't support full string or number syntax
|
||||
|
||||
root ::= object
|
||||
value ::= object | array | string | number | boolean | "null"
|
||||
|
||||
object ::=
|
||||
"{" ws (
|
||||
string ":" ws value
|
||||
("," ws string ":" ws value)*
|
||||
)? "}"
|
||||
|
||||
array ::=
|
||||
"[" ws (
|
||||
value
|
||||
("," ws value)*
|
||||
)? "]"
|
||||
|
||||
string ::=
|
||||
"\"" (
|
||||
[^"\\] |
|
||||
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
|
||||
)* "\"" ws
|
||||
|
||||
# Only plain integers currently
|
||||
number ::= "-"? [0-9]+ ws
|
||||
boolean ::= ("true" | "false") ws
|
||||
|
||||
# Optional space: by convention, applied in this grammar after literal chars when allowed
|
||||
ws ::= ([ \t\n] ws)?
|
||||
@@ -0,0 +1,14 @@
|
||||
root ::= "[" items "]" EOF
|
||||
|
||||
items ::= item ("," ws* item)*
|
||||
|
||||
item ::= string
|
||||
|
||||
string ::=
|
||||
"\"" word (ws+ word)* "\"" ws*
|
||||
|
||||
word ::= [a-zA-Z]+
|
||||
|
||||
ws ::= " "
|
||||
|
||||
EOF ::= "\n"
|
||||
Reference in New Issue
Block a user