teptris 0.3.22.0-arm-linux → 0.3.24.0-arm-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/teptris_ext/engine/README.md +1 -1
- data/ext/teptris_ext/engine/src/include/teptris/schema.h +7 -0
- data/ext/teptris_ext/engine/src/include/teptris/version.h +2 -2
- data/ext/teptris_ext/engine/src/teptris/schema/metaschemas.c +243 -0
- data/ext/teptris_ext/engine/src/teptris/schema/metaschemas.h +15 -0
- data/ext/teptris_ext/engine/src/teptris/schema/refs.c +243 -0
- data/ext/teptris_ext/engine/src/teptris/schema/refs.h +24 -0
- data/ext/teptris_ext/engine/src/teptris/schema/regex.c +143 -7
- data/ext/teptris_ext/engine/src/teptris/schema/schema.c +779 -40
- data/ext/teptris_ext/engine/src/teptris/schema/schema_internal.h +76 -6
- data/ext/teptris_ext/engine/src/teptris/schema/unicode_props.c +5508 -0
- data/ext/teptris_ext/engine/src/teptris/schema/unicode_props.h +20 -0
- data/ext/teptris_ext/engine/src/teptris/schema/validate.c +199 -15
- data/lib/teptris/3.3/teptris_ext.so +0 -0
- data/lib/teptris/3.4/teptris_ext.so +0 -0
- data/lib/teptris/4.0/teptris_ext.so +0 -0
- data/lib/teptris/version.rb +1 -1
- metadata +8 -2
|
@@ -19,9 +19,10 @@ enum {
|
|
|
19
19
|
ST_NUMBER = 1 << 2, /* float or integer */
|
|
20
20
|
ST_BOOLEAN = 1 << 3,
|
|
21
21
|
ST_OBJECT = 1 << 4,
|
|
22
|
-
ST_ARRAY = 1 << 5
|
|
22
|
+
ST_ARRAY = 1 << 5,
|
|
23
|
+
ST_NULL = 1 << 6 /* the JSON null type (policy 1: no TOML value) */
|
|
23
24
|
};
|
|
24
|
-
#define ST_ANY
|
|
25
|
+
#define ST_ANY 0x7Fu
|
|
25
26
|
|
|
26
27
|
enum {
|
|
27
28
|
FMT_NONE = 0,
|
|
@@ -109,11 +110,25 @@ struct sch_node {
|
|
|
109
110
|
sch_node *uneval_props; /* unevaluatedProperties: frame-local */
|
|
110
111
|
sch_node *uneval_items; /* unevaluatedItems: frame-local */
|
|
111
112
|
sch_node *content_schema; /* contentSchema: asserts decoded content */
|
|
113
|
+
/* the dynamic anchors inside this node's own subtree (self
|
|
114
|
+
* included, document order): pushed as one scope frame whenever
|
|
115
|
+
* this node is applied — the dynamic scope grows per entered
|
|
116
|
+
* subschema, not per traversed anchor */
|
|
117
|
+
struct sch_scope_entry {
|
|
118
|
+
const char *name;
|
|
119
|
+
struct sch_node *node;
|
|
120
|
+
const jv *res; /* the anchor's own resource (nearest $id) */
|
|
121
|
+
} *self_scope;
|
|
122
|
+
size_t n_self_scope;
|
|
123
|
+
const jv *res_id; /* the resource root this node sits in */
|
|
124
|
+
bool dynamic_recursive; /* the ref site was a $recursiveRef */
|
|
112
125
|
const char *dynamic_anchor; /* $dynamicAnchor name carried here */
|
|
113
|
-
const char *recursive_anchor; /* "
|
|
126
|
+
const char *recursive_anchor; /* "" when $recursiveAnchor is true */
|
|
114
127
|
const char *dynamic_ref; /* "#name" fragment for
|
|
115
128
|
* $dynamicRef / $recursiveRef */
|
|
116
129
|
sch_node *dynamic_ref_target; /* compile-resolved static fallback */
|
|
130
|
+
bool ref_only; /* draft-07-and-older: this $ref ignores siblings */
|
|
131
|
+
bool enum_empty; /* "enum": [] matches nothing */
|
|
117
132
|
sch_node *contains;
|
|
118
133
|
long min_contains, max_contains;
|
|
119
134
|
bool has_contains, has_min_contains, has_max_contains;
|
|
@@ -158,6 +173,8 @@ struct teptris_schema {
|
|
|
158
173
|
char err[256];
|
|
159
174
|
};
|
|
160
175
|
|
|
176
|
+
typedef struct teptris_resource teptris_resource;
|
|
177
|
+
|
|
161
178
|
typedef struct {
|
|
162
179
|
teptris_arena *a;
|
|
163
180
|
jv *root;
|
|
@@ -168,26 +185,76 @@ typedef struct {
|
|
|
168
185
|
bool in_progress;
|
|
169
186
|
} *memo;
|
|
170
187
|
size_t n_memo, cap_memo;
|
|
188
|
+
/* pointer-keyed hash over the memo (compile is O(n), not O(n^2)):
|
|
189
|
+
* open addressing, slot = entry index + 1, 0 = empty */
|
|
190
|
+
uint32_t *memo_hash;
|
|
191
|
+
size_t memo_hash_cap; /* power of two, 0 = absent */
|
|
192
|
+
/* the same treatment for the per-node base table */
|
|
193
|
+
uint32_t *node_base_hash;
|
|
194
|
+
size_t node_base_hash_cap;
|
|
171
195
|
/* dependency-list capacities (grow-in-place across keywords) */
|
|
172
196
|
size_t cap_dep_req, cap_dep_schemas;
|
|
173
|
-
/* anchors: "$anchor": name -> subtree
|
|
197
|
+
/* anchors: "$anchor": name -> subtree (doc-wide; the $anchor
|
|
198
|
+
* space of every loaded resource joins it) */
|
|
174
199
|
struct {
|
|
175
200
|
const char *name;
|
|
176
201
|
jv *target;
|
|
177
202
|
} *anchors;
|
|
178
203
|
size_t n_anchors, cap_anchors;
|
|
179
|
-
/* $dynamicAnchor
|
|
180
|
-
* fallback for $dynamicRef / $recursiveRef) */
|
|
204
|
+
/* $dynamicAnchor targets (the static fallback for $dynamicRef) */
|
|
181
205
|
struct {
|
|
182
206
|
const char *name;
|
|
183
207
|
jv *target;
|
|
184
208
|
} *dyn_anchors;
|
|
185
209
|
size_t n_dyn_anchors, cap_dyn_anchors;
|
|
186
210
|
jv *rec_anchor_target;
|
|
211
|
+
/* the resource model: every base URI this compile has materialized */
|
|
212
|
+
teptris_resource *resources;
|
|
213
|
+
size_t n_resources, cap_resources;
|
|
214
|
+
/* the resource the walk is currently inside */
|
|
215
|
+
jv *cur_root; /* its root jv ("#" resolves here) */
|
|
216
|
+
const char *cur_abs; /* its base URI (NULL in local-only mode) */
|
|
217
|
+
const char *cur_dir; /* its fs dir (relative refs join against it) */
|
|
218
|
+
bool ref_exclusive; /* draft-07-and-older: $ref ignores siblings */
|
|
219
|
+
char base_dir[1024]; /* fs dir of the main schema ("" = none) */
|
|
220
|
+
/* the base every node was pre-passed with: compile looks each
|
|
221
|
+
* node's base up here (pointers reach subtrees whose $id chain
|
|
222
|
+
* the document walk would otherwise miss) */
|
|
223
|
+
/* scratch accumulator for attach_self_scope */
|
|
224
|
+
struct sch_scope_entry *entry_acc;
|
|
225
|
+
size_t n_entry_acc, cap_entry_acc;
|
|
226
|
+
/* which standard vocabularies the dialect keeps (8.1.2: a custom
|
|
227
|
+
* metaschema's $vocabulary decides; absent = all of them) */
|
|
228
|
+
unsigned vocab_mask;
|
|
229
|
+
/* standard vocabulary gates (the core vocabulary is mandatory and
|
|
230
|
+
* never gated) */
|
|
231
|
+
#define TEPTRIS_VOC_APPLICATOR 1u
|
|
232
|
+
#define TEPTRIS_VOC_UNEVALUATED 2u
|
|
233
|
+
#define TEPTRIS_VOC_VALIDATION 4u
|
|
234
|
+
#define TEPTRIS_VOC_FORMAT 8u
|
|
235
|
+
#define TEPTRIS_VOC_CONTENT 16u
|
|
236
|
+
#define TEPTRIS_VOC_ALL 31u
|
|
237
|
+
|
|
238
|
+
struct node_base {
|
|
239
|
+
const jv *node;
|
|
240
|
+
const char *abs;
|
|
241
|
+
const char *dir;
|
|
242
|
+
jv *root;
|
|
243
|
+
bool recursive;
|
|
244
|
+
} *node_bases;
|
|
245
|
+
size_t n_node_bases, cap_node_bases;
|
|
187
246
|
char *err;
|
|
188
247
|
size_t err_cap;
|
|
189
248
|
} sctx;
|
|
190
249
|
|
|
250
|
+
/* a materialized resource: a base URI naming a jv subtree */
|
|
251
|
+
struct teptris_resource {
|
|
252
|
+
const char *abs; /* base URI (file://... or empty for local-only) */
|
|
253
|
+
jv *root; /* the resource's root jv ("#" resolves here) */
|
|
254
|
+
sch_node *node; /* compiled root (memo-resolved) */
|
|
255
|
+
bool recursive_anchor; /* $recursiveAnchor: true on the root */
|
|
256
|
+
};
|
|
257
|
+
|
|
191
258
|
/* the tagged value the validator walks: converted from a document's
|
|
192
259
|
* DOM once per validate call, or synthesized (schema-side enum/const
|
|
193
260
|
* values, propertyNames strings) */
|
|
@@ -231,6 +298,9 @@ sch_node *sch_resolve_pointer(sctx *c, const char *pointer);
|
|
|
231
298
|
* with |mant| < 10^18; false for non-finite d */
|
|
232
299
|
bool sch_decimal_of_double(double d, int64_t *mant, int *exp);
|
|
233
300
|
|
|
301
|
+
/* refs.c: the resource loader used by $ref resolution */
|
|
302
|
+
jv *sch_load_resource(sctx *c, const char *abs_uri);
|
|
303
|
+
|
|
234
304
|
/* formats.c */
|
|
235
305
|
/* the string-side format battery (the taplo parity set); datetimes
|
|
236
306
|
* reach it through their canonical text like any other string */
|