-
Notifications
You must be signed in to change notification settings - Fork 1
/
json.dogma
31 lines (30 loc) · 1.16 KB
/
json.dogma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
dogma_v1 utf-8
- identifier = json
- description = Javascript Object Notation
- charsets = utf-8, utf-16, utf-16be, utf-16le, utf-32, utf-32be, utf-32le
- reference = https://www.json.org/json-en.html
- dogma = https://github.com/kstenerud/dogma/blob/master/v1/dogma_v1.md
document = element;
element = WS & value & WS;
value = object
| array
| string
| number
| "true"
| "false"
| "null"
;
object = '{' & member & (',' & member)* & '}';
member = string & ':' & element;
array = '[' & element & (',' & element)* & ']';
string = WS & '"' (character | escape)* '"' & WS;
character = (unicode(L|M|N|P|S|Z|Cf|Co) | '\[9]') ! ('"' | '\\');
escape = '\\' & ('"' | '\\' | '/' | 'b' | 'f' | 'n' | 'r' | 't' | 'u' & hex{4});
hex = '0'~'9' | 'a'~'f' | 'A'~'F';
number = integer & fraction? & exponent?;
integer = '0' | ('-'? & first_digit & next_digit*);
fraction = '.' & next_digit+;
exponent = ('e' | 'E') & ('+' | '-')? & next_digit+;
first_digit = '1'~'9';
next_digit = '0'~'9';
WS = (' ' | '\[a]' | '\[d]' | '\[9]')*;