Newer
Older
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
// These constants are used in the JSON date/time type definitions
const charstring
dash := "-",
cln := ":",
year := "[0-9]#4",
yearExpansion := "(-([1-9][0-9]#(0,))#(,1))#(,1)",
month := "(0[1-9]|1[0-2])",
dayOfMonth := "(0[1-9]|[12][0-9]|3[01])",
hour := "([01][0-9]|2[0-3])",
minute := "([0-5][0-9])",
second := "([0-5][0-9])",
sFraction := "(.[0-9]#(1,))#(,1)",
endOfDayExt := "24:00:00(.0#(1,))#(,1)",
nums := "[0-9]#(1,)",
ZorTimeZoneExt := "(Z|[+-]((0[0-9]|1[0-3]):[0-5][0-9]|14:00))#(,1)",
durTime := "(T[0-9]#(1,)"&
"(H([0-9]#(1,)(M([0-9]#(1,)(S|.[0-9]#(1,)S))#(,1)|.[0-9]#(1,)S|S))#(,1)|"&
"M([0-9]#(1,)(S|.[0-9]#(1,)S)|.[0-9]#(1,)M)#(,1)|"&
"S|"&
".[0-9]#(1,)S))";
type universal charstring utf8string;
type utf8string JSONCompatibleString
(
char(0,0,0,9)..char(0,0,0,9),
char(0,0,0,10)..char(0,0,0,10),
char(0,0,0,13)..char(0,0,0,13),
char(0,0,0,32)..char(0,0,215,255),
char(0,0,224,0)..char(0,0,255,253),
char(0,1,0,0)..char(0,16,255,253)
);
type utf8string JSONStringWithNoWhitespace
(
char(0,0,0,33)..char(0,0,215,255),
char(0,0,224,0)..char(0,0,255,253),
char(0,1,0,0)..char(0,16,255,253)
);
type utf8string JSONStringWithNoCRLFHT
(
char(0,0,0,32)..char(0,0,215,255),
char(0,0,224,0)..char(0,0,255,253),
char(0,1,0,0)..char(0,16,255,253)
);
// JSON Number type (generic)
type float Number (!-infinity .. !infinity) /*with {
variant "JSON:number"
// Integer type
type integer Integer (-infinity .. infinity) /*with {
variant "JSON:integer"
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
}*/;
type JSONStringWithNoCRLFHT NormalizedString /*with {
variant "JSON:normalizedString";
}*/;
type JSONStringWithNoWhitespace Name /*with {
variant "JSON:Name";
}*/;
type Name NCName /*with {
variant "JSON:NCName";
}*/;
type NormalizedString Token /*with {
variant "JSON:token";
}*/;
type JSONStringWithNoCRLFHT AnyURI /*with {
variant "JSON:anyURI";
}*/;
type charstring Duration (pattern
"{dash}#(,1)P({nums}(Y({nums}(M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|" &
"{durTime}#(,1))|M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|{durTime})")
/*with {
variant "JSON:duration";
}*/;
type charstring DateTime (pattern
"{yearExpansion}{year}{dash}{month}{dash}{dayOfMonth}T({hour}{cln}{minute}{cln}{second}" &
"{sFraction}|{endOfDayExt}){ZorTimeZoneExt}" )
/*with {
variant "JSON:dateTime";
}*/;
type charstring Time (pattern "({hour}{cln}{minute}{cln}{second}{sFraction}|{endOfDayExt}){ZorTimeZoneExt}" )
/*with {
variant "JSON:time";
}*/;
type charstring Date (pattern "{yearExpansion}{year}{dash}{month}{dash}{dayOfMonth}{ZorTimeZoneExt}" )
/*with {
variant "JSON:date";
}*/;
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
// Array type
/*type record of JSON.Values Array with {
variant "JSON:array"
}*/
// Subsidiary array types
type record of JSON.String StrArray /*with {
variant "JSON:array"
}*/
type record of JSON.Number NumArray /*with {
variant "JSON:array"
}*/
type record of JSON.Integer IntArray /*with {
variant "JSON:array"
}
type record of JSON.Bool BoolArray with {
variant "JSON:array"
}
type record of JSON.Object ObjArray with {
variant "JSON:array"
}*/
// Object member
/*type record ObjectMember {
JSON.String name,
JSON.Values value_
} with {
variant "JSON:objectMember"
}*/
// Generic JSON object type
/*type record Object {
record length (1..infinity) of JSON.ObjectMember memberList optional
} with {
variant "JSON:object"
}
type union Values {
JSON.String str,
JSON.Number num,
JSON.Integer int,
JSON.Object object,
JSON.Array array,
JSON.StrArray strArray,
JSON.NumArray numArray,
JSON.IntArray intArray,
JSON.BoolArray boolArray,
JSON.ObjArray objArray,
JSON.Bool bool,
JSON.Null null_
} with {
variant "asValue"
}*/
//JSON literals
//When only the true and false literals are allowed
type boolean Bool /*with { variant "JSON:literal" }*/
//When only the null literal is allowed
type enumerated Null { null_ }; /*with { variant "JSON:literal" }*/