-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjson-rfc7159.minimal.tavor
65 lines (52 loc) · 1.83 KB
/
json-rfc7159.minimal.tavor
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
/*
This is a adapted copy of json-rfc-7159.tavor
The following changes have been made to reduce the possible permutations:
- remove whitespaces
- reduce character patterns to min and max permutation
- reduces numbers to a set of nice values
*/
START = Value
Array = beginArray,
?(,
Value,
*(valueSeparator Value),
),
endArray
Object = beginObject,
?(,
Member,
*(valueSeparator Member),
),
endObject
Member = String, // Member name, should be unique per object
nameSeparator,
Value
Number = "0" | "-0" | "949" | "999" | "-544" | "0.0" | "-0.0" | "0.4" | "0.00" | "0.40" | "-0.04" | "0e0" | "0e4" | "0E9" | "0e-9" | "0e+0" | "0e+9" | "0E-9" | "0E+0" | "0E+4" | "0e00" | "100E+99" | "140E+99" | "-999.99E+99" // ?("-") (0 | [1-9]*([0-9])) ?("." +([0-9])) ?([eE] ?("-" | "+") +([0-9]))
String = "\"" *(Char) "\""
Char = CharUnescaped | CharEscaped
CharUnescaped = [\x20\x21\x23\x5B\x5D\x{10FFFF}]// [\x20-\x21] | [\x23-\x5B] | [\x5D-\x{10FFFF}] // 10FFFF -> 21bit of unicode
CharEscaped = "\\" (,
"\"", // quotation mark
| "\\", // reverse solidus
| "/", // solidus
| "b", // backspace
| "f", // form feed
| "n", // line feed
| "r", // carriage return
| "t", // tab
| "u" ("0000" | "FFFF"), // +4([a-fA-F0-9]), // 4 hex digits
)
Value = Object,
| Array,
| Number,
| String,
| "false", // must be lower case
| "null", // must be lower case
| "true" // must be lower case
// Helper
beginArray = "["
beginObject = "{"
endArray = "]"
endObject = "}"
nameSeparator = ":"
valueSeparator = ","