leptris 1.9.353.0 → 1.9.355.0
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/CHANGELOG.md +20 -0
- data/Rakefile +1 -1
- data/lib/leptris/vendor/aarch64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/aarch64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/ppc64le-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/s390x-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/x86_64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/version.rb +1 -1
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/AGENT.md +24 -0
- data/vendor-src/libleptris/CHANGELOG.md +73 -0
- data/vendor-src/libleptris/CLAUDE.md +15 -1
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/common/string_view.c +8 -5
- data/vendor-src/libleptris/src/leptris/dom/element_index.c +6 -2
- data/vendor-src/libleptris/src/leptris/flat/direct_parse.c +29 -4
- data/vendor-src/libleptris/src/leptris/leptris.c +3 -3
- data/vendor-src/libleptris/src/leptris/rng/parse.c +63 -4
- data/vendor-src/libleptris/src/leptris/rng/validate.c +5 -5
- data/vendor-src/libleptris/src/leptris/sch/schematron.c +2 -1
- data/vendor-src/libleptris/src/leptris/xpath/evaluator_path.c +2 -2
- data/vendor-src/libleptris/src/leptris/xpath/vm.c +1 -1
- data/vendor-src/libleptris/src/leptris/xpath/xpath_public.c +3 -2
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +85 -0
- data/vendor-src/libleptris/src/leptris/xslt/xslt_exec.c +4 -2
- data/vendor-src/libleptris/src/leptris/xslt/xslt_functions.c +5 -2
- data/vendor-src/libleptris/src/leptris/xslt/xslt_parse.c +4 -2
- data/vendor-src/libleptris/test/parser/test_parser.cpp +50 -0
- data/vendor-src/libleptris/test/rng/include-cases/comb3-choice-outer.rng +8 -0
- data/vendor-src/libleptris/test/rng/include-cases/comb3-inner.rng +5 -0
- data/vendor-src/libleptris/test/rng/include-cases/comb3-mid.rng +11 -0
- data/vendor-src/libleptris/test/rng/include-cases/comb3-outer.rng +11 -0
- data/vendor-src/libleptris/test/rng/test_rng.cpp +33 -0
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +10 -8
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6dcd6abe0f0ac597717958e8335227a43ecb1fec7a1a0ed1da3f432337710b4b
|
|
4
|
+
data.tar.gz: 3d031d22645cd0750b7ff5523e572950d6ea0229c624a71d9d4b3a21101f7ea9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ea00e225543ddbdf9141143fce55e1e9500aff2bd1c8da55a7498ff7d521583cd416cb7dc9b90e50dbd325da54d06c4b3992566a1d467ee5aee4473326bcf64
|
|
7
|
+
data.tar.gz: 41f7080ddb38716d59826e46169845d3181ec16e2d5d421f012adf8213fcf5e5d75b90a750f3c73d48a6f27c3cb8dd14620dae2fe56fd011aaa90ee5c239553d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## [1.9.355.0] - 2026-10-14
|
|
2
|
+
|
|
3
|
+
### Fixed — engine sync (libleptris 1.9.355)
|
|
4
|
+
|
|
5
|
+
- **RelaxNG combine across multi-hop include chains
|
|
6
|
+
(leptris/leptris#1703, libleptris PR #1705)**: nested
|
|
7
|
+
`<define combine=...>` inside `<include>` now MERGES per spec
|
|
8
|
+
§4.2 instead of replacing — multi-hop chains keep every
|
|
9
|
+
interleave branch and choice union (the relaton-ieee `<ics>`
|
|
10
|
+
cardinality and the BIPM locality enumeration validate to Jing
|
|
11
|
+
parity; unblocks the last 2 of relaton's 40 Jing-swap flavors).
|
|
12
|
+
- **Strict-path tag-mismatch diagnostics (leptris/leptris#1700,
|
|
13
|
+
libleptris PR #1702)**: mismatched closing tags raise
|
|
14
|
+
"Opening and ending tag mismatch: expected </x>, got </y>" with
|
|
15
|
+
line:column, instead of "malformed input" at a byte offset.
|
|
16
|
+
- **XSD conformance slice 2 (libleptris PR #1698)**: src-include.1
|
|
17
|
+
(included targetNamespace must equal the includer's or be absent)
|
|
18
|
+
and the xsi-namespace reservation; engine conformance floor
|
|
19
|
+
803/1056 against the libxml2 oracle.
|
|
20
|
+
|
|
1
21
|
## [1.9.353.0] - 2026-10-14
|
|
2
22
|
|
|
3
23
|
### Added — engine sync (libleptris 1.9.353)
|
data/Rakefile
CHANGED
|
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
8
8
|
# Pin for `rake compile` and the platform-gem builds. Keep in lockstep
|
|
9
9
|
# with .github/workflows/build.yml (which calls `rake compile`) and the
|
|
10
10
|
# CHANGELOG when libleptris releases.
|
|
11
|
-
LIBLEPTRIS_VERSION = "1.9.
|
|
11
|
+
LIBLEPTRIS_VERSION = "1.9.355"
|
|
12
12
|
# Vendored alongside libleptris for fn:normalize-unicode (TODO
|
|
13
13
|
# .restructure/20): built per platform with a RELOCATABLE @rpath
|
|
14
14
|
# install name, loaded by ffi.rb before libleptris so the
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/leptris/version.rb
CHANGED
data/vendor-src/README.md
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Agent working agreement (leptris engine + bindings)
|
|
2
|
+
|
|
3
|
+
## Binding version sync (law)
|
|
4
|
+
|
|
5
|
+
`leptris-ruby`, `leptris-py`, and `leptris-ts` pin the engine by
|
|
6
|
+
version. The pins move in the same wave as the engine release they
|
|
7
|
+
need: engine fix → release X.Y.Z → every binding pin bumps to X.Y.Z
|
|
8
|
+
in the same session. A binding pin never lags main by more than one
|
|
9
|
+
engine release.
|
|
10
|
+
|
|
11
|
+
## Session ownership
|
|
12
|
+
|
|
13
|
+
The engine session OWNS the binding repos' engineering work
|
|
14
|
+
(leptris-ruby, leptris-py, leptris-ts): branches, CI, PRs, merges.
|
|
15
|
+
Publication (rubygems/PyPI/npm) stays owner-gated — the owner runs
|
|
16
|
+
releases or hands over the exact version.
|
|
17
|
+
|
|
18
|
+
## Standing rules (see CLAUDE.md for the full contract)
|
|
19
|
+
|
|
20
|
+
- Every fix: branch → red-first specs → full gates → PR → CI green →
|
|
21
|
+
rebase-merge → release ride.
|
|
22
|
+
- Never commit to main, never push tags, never add AI attribution.
|
|
23
|
+
- Binding publications (gem/PyPI/npm) are the owner's decision and
|
|
24
|
+
the owner's command.
|
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.355] - 2026-10-14
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **RelaxNG: combine=interleave/choice merge across multi-hop
|
|
8
|
+
include chains (leptris#1703, PR #1705).** A nested
|
|
9
|
+
`<define combine=...>` inside `<include>` replaced the included
|
|
10
|
+
definition unconditionally and dropped its combine — every hop of
|
|
11
|
+
a multi-hop chain (relaton-ieee: compile -> flavor -> standoc ->
|
|
12
|
+
biblio -> basicdoc, basicdoc reachable through two paths) lost the
|
|
13
|
+
accumulated body: interleaved cardinalities collapsed to the
|
|
14
|
+
outermost branch (the 2nd/3rd `<ics>` rejections) and choice
|
|
15
|
+
unions collapsed to one alternative (the BIPM locality type
|
|
16
|
+
enumeration). Jing accepts both documents; leptris now does too.
|
|
17
|
+
The merge keeps the combinator wrapper as the define body and
|
|
18
|
+
flattens same-kind combinators at each merge (both associative),
|
|
19
|
+
so the validator's single-pass interleave walk judges one flat
|
|
20
|
+
scope. The absorb helper frees the absorbed wrapper fully
|
|
21
|
+
detached — the first cut's use-after-scope was caught by the
|
|
22
|
+
Linux ASAN lane.
|
|
23
|
+
|
|
24
|
+
- **Strict parse: tag-mismatch failures name the tags
|
|
25
|
+
(leptris#1700, PR #1702).** A stray or mismatched closing tag on
|
|
26
|
+
the strict path failed with "XML parse error at byte N: malformed
|
|
27
|
+
input" — reading like encoding corruption. The failure now
|
|
28
|
+
carries "Opening and ending tag mismatch: expected </x>, got
|
|
29
|
+
</y>" (the Nokogiri/Jing convention) with the byte offset and
|
|
30
|
+
line:column retained; every other strict failure stays generic,
|
|
31
|
+
and depth-0 stray closes match the oracle's two-message behavior.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **XSD conformance slice 2: src-include.1 + xsi reservation
|
|
36
|
+
(PR #1698).** The included/redefined schema's targetNamespace
|
|
37
|
+
must equal the includer's — or be absent (the chameleon form
|
|
38
|
+
adopts the includer's) — and a schema whose own targetNamespace
|
|
39
|
+
is the xsi namespace fails at load. Conformance floor
|
|
40
|
+
795 -> 803/1056 (schema-error class 34/206); the compile floor is
|
|
41
|
+
now the cross-platform minimum after the Linux ASAN run showed
|
|
42
|
+
case-sensitive schemaLocation resolution rejecting 4 fixtures
|
|
43
|
+
macOS silently accepted (finding noted in #1691).
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- (describe changes here)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## [1.9.354] - 2026-10-14
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- **wasm32/ILP32 portability: 64-bit hash accumulators + enum
|
|
55
|
+
discipline (PR #1697).** The emscripten build (wasm32: size_t and
|
|
56
|
+
uintptr_t are 32-bit) exposed a class the LP64 host lanes never
|
|
57
|
+
see — 17 warnings, all real. The 64-bit FNV-1a basis/prime
|
|
58
|
+
constants sat in size_t, so on 32-bit targets the hash silently
|
|
59
|
+
stopped being FNV-1a (string_view, element_index, xslt_parse);
|
|
60
|
+
accumulators are now uint64_t with one fold at the return.
|
|
61
|
+
acc_ptr_hash shifted a uintptr_t by 33 — UB on 32-bit pointers;
|
|
62
|
+
promoted to 64-bit with the full avalanche. The leptris_set_error
|
|
63
|
+
call sites passed LeptrisStatus constants into the internal
|
|
64
|
+
error-code channel (TODO 98's boundary) — the implicit enum
|
|
65
|
+
casts are explicit at the five sites. LeptrisNodeKind vs
|
|
66
|
+
LeptrisNodeType compares (and the result-type compare) cast
|
|
67
|
+
through int where the same-valued members meet. rng diag calls
|
|
68
|
+
passed arguments the format string never used. emcc: 17 warnings
|
|
69
|
+
-> 0; wasm test gate 5/5; host suite green.
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
|
|
73
|
+
- (describe changes here)
|
|
74
|
+
|
|
75
|
+
|
|
3
76
|
## [1.9.353] - 2026-10-14
|
|
4
77
|
|
|
5
78
|
### Added
|
|
@@ -66,7 +66,7 @@ Core (src/leptris/) → DOM, parser, XPath engine, SAX, DTD, encoding, memor
|
|
|
66
66
|
- `encoding/` — UTF-16 always compiled; `encoding.c` (iconv) only when `LEPTRIS_ENABLE_ICONV` is on.
|
|
67
67
|
- `unicode/unicode.c` — only compiled when `LEPTRIS_ENABLE_UTF8PROC` is on.
|
|
68
68
|
- `memory/` — `pool.c` (O(1) arena allocator used pervasively) and `compact_allocator.c`.
|
|
69
|
-
- `xinclude/` — built and shipping. `parse="text"` with `xi:fallback
|
|
69
|
+
- `xinclude/` — built and shipping. `parse="text"` and `parse="xml"` with `xi:fallback`, the element()/xpointer() schemes, and depth-bounded loop protection work end-to-end (28-spec suite). Remaining: xml:base chain resolution and the pluggable resolver/catalog policy (TODO.assemble phases 03/04).
|
|
70
70
|
|
|
71
71
|
### Public API surface (`src/include/leptris/`)
|
|
72
72
|
The public contract. Don't break ABI without a major bump. Headers split by subsystem: `dom/{document,element,serialize}.h`, `xpath/xpath.h`, `sax/sax.h`, `html.h`, plus `types.h`, `error.h`, `dtd.h` at the top level. All handles are opaque typedefs (`LeptrisDocument`, `LeptrisElement`, `LeptrisNodeRef`, …); callers never see struct definitions.
|
|
@@ -101,6 +101,20 @@ The public contract. Don't break ABI without a major bump. Headers split by subs
|
|
|
101
101
|
- `VALIDATION.md` — exact commands to run individual test suites and benchmarks, plus expected results.
|
|
102
102
|
- `benchmarks/README.{md,adoc}` — benchmark methodology and reference comparisons.
|
|
103
103
|
|
|
104
|
+
## Binding version sync — ruby / python / ts always ride together
|
|
105
|
+
|
|
106
|
+
The binding repos (`leptris-ruby`, `leptris-py`, `leptris-ts`) pin the
|
|
107
|
+
engine by version (gem `1.9.x.y.0`, npm `ENGINE_VERSION`, py wheel pin).
|
|
108
|
+
**The pins move in the same wave as the engine release they need** — a
|
|
109
|
+
binding pin never lags main by more than one engine release. When the
|
|
110
|
+
engine cuts X.Y.Z, every binding that needs the content bumps its pin to
|
|
111
|
+
X.Y.Z in the same session (branch → CI → PR → merge; gem/npm publication
|
|
112
|
+
stays owner-gated).
|
|
113
|
+
|
|
114
|
+
Agent sessions for leptris-ruby and leptris-py are consolidated into the
|
|
115
|
+
engine session — the same session drives engine fix → release → binding
|
|
116
|
+
pin rides, so a binding never ships a stale engine.
|
|
117
|
+
|
|
104
118
|
## Releasing — ALWAYS use the automated workflow
|
|
105
119
|
|
|
106
120
|
**NEVER create git tags or GitHub releases manually.** No `git tag`, no
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#include "../memory/pool.h"
|
|
2
2
|
#include "string_view.h"
|
|
3
|
+
#include <stdint.h>
|
|
3
4
|
#include <string.h>
|
|
4
5
|
#include <stdlib.h>
|
|
5
6
|
#include <stdio.h>
|
|
@@ -133,15 +134,17 @@ int leptris_sv_equals_cstr(const LeptrisStringView* sv, const char* str) {
|
|
|
133
134
|
size_t leptris_sv_hash(const LeptrisStringView* sv) {
|
|
134
135
|
if (!sv || !sv->data) return 0;
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
/* FNV-1a 64: the accumulator stays uint64_t — size_t is
|
|
138
|
+
* 32-bit on wasm32/ILP32, and truncating the basis/prime
|
|
139
|
+
* silently changes the algorithm. Fold once at the return. */
|
|
140
|
+
uint64_t hash = 14695981039346656037ULL;
|
|
141
|
+
const uint64_t FNV_prime = 1099511628211ULL;
|
|
140
142
|
for (size_t i = 0; i < sv->length; i++) {
|
|
141
143
|
hash ^= (unsigned char)sv->data[i];
|
|
142
144
|
hash *= FNV_prime;
|
|
143
145
|
}
|
|
144
|
-
|
|
146
|
+
hash ^= hash >> 32;
|
|
147
|
+
return (size_t)hash;
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
/* Convert to NULL-terminated C string (allocates!) */
|
|
@@ -43,11 +43,15 @@ typedef struct {
|
|
|
43
43
|
|
|
44
44
|
static size_t index_key_hash(const char* s1, size_t l1,
|
|
45
45
|
const char* s2, size_t l2) {
|
|
46
|
-
size_t
|
|
46
|
+
/* uint64 accumulator: size_t is 32-bit on wasm32/ILP32 and the
|
|
47
|
+
* 64-bit constants would truncate (the multiply lane collapses).
|
|
48
|
+
* Fold once at the return. */
|
|
49
|
+
uint64_t h = 1469598103934665603ull;
|
|
47
50
|
for (size_t i = 0; i < l1; i++) { h ^= (unsigned char)s1[i]; h *= 1099511628211ull; }
|
|
48
51
|
for (size_t i = 0; i < l2; i++) { h ^= (unsigned char)s2[i]; h *= 1099511628211ull; }
|
|
49
52
|
h ^= l1; h *= 1099511628211ull;
|
|
50
|
-
|
|
53
|
+
h ^= h >> 32;
|
|
54
|
+
return (size_t)h;
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
static void index_key_table_free(IndexKeyTable* t) {
|
|
@@ -115,6 +115,12 @@ typedef struct {
|
|
|
115
115
|
* documents >= 2 GiB (offsets don't fit; line reads return
|
|
116
116
|
* unknown, matching the pre-#223 behavior). */
|
|
117
117
|
int line_offsets_ok;
|
|
118
|
+
/* leptris#1700: a strict-path failure may carry a specific
|
|
119
|
+
* diagnostic (tag mismatch) instead of the generic message.
|
|
120
|
+
* Storage lives IN the parser struct: the fail goto jumps out
|
|
121
|
+
* of the setting block's scope, so a stack pointer there would
|
|
122
|
+
* be use-after-scope (the Linux ASAN lane caught exactly that). */
|
|
123
|
+
char strict_fail_msg[192];
|
|
118
124
|
int had_declaration;
|
|
119
125
|
/* Bulk-allocated attribute block. Pre-allocated from pool so the
|
|
120
126
|
* common case is a bump-pointer off the block — no per-attr
|
|
@@ -1635,6 +1641,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
1635
1641
|
p.drop_ws_text = drop_ws_text;
|
|
1636
1642
|
p.keep_entity_refs = keep_entity_refs;
|
|
1637
1643
|
p.recover = recover;
|
|
1644
|
+
p.strict_fail_msg[0] = '\0';
|
|
1638
1645
|
p.dtd = NULL;
|
|
1639
1646
|
/* Only ever set to 1 in the loop; without the zero here the
|
|
1640
1647
|
* field rides the stack (MSVC C4701) and doc->has_namespaces
|
|
@@ -2077,8 +2084,19 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
2077
2084
|
* A close tag naming an open ANCESTOR closes the
|
|
2078
2085
|
* intermediates implicitly (libxml2 semantics); a
|
|
2079
2086
|
* close matching nothing open is dropped. Either way
|
|
2080
|
-
* the recovery records a diagnostic.
|
|
2081
|
-
|
|
2087
|
+
* the recovery records a diagnostic.
|
|
2088
|
+
* leptris#1700: the STRICT path fails with the same
|
|
2089
|
+
* mismatch named — tag names + line:column ride the
|
|
2090
|
+
* error message, not a bare byte offset. */
|
|
2091
|
+
if (!p.recover) {
|
|
2092
|
+
snprintf(p.strict_fail_msg,
|
|
2093
|
+
sizeof(p.strict_fail_msg),
|
|
2094
|
+
"Opening and ending tag mismatch: expected "
|
|
2095
|
+
"</%.*s>, got </%.*s>",
|
|
2096
|
+
(int)open_len, open_name,
|
|
2097
|
+
(int)close_local_len, close_local);
|
|
2098
|
+
goto fail;
|
|
2099
|
+
}
|
|
2082
2100
|
{
|
|
2083
2101
|
int anc = -1;
|
|
2084
2102
|
for (int d = (int)p.depth - 1; d >= 0; d--) {
|
|
@@ -2447,9 +2465,16 @@ fail:
|
|
|
2447
2465
|
* thread-local slot so bindings can read leptris_last_error()
|
|
2448
2466
|
* when leptris_parse_string returns NULL. */
|
|
2449
2467
|
{
|
|
2450
|
-
char msg[
|
|
2468
|
+
char msg[256];
|
|
2451
2469
|
long off = (long)(p.pos ? p.pos - p.buf : 0);
|
|
2452
|
-
|
|
2470
|
+
if (p.strict_fail_msg[0]) {
|
|
2471
|
+
snprintf(msg, sizeof(msg),
|
|
2472
|
+
"XML parse error at byte %ld: %s",
|
|
2473
|
+
off, p.strict_fail_msg);
|
|
2474
|
+
} else {
|
|
2475
|
+
snprintf(msg, sizeof(msg),
|
|
2476
|
+
"XML parse error at byte %ld: malformed input", off);
|
|
2477
|
+
}
|
|
2453
2478
|
leptris_set_error(LEPTRIS_ERROR_PARSE_FAILED, msg);
|
|
2454
2479
|
/* 1-based line/column of the failure (issue #510). */
|
|
2455
2480
|
int line = 1, column = 1;
|
|
@@ -275,7 +275,7 @@ LEPTRIS_API LeptrisStatus leptris_document_set_root_ex(
|
|
|
275
275
|
LeptrisElement* out_installed) {
|
|
276
276
|
if (out_installed) *out_installed = NULL;
|
|
277
277
|
if (!doc || !root) {
|
|
278
|
-
leptris_set_error(LEPTRIS_ERROR_NULL_ARG,
|
|
278
|
+
leptris_set_error((leptris_error_code)LEPTRIS_ERROR_NULL_ARG,
|
|
279
279
|
"set_root: NULL document or element");
|
|
280
280
|
return LEPTRIS_ERROR_NULL_ARG;
|
|
281
281
|
}
|
|
@@ -283,7 +283,7 @@ LEPTRIS_API LeptrisStatus leptris_document_set_root_ex(
|
|
|
283
283
|
/* Already attached under a parent? (parent_off == 0 encodes NULL;
|
|
284
284
|
* leptris_elem_parent is the static inline accessor from dom/element.h) */
|
|
285
285
|
if (leptris_elem_parent(root)) {
|
|
286
|
-
leptris_set_error(LEPTRIS_ERROR_INVALID_ARG,
|
|
286
|
+
leptris_set_error((leptris_error_code)LEPTRIS_ERROR_INVALID_ARG,
|
|
287
287
|
"set_root: element is attached to a parent");
|
|
288
288
|
return LEPTRIS_ERROR_INVALID_ARG;
|
|
289
289
|
}
|
|
@@ -301,7 +301,7 @@ LEPTRIS_API LeptrisStatus leptris_document_set_root_ex(
|
|
|
301
301
|
if (leptris_element_get_document(root) != doc) {
|
|
302
302
|
LeptrisElement copy = leptris_element_copy(root, doc);
|
|
303
303
|
if (!copy) {
|
|
304
|
-
leptris_set_error(LEPTRIS_ERROR_MEMORY,
|
|
304
|
+
leptris_set_error((leptris_error_code)LEPTRIS_ERROR_MEMORY,
|
|
305
305
|
"set_root: adoption copy failed");
|
|
306
306
|
return LEPTRIS_ERROR_MEMORY;
|
|
307
307
|
}
|
|
@@ -255,6 +255,32 @@ static void merge_start(RngGrammar* g, RngPattern* body) {
|
|
|
255
255
|
g->start = ch;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
/* INTERLEAVE and CHOICE are associative: a merge wrapper whose
|
|
259
|
+
* child list already carries a same-kind combinator flattens into
|
|
260
|
+
* the parent scope. The validator's single-pass interleave walk has
|
|
261
|
+
* no backtracking across nested scopes, so a nested combinator from
|
|
262
|
+
* a multi-hop chain would reject documents the flat form accepts
|
|
263
|
+
* (leptris#1703). */
|
|
264
|
+
static void rng_flatten_combinator(RngPattern* wrap) {
|
|
265
|
+
RngPattern** link = &wrap->first_child;
|
|
266
|
+
while (*link) {
|
|
267
|
+
RngPattern* c = *link;
|
|
268
|
+
if (c->kind == wrap->kind && c->first_child) {
|
|
269
|
+
RngPattern* tail = c->first_child;
|
|
270
|
+
while (tail->next) tail = tail->next;
|
|
271
|
+
tail->next = c->next;
|
|
272
|
+
*link = c->first_child;
|
|
273
|
+
/* detach fully — rng_pattern_free recurses into next,
|
|
274
|
+
* which here is the REST of the sibling chain */
|
|
275
|
+
c->first_child = NULL;
|
|
276
|
+
c->next = NULL;
|
|
277
|
+
rng_pattern_free(c);
|
|
278
|
+
continue; /* re-check the spliced head */
|
|
279
|
+
}
|
|
280
|
+
link = &c->next;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
258
284
|
/* Add/merge a <define>. Takes ownership of name, combine and the
|
|
259
285
|
* GROUP wrapper body. Returns 0 with err set on an uncombined
|
|
260
286
|
* redefinition. */
|
|
@@ -307,6 +333,7 @@ static int add_define(RngGrammar* g, char* name, char* combine,
|
|
|
307
333
|
pat_append(wrap, body->first_child);
|
|
308
334
|
body->first_child = NULL;
|
|
309
335
|
rng_pattern_free(body);
|
|
336
|
+
rng_flatten_combinator(wrap);
|
|
310
337
|
d->body = wrap;
|
|
311
338
|
return 1;
|
|
312
339
|
}
|
|
@@ -436,10 +463,42 @@ static int handle_include(RngGrammar* g, LeptrisElement inc,
|
|
|
436
463
|
rng_grammar_free(ig);
|
|
437
464
|
return 0;
|
|
438
465
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
466
|
+
/* leptris#1703: @combine on the nested define merges with
|
|
467
|
+
* the included definition (spec §4.2) — replace only when
|
|
468
|
+
* NEITHER side carries a combine. The first cut replaced
|
|
469
|
+
* unconditionally, so every multi-hop include chain lost
|
|
470
|
+
* the accumulated body at each hop: interleaved
|
|
471
|
+
* cardinalities collapsed to the outermost branch and
|
|
472
|
+
* choice unions collapsed to one alternative. The merged
|
|
473
|
+
* define KEEPS the combine value so further hops keep
|
|
474
|
+
* merging. */
|
|
475
|
+
char* ncombine = dup_attr(ce, "combine");
|
|
476
|
+
if (ncombine && ncombine[0]) {
|
|
477
|
+
/* The WRAPPER stays as the define's body — same shape
|
|
478
|
+
* add_define produces — the combinator node is what
|
|
479
|
+
* the validator walks; unwrapping leaves bare
|
|
480
|
+
* siblings with no interleave/choice between them. */
|
|
481
|
+
RngPattern* wrap =
|
|
482
|
+
pat_new(strcmp(ncombine, "interleave") == 0
|
|
483
|
+
? RNG_INTERLEAVE
|
|
484
|
+
: RNG_CHOICE);
|
|
485
|
+
pat_append(wrap, d->body);
|
|
486
|
+
pat_append(wrap, body->first_child);
|
|
487
|
+
body->first_child = NULL;
|
|
488
|
+
rng_pattern_free(body);
|
|
489
|
+
rng_flatten_combinator(wrap);
|
|
490
|
+
free(d->combine);
|
|
491
|
+
d->combine = ncombine;
|
|
492
|
+
d->body = wrap;
|
|
493
|
+
} else {
|
|
494
|
+
free(ncombine);
|
|
495
|
+
free(d->combine);
|
|
496
|
+
d->combine = NULL;
|
|
497
|
+
rng_pattern_free(d->body);
|
|
498
|
+
d->body = body->first_child;
|
|
499
|
+
body->first_child = NULL;
|
|
500
|
+
rng_pattern_free(body);
|
|
501
|
+
}
|
|
443
502
|
} else {
|
|
444
503
|
snprintf(err, errsz, "include %s: unexpected <%s>", href,
|
|
445
504
|
leptris_element_name(ce));
|
|
@@ -512,8 +512,8 @@ static size_t match_seq(RngVal* v, RngPattern* p, LeptrisNodeRef* kids,
|
|
|
512
512
|
case RNG_REF: {
|
|
513
513
|
RngDefine* d = find_define(v->g, p->name);
|
|
514
514
|
if (!d || !d->body) {
|
|
515
|
-
diag(v, LEPTRIS_DIAG_INVALID,
|
|
516
|
-
|
|
515
|
+
diag(v, LEPTRIS_DIAG_INVALID, NULL,
|
|
516
|
+
"reference to undefined pattern '%s'", p->name);
|
|
517
517
|
return (size_t)-1;
|
|
518
518
|
}
|
|
519
519
|
if (v->depth > 200) {
|
|
@@ -1854,9 +1854,9 @@ int rng_validate_document(struct leptris_relaxng* rng, LeptrisDocument doc) {
|
|
|
1854
1854
|
RngDefine* d = find_define(v.g, start->name);
|
|
1855
1855
|
if (!d || !d->body) {
|
|
1856
1856
|
v.quiet = 0;
|
|
1857
|
-
diag(&v, LEPTRIS_DIAG_INVALID,
|
|
1858
|
-
|
|
1859
|
-
start->name
|
|
1857
|
+
diag(&v, LEPTRIS_DIAG_INVALID, root,
|
|
1858
|
+
"reference to undefined pattern '%s'",
|
|
1859
|
+
start->name);
|
|
1860
1860
|
rng->error = leptris_strdup(v.err);
|
|
1861
1861
|
return 0;
|
|
1862
1862
|
}
|
|
@@ -1129,7 +1129,8 @@ LEPTRIS_API LeptrisSchematron leptris_schematron_parse_phase(
|
|
|
1129
1129
|
&err);
|
|
1130
1130
|
leptris_document_free(doc);
|
|
1131
1131
|
if (!s) {
|
|
1132
|
-
leptris_set_error(LEPTRIS_ERROR_PARSE,
|
|
1132
|
+
leptris_set_error((leptris_error_code)LEPTRIS_ERROR_PARSE,
|
|
1133
|
+
err ? err : "bad");
|
|
1133
1134
|
free(err);
|
|
1134
1135
|
if (status) *status = LEPTRIS_ERROR_PARSE;
|
|
1135
1136
|
return NULL;
|
|
@@ -904,8 +904,8 @@ struct leptris_xpath_result* evaluate_step(XPathContext* ctx,
|
|
|
904
904
|
DEBUG_LOG(" Axis '%s' cannot operate on attribute nodes, skipping", axis_name);
|
|
905
905
|
continue; /* Skip non-element nodes for other axes */
|
|
906
906
|
}
|
|
907
|
-
} else if (node_ptr && ((LeptrisNode*)node_ptr)->type ==
|
|
908
|
-
LEPTRIS_NODE_NAMESPACE) {
|
|
907
|
+
} else if (node_ptr && (int)((LeptrisNode*)node_ptr)->type ==
|
|
908
|
+
(int)LEPTRIS_NODE_NAMESPACE) {
|
|
909
909
|
/* Synthetic namespace nodes: parent/ancestor axes
|
|
910
910
|
* resolve through the OWNER element (bug-63); self
|
|
911
911
|
* is the ns node itself. */
|
|
@@ -769,7 +769,7 @@ struct leptris_xpath_result* vm_apply_axis_parent(XPathContext* ctx, XPathVM* vm
|
|
|
769
769
|
for (size_t i = 0; i < input->count; i++) {
|
|
770
770
|
LeptrisNode* in = input->nodes[i];
|
|
771
771
|
LeptrisElement parent;
|
|
772
|
-
if (in && in->type == LEPTRIS_NODE_NAMESPACE) {
|
|
772
|
+
if (in && (int)in->type == (int)LEPTRIS_NODE_NAMESPACE) {
|
|
773
773
|
/* Namespace nodes' parent is the OWNER element (63). */
|
|
774
774
|
parent = ((LeptrisNamespaceNode*)in)->owner;
|
|
775
775
|
} else if (node_is_element(in)) {
|
|
@@ -89,7 +89,7 @@ LEPTRIS_API LeptrisXPathResult leptris_xpath_eval_versioned(
|
|
|
89
89
|
if (version == LEPTRIS_XPATH_10 &&
|
|
90
90
|
x10_has_3x_syntax(expression)) {
|
|
91
91
|
leptris_set_error(
|
|
92
|
-
LEPTRIS_ERROR_INVALID_ARG,
|
|
92
|
+
(leptris_error_code)LEPTRIS_ERROR_INVALID_ARG,
|
|
93
93
|
"XPath 3.x syntax rejected in LEPTRIS_XPATH_10 mode");
|
|
94
94
|
if (status) *status = LEPTRIS_ERROR_INVALID_ARG;
|
|
95
95
|
return NULL;
|
|
@@ -1133,7 +1133,8 @@ LEPTRIS_API LeptrisXPathResult leptris_xpath_compiled_eval_nodeset(
|
|
|
1133
1133
|
struct leptris_xpath_result* r =
|
|
1134
1134
|
leptris_xpath_compiled_eval(compiled, doc, contexts[i]);
|
|
1135
1135
|
if (!r) continue;
|
|
1136
|
-
if (r->type == LEPTRIS_XPATH_NODESET &&
|
|
1136
|
+
if ((int)r->type == (int)LEPTRIS_XPATH_NODESET &&
|
|
1137
|
+
r->value.nodeset_value) {
|
|
1137
1138
|
XPathNodeSet* ns = r->value.nodeset_value;
|
|
1138
1139
|
for (size_t j = 0; j < ns->count; j++)
|
|
1139
1140
|
xpath_nodeset_add(merged, ns->nodes[j]);
|
|
@@ -726,6 +726,72 @@ static int xsd_uint_attr(LeptrisElement e, const char* name, int* out) {
|
|
|
726
726
|
return 1;
|
|
727
727
|
}
|
|
728
728
|
|
|
729
|
+
/* src-include.1 (conformance lane schema-error class, #1691):
|
|
730
|
+
* the included/redefined schema's targetNamespace must equal the
|
|
731
|
+
* includer's — or be absent. Checked on the root's top-level
|
|
732
|
+
* include/redefine instructions; the subfile is parsed once here
|
|
733
|
+
* purely for the tns verdict (the capture pass re-reads it). */
|
|
734
|
+
static int xsd_check_include_tns(struct leptris_xsd_schema* s,
|
|
735
|
+
LeptrisElement root) {
|
|
736
|
+
for (LeptrisNodeRef n =
|
|
737
|
+
leptris_node_first_child(leptris_element_as_node(root));
|
|
738
|
+
n; n = leptris_node_next_sibling(n)) {
|
|
739
|
+
if (leptris_node_get_type(n) != LEPTRIS_NODE_TYPE_ELEMENT)
|
|
740
|
+
continue;
|
|
741
|
+
LeptrisElement c = (LeptrisElement)n;
|
|
742
|
+
const char* local = NULL;
|
|
743
|
+
const char* prefix = NULL;
|
|
744
|
+
const char* uri = NULL;
|
|
745
|
+
leptris_element_expanded_name(c, &local, &prefix, &uri);
|
|
746
|
+
if (!local || !uri || strcmp(uri, XSD_NS) != 0)
|
|
747
|
+
continue;
|
|
748
|
+
if (strcmp(local, "include") != 0 && strcmp(local, "redefine") != 0)
|
|
749
|
+
continue;
|
|
750
|
+
const char* loc =
|
|
751
|
+
leptris_element_attribute(c, "schemaLocation");
|
|
752
|
+
if (!loc || !s->base_dir)
|
|
753
|
+
continue;
|
|
754
|
+
char path[4096];
|
|
755
|
+
snprintf(path, sizeof(path), "%s/%s", s->base_dir, loc);
|
|
756
|
+
size_t flen = 0;
|
|
757
|
+
char* text = xsd_read_file(path, &flen);
|
|
758
|
+
if (!text) continue;
|
|
759
|
+
LeptrisDocument sub = leptris_parse_string(text, flen, NULL);
|
|
760
|
+
free(text);
|
|
761
|
+
if (!sub) continue;
|
|
762
|
+
LeptrisElement subroot = leptris_document_root(sub);
|
|
763
|
+
const char* sub_tns =
|
|
764
|
+
subroot ? leptris_element_attribute(subroot,
|
|
765
|
+
"targetNamespace")
|
|
766
|
+
: NULL;
|
|
767
|
+
int err = 0;
|
|
768
|
+
char msg[512];
|
|
769
|
+
if (s->target_ns && sub_tns && s->target_ns[0] && sub_tns[0] &&
|
|
770
|
+
strcmp(sub_tns, s->target_ns) != 0) {
|
|
771
|
+
snprintf(msg, sizeof(msg),
|
|
772
|
+
"src-include.1: the target namespace '%s' of the "
|
|
773
|
+
"included/redefined schema '%s' differs from '%s' "
|
|
774
|
+
"of the including schema",
|
|
775
|
+
sub_tns, loc, s->target_ns);
|
|
776
|
+
err = 1;
|
|
777
|
+
} else if ((!s->target_ns || !s->target_ns[0]) && sub_tns &&
|
|
778
|
+
sub_tns[0]) {
|
|
779
|
+
snprintf(msg, sizeof(msg),
|
|
780
|
+
"src-include.1: the target namespace '%s' of the "
|
|
781
|
+
"included/redefined schema '%s' has to be absent, "
|
|
782
|
+
"since the including schema has no target namespace",
|
|
783
|
+
sub_tns, loc);
|
|
784
|
+
err = 1;
|
|
785
|
+
}
|
|
786
|
+
leptris_document_free(sub);
|
|
787
|
+
if (err) {
|
|
788
|
+
xsd_set_error(s, msg);
|
|
789
|
+
return -1;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return 0;
|
|
793
|
+
}
|
|
794
|
+
|
|
729
795
|
/* Schema-structure constraints (the conformance lane's schema-error
|
|
730
796
|
* class, #1691): the xs:-vocabulary rules the oracle enforces at
|
|
731
797
|
* load. First violation wins; the message names the rule. */
|
|
@@ -854,6 +920,25 @@ static LeptrisXsdSchema xsd_compile_impl(const char* xsd_text,
|
|
|
854
920
|
if (xsd_check_structure(s, root) != 0)
|
|
855
921
|
goto fail;
|
|
856
922
|
|
|
923
|
+
/* Schema Component Constraint: xsi: Not Allowed — the schema's
|
|
924
|
+
* own targetNamespace must never be the xsi namespace
|
|
925
|
+
* (scc-no-xsi). */
|
|
926
|
+
if (s->target_ns &&
|
|
927
|
+
strcmp(s->target_ns,
|
|
928
|
+
"http://www.w3.org/2001/XMLSchema-instance") == 0) {
|
|
929
|
+
xsd_set_error(
|
|
930
|
+
s,
|
|
931
|
+
"scc-no-xsi: the target namespace must not be "
|
|
932
|
+
"'http://www.w3.org/2001/XMLSchema-instance'");
|
|
933
|
+
goto fail;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/* src-include.1: the included/redefined schema's
|
|
937
|
+
* targetNamespace must equal the includer's — or be absent
|
|
938
|
+
* (the chameleon form adopts the includer's at capture). */
|
|
939
|
+
if (xsd_check_include_tns(s, root) != 0)
|
|
940
|
+
goto fail;
|
|
941
|
+
|
|
857
942
|
xsd_capture_root(s, root);
|
|
858
943
|
xsd_resolve_extension_bases(s);
|
|
859
944
|
|
|
@@ -2582,7 +2582,8 @@ static int op_copy(XsltExec* ex, const XsltInstr* in, LeptrisElement node) {
|
|
|
2582
2582
|
/* §7.5: copying an ATTRIBUTE (re)binds it on the pending
|
|
2583
2583
|
* parent — later copies override earlier xsl:attribute values
|
|
2584
2584
|
* (execution order wins, §7.1.3). */
|
|
2585
|
-
if (node && ((LeptrisNode*)node)->type ==
|
|
2585
|
+
if (node && (int)((LeptrisNode*)node)->type ==
|
|
2586
|
+
(int)LEPTRIS_NODE_ATTRIBUTE) {
|
|
2586
2587
|
LeptrisAttributeNode* a = (LeptrisAttributeNode*)node;
|
|
2587
2588
|
if (ex->pending_parent && a->name)
|
|
2588
2589
|
leptris_element_set_attribute(ex->pending_parent,
|
|
@@ -2592,7 +2593,8 @@ static int op_copy(XsltExec* ex, const XsltInstr* in, LeptrisElement node) {
|
|
|
2592
2593
|
}
|
|
2593
2594
|
/* §7.5: copy of a NAMESPACE node declares it on the pending
|
|
2594
2595
|
* parent (the classic copy-the-namespaces idiom). */
|
|
2595
|
-
if (node && ((LeptrisNode*)node)->type ==
|
|
2596
|
+
if (node && (int)((LeptrisNode*)node)->type ==
|
|
2597
|
+
(int)LEPTRIS_NODE_NAMESPACE) {
|
|
2596
2598
|
LeptrisNamespaceNode* ns = (LeptrisNamespaceNode*)node;
|
|
2597
2599
|
/* The implicit xml prefix is always in scope — copying it
|
|
2598
2600
|
* would emit a redundant xmlns:xml (libxslt omits it). */
|
|
@@ -609,10 +609,13 @@ static struct leptris_xpath_result* acc_result_copy(
|
|
|
609
609
|
}
|
|
610
610
|
|
|
611
611
|
static size_t acc_ptr_hash(const void* p) {
|
|
612
|
-
uintptr_t
|
|
612
|
+
/* 64-bit promote: uintptr_t is 32-bit on wasm32/ILP32 and the
|
|
613
|
+
* >> 33 shift was UB there (the avalanche assumes 64 bits). */
|
|
614
|
+
uint64_t h = (uint64_t)(uintptr_t)p;
|
|
613
615
|
h ^= h >> 33;
|
|
614
|
-
h *=
|
|
616
|
+
h *= 0x9E3779B97F4A7C15ULL;
|
|
615
617
|
h ^= h >> 29;
|
|
618
|
+
h ^= h >> 32;
|
|
616
619
|
return (size_t)h;
|
|
617
620
|
}
|
|
618
621
|
|
|
@@ -1857,9 +1857,11 @@ static void free_instr_list(XsltInstr* list) {
|
|
|
1857
1857
|
* full linear scan produced. Mode buckets: candidate arrays per
|
|
1858
1858
|
* distinct mode, preserving sheet order. */
|
|
1859
1859
|
static size_t tpl_name_hash(const char* s) {
|
|
1860
|
-
size_t
|
|
1860
|
+
/* uint64 accumulator: size_t is 32-bit on wasm32/ILP32. */
|
|
1861
|
+
uint64_t h = 1469598103934665603ull;
|
|
1861
1862
|
while (*s) { h ^= (unsigned char)*s++; h *= 1099511628211ull; }
|
|
1862
|
-
|
|
1863
|
+
h ^= h >> 32;
|
|
1864
|
+
return (size_t)h;
|
|
1863
1865
|
}
|
|
1864
1866
|
|
|
1865
1867
|
void xslt_sheet_build_dispatch(XsltStylesheet* sheet) {
|
|
@@ -850,3 +850,53 @@ TEST(ParseRecover, WithoutFlagStillFails) {
|
|
|
850
850
|
LEPTRIS_PARSE_DEFAULT, &st);
|
|
851
851
|
EXPECT_EQ(doc, nullptr);
|
|
852
852
|
}
|
|
853
|
+
|
|
854
|
+
/* ---- leptris#1700: strict-path mismatch diagnostics -------------- */
|
|
855
|
+
|
|
856
|
+
TEST(ParseErrorPosition, StrictMismatchNamesTheTags) {
|
|
857
|
+
/* A close naming nothing open INSIDE an element: the message
|
|
858
|
+
* names the expected close and the one received, not a bare
|
|
859
|
+
* "malformed input" at a byte offset. (A stray close at depth 0
|
|
860
|
+
* — extra content after a complete document — fails the
|
|
861
|
+
* depth-0 check before the mismatch path and stays generic.) */
|
|
862
|
+
const char xml[] = "<r><a></b></a></r>";
|
|
863
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
864
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
865
|
+
EXPECT_EQ(doc, nullptr);
|
|
866
|
+
EXPECT_EQ(st, LEPTRIS_ERROR_PARSE);
|
|
867
|
+
|
|
868
|
+
const char* err = leptris_last_error();
|
|
869
|
+
ASSERT_NE(err, nullptr);
|
|
870
|
+
EXPECT_NE(std::strstr(err, "expected </a>"), nullptr) << err;
|
|
871
|
+
EXPECT_NE(std::strstr(err, "got </b>"), nullptr) << err;
|
|
872
|
+
|
|
873
|
+
int line = -1, column = -1;
|
|
874
|
+
leptris_last_error_position(&line, &column);
|
|
875
|
+
EXPECT_EQ(line, 1);
|
|
876
|
+
EXPECT_GT(column, 1);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
TEST(ParseErrorPosition, StrictMismatchNamesTheAncestor) {
|
|
880
|
+
/* The close names an ancestor: the message names the open
|
|
881
|
+
* element and the close that didn't match it. */
|
|
882
|
+
const char xml[] = "<bibdata><ext>t</bibdata>";
|
|
883
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
884
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
885
|
+
EXPECT_EQ(doc, nullptr);
|
|
886
|
+
|
|
887
|
+
const char* err = leptris_last_error();
|
|
888
|
+
ASSERT_NE(err, nullptr);
|
|
889
|
+
EXPECT_NE(std::strstr(err, "expected </ext>"), nullptr) << err;
|
|
890
|
+
EXPECT_NE(std::strstr(err, "got </bibdata>"), nullptr) << err;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
TEST(ParseErrorPosition, GenericFailuresStayGeneric) {
|
|
894
|
+
const char xml[] = "<r><a/></r";
|
|
895
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
896
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
897
|
+
EXPECT_EQ(doc, nullptr);
|
|
898
|
+
|
|
899
|
+
const char* err = leptris_last_error();
|
|
900
|
+
ASSERT_NE(err, nullptr);
|
|
901
|
+
EXPECT_NE(std::strstr(err, "malformed input"), nullptr) << err;
|
|
902
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
|
|
3
|
+
<include href="comb3-inner.rng">
|
|
4
|
+
<define name="content" combine="choice">
|
|
5
|
+
<element name="b"><empty/></element>
|
|
6
|
+
</define>
|
|
7
|
+
</include>
|
|
8
|
+
</grammar>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
|
|
3
|
+
<start><element name="root"><ref name="content"/></element></start>
|
|
4
|
+
<define name="content"><zeroOrMore><element name="a"><empty/></element></zeroOrMore></define>
|
|
5
|
+
</grammar>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
|
|
3
|
+
<include href="comb3-inner.rng">
|
|
4
|
+
<define name="content" combine="interleave">
|
|
5
|
+
<zeroOrMore><element name="b"><empty/></element></zeroOrMore>
|
|
6
|
+
</define>
|
|
7
|
+
</include>
|
|
8
|
+
<define name="content" combine="interleave">
|
|
9
|
+
<zeroOrMore><element name="c"><empty/></element></zeroOrMore>
|
|
10
|
+
</define>
|
|
11
|
+
</grammar>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
|
|
3
|
+
<include href="comb3-mid.rng">
|
|
4
|
+
<define name="content" combine="interleave">
|
|
5
|
+
<zeroOrMore><element name="d"><empty/></element></zeroOrMore>
|
|
6
|
+
</define>
|
|
7
|
+
</include>
|
|
8
|
+
<define name="content" combine="interleave">
|
|
9
|
+
<zeroOrMore><element name="e"><empty/></element></zeroOrMore>
|
|
10
|
+
</define>
|
|
11
|
+
</grammar>
|
|
@@ -1378,3 +1378,36 @@ TEST(RngRegex, ExactQuantifierIsClosed) {
|
|
|
1378
1378
|
EXPECT_EQ(rng_regex_matches("a{2}", "aa"), 1);
|
|
1379
1379
|
EXPECT_EQ(rng_regex_matches("a{2}", "aaa"), 0);
|
|
1380
1380
|
}
|
|
1381
|
+
|
|
1382
|
+
/* ---- leptris#1703: combine across multi-hop include chains ------- */
|
|
1383
|
+
|
|
1384
|
+
TEST(RngIncludeMultiHop, InterleaveSurvivesThreeHops) {
|
|
1385
|
+
/* inner defines a; mid's nested include-define interleave-adds b,
|
|
1386
|
+
* mid's own define interleave-adds c; outer's nested include-
|
|
1387
|
+
* define interleave-adds d, outer's own define interleave-adds
|
|
1388
|
+
* e. The first cut dropped every accumulated body at each
|
|
1389
|
+
* include's nested-define REPLACE — permissions vanished. */
|
|
1390
|
+
EXPECT_EQ(file_validates("comb3-outer.rng",
|
|
1391
|
+
"<root><a/><b/><c/><d/><e/></root>"),
|
|
1392
|
+
1);
|
|
1393
|
+
/* Every member must also be accepted alone (cardinality is
|
|
1394
|
+
* zeroOrMore per branch, not singleton). */
|
|
1395
|
+
EXPECT_EQ(file_validates("comb3-outer.rng", "<root><b/><d/></root>"),
|
|
1396
|
+
1);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
TEST(RngIncludeMultiHop, InterleaveRejectsUnknownElement) {
|
|
1400
|
+
EXPECT_EQ(file_validates("comb3-outer.rng", "<root><z/></root>"),
|
|
1401
|
+
0);
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
TEST(RngIncludeMultiHop, ChoiceUnionSurvivesIncludeHop) {
|
|
1405
|
+
/* inner allows a; the include's nested define choice-adds b —
|
|
1406
|
+
* the union must hold both. */
|
|
1407
|
+
EXPECT_EQ(file_validates("comb3-choice-outer.rng", "<root><a/></root>"),
|
|
1408
|
+
1);
|
|
1409
|
+
EXPECT_EQ(file_validates("comb3-choice-outer.rng", "<root><b/></root>"),
|
|
1410
|
+
1);
|
|
1411
|
+
EXPECT_EQ(file_validates("comb3-choice-outer.rng", "<root><z/></root>"),
|
|
1412
|
+
0);
|
|
1413
|
+
}
|
|
@@ -144,14 +144,16 @@ TEST(Libxml2Corpus, EveryFixtureCompilesOrFailsCleanly) {
|
|
|
144
144
|
EXPECT_GE(ok + failed, 160u) << "fixture set shrank";
|
|
145
145
|
// Compile floor: was 163/163 when compile was unconditional —
|
|
146
146
|
// the structure check (#1691) now legitimately rejects the
|
|
147
|
-
// schema-error fixtures
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
//
|
|
147
|
+
// schema-error fixtures. The floor is the CROSS-PLATFORM
|
|
148
|
+
// minimum: Linux (case-sensitive fs) resolves 4 more fixtures'
|
|
149
|
+
// schemaLocations than macOS, where they silently fail to load
|
|
150
|
+
// and the violations go unseen — Linux ok=155, macOS 159 (the
|
|
151
|
+
// delta is tracked in #1691: fixture case mismatches + a
|
|
152
|
+
// missing-include diagnostic). The differential expectations
|
|
153
|
+
// live in XsdConformance (MANIFEST.tsv). Monotonic.
|
|
152
154
|
RecordProperty("ok", std::to_string(ok));
|
|
153
155
|
RecordProperty("failed", std::to_string(failed));
|
|
154
|
-
EXPECT_GE(ok,
|
|
156
|
+
EXPECT_GE(ok, 155u) << "compile-success floor regressed";
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
} // namespace
|
|
@@ -2014,10 +2016,10 @@ TEST(XsdConformance, ManifestExpectationsMatchOracle) {
|
|
|
2014
2016
|
* schema-constraint gate is laxer than the oracle's; see the
|
|
2015
2017
|
* divergence tracker). Monotonically rising — each fix here
|
|
2016
2018
|
* retires oracle divergences wholesale. */
|
|
2017
|
-
EXPECT_GE(pass,
|
|
2019
|
+
EXPECT_GE(pass, 803) << "conformance floor regressed";
|
|
2018
2020
|
EXPECT_GE(pass_valid, 151);
|
|
2019
2021
|
EXPECT_GE(pass_invalid, 618);
|
|
2020
|
-
EXPECT_GE(pass_schema_error,
|
|
2022
|
+
EXPECT_GE(pass_schema_error, 34);
|
|
2021
2023
|
RecordProperty("pass_valid", std::to_string(pass_valid));
|
|
2022
2024
|
RecordProperty("pass_invalid", std::to_string(pass_invalid));
|
|
2023
2025
|
RecordProperty("pass_schema_error", std::to_string(pass_schema_error));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
|
3
3
|
"name": "leptris",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.355",
|
|
5
5
|
"description": "High-performance XML parser and XPath 1.0 engine in C (libleptris)",
|
|
6
6
|
"homepage": "https://github.com/leptris/leptris",
|
|
7
7
|
"license": "MIT",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: leptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.355.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -211,6 +211,7 @@ files:
|
|
|
211
211
|
- rakelib/audit_artifacts.rb
|
|
212
212
|
- scripts/gem_smoke.rb
|
|
213
213
|
- vendor-src/README.md
|
|
214
|
+
- vendor-src/libleptris/AGENT.md
|
|
214
215
|
- vendor-src/libleptris/CHANGELOG.md
|
|
215
216
|
- vendor-src/libleptris/CLAUDE.md
|
|
216
217
|
- vendor-src/libleptris/CMakeLists.txt
|
|
@@ -851,6 +852,10 @@ files:
|
|
|
851
852
|
- vendor-src/libleptris/test/rng/include-cases/bad-construct.rng
|
|
852
853
|
- vendor-src/libleptris/test/rng/include-cases/bad-override.rng
|
|
853
854
|
- vendor-src/libleptris/test/rng/include-cases/bad-start-override.rng
|
|
855
|
+
- vendor-src/libleptris/test/rng/include-cases/comb3-choice-outer.rng
|
|
856
|
+
- vendor-src/libleptris/test/rng/include-cases/comb3-inner.rng
|
|
857
|
+
- vendor-src/libleptris/test/rng/include-cases/comb3-mid.rng
|
|
858
|
+
- vendor-src/libleptris/test/rng/include-cases/comb3-outer.rng
|
|
854
859
|
- vendor-src/libleptris/test/rng/include-cases/ext-lib.rng
|
|
855
860
|
- vendor-src/libleptris/test/rng/include-cases/ext-main.rng
|
|
856
861
|
- vendor-src/libleptris/test/rng/include-cases/lib.rng
|