summaryrefslogtreecommitdiff
path: root/src/json.bnf
blob: c1b5440db1ee849c672f434ab7377d990a899397 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
[unescaped]: \ -!\#-\[\]-%x10FFFF

--

JSON-text: ws value ws

begin-array: ws "[" ws

begin-object: ws "{" ws

end-array: ws "]" ws

end-object: ws "}" ws

name-separator: ws ":" ws

value-separator: ws "," ws

ws: whitespace ws
ws:

whitespace: " "
whitespace: "\t"
whitespace: "\n"
whitespace: "\r"

value: false
value: null
value: true
value: object
value: array
value: number
value: string

false = "false"

null  = "null"

true  = "true"

object: begin-object members end-object

members:
members: member more-member

more-member: value-separator member more-member
more-member:

member: string name-separator value

array: begin-array array-elements end-array

array-elements:
array-elements: value more-elements

more-elements: value-separator value more-elements
more-elements:

number: minus-or-not int frac-or-not exp-or-not

minus-or-not: minus
minus-or-not:

frac-or-not: frac
frac-or-not:

exp-or-not: exp
exp-or-not:

decimal-point: "."

digit1-9: "1"
digit1-9: "2"
digit1-9: "3"
digit1-9: "4"
digit1-9: "5"
digit1-9: "6"
digit1-9: "7"
digit1-9: "8"
digit1-9: "9"

e: "e"
e: "E"

exp: e minus-or-plus-or-none DIGITS

minus-or-plus-or-none: minus
minus-or-plus-or-none: plus
minus-or-plus-or-none:

frac: decimal-point DIGITS

int: zero
int: digit1-9
int: digit1-9 DIGITS

minus: "-"
plus: "+"
zero: "0"

DIGIT: "0"
DIGIT: "1"
DIGIT: "2"
DIGIT: "3"
DIGIT: "4"
DIGIT: "5"
DIGIT: "6"
DIGIT: "7"
DIGIT: "8"
DIGIT: "9"

DIGITS: DIGIT DIGITS
DIGITS: DIGIT

string: quotation-mark chars quotation-mark

chars: char chars
chars:

char: [unescaped]
char: escape "\""
char: escape "\\"
char: escape "/"
char: escape "b"
char: escape "f"
char: escape "n"
char: escape "r"
char: escape "t"
char: escape "u" 4HEXDIG

escape: "\\"

quotation-mark: "\""

4HEXDIG: HEXDIG HEXDIG HEXDIG HEXDIG

HEXDIG: DIGIT
HEXDIG: letter_a
HEXDIG: letter_b
HEXDIG: letter_c
HEXDIG: letter_d
HEXDIG: letter_e
HEXDIG: letter_F

letter_a: "a"
letter_a: "A"

letter_b: "b"
letter_b: "B"

letter_c: "c"
letter_c: "C"

letter_d: "d"
letter_d: "D"

letter_e: "e"
letter_e: "E"

letter_f: "f"
letter_f: "F"