leptris 1.9.199.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 +7 -0
- data/CHANGELOG.md +3890 -0
- data/CLAUDE.md +115 -0
- data/CONTEXT.md +39 -0
- data/LICENSE.md +33 -0
- data/README.adoc +755 -0
- data/Rakefile +407 -0
- data/TODO.perf/01-ext-accelerated-default-reads.md +28 -0
- data/TODO.perf/02-auto-enable-native-layer.md +19 -0
- data/TODO.perf/03-bulk-xpath-result-materialization.md +18 -0
- data/TODO.perf/04-ext-bound-serialization.md +15 -0
- data/TODO.perf/05-native-surface-completion.md +19 -0
- data/TODO.perf/06-perf-battery-native-legs.md +16 -0
- data/TODO.perf/07-native-read-floor.md +31 -0
- data/TODO.perf/08-version-coherent-native-mutations.md +24 -0
- data/TODO.perf/09-adoption-lift-fast-path.md +38 -0
- data/TODO.perf/10-bulk-attribute-materialization.md +20 -0
- data/TODO.perf/11-moxml-gap-battery.md +18 -0
- data/TODO.perf/12-document-lifetime-in-c.md +47 -0
- data/TODO.perf/13-structural-memos.md +49 -0
- data/TODO.perf/14-insert-family-c-bound.md +31 -0
- data/TODO.perf/15-compiled-expression-cache.md +35 -0
- data/TODO.perf/16-at-xpath-single-result-seam.md +38 -0
- data/TODO.perf/17-precomputed-fast-path-flags.md +35 -0
- data/TODO.perf/18-inner-html-one-c-pass.md +32 -0
- data/TODO.perf/19-lazy-node-pointer.md +39 -0
- data/TODO.perf/20-css-translation-cache.md +24 -0
- data/TODO.perf/21-key-memo-consult.md +20 -0
- data/TODO.perf/22-eager-nodeset-materialization.md +30 -0
- data/TODO.perf/23-cbound-value-mutations.md +27 -0
- data/TODO.perf/24-immutable-read-lanes.md +22 -0
- data/TODO.perf/25-scope-owned-bulk-path.md +39 -0
- data/TODO.perf/26-post-mutation-memo-seeding.md +26 -0
- data/TODO.perf/27-c-yield-traversal.md +38 -0
- data/TODO.perf/28-address-fills.md +25 -0
- data/TODO.perf/29-ns-xpath-compiled.md +23 -0
- data/TODO.perf/30-copy-and-element-child-faces.md +31 -0
- data/TODO.perf/31-battery-rounds-4-8.md +23 -0
- data/TODO.perf/32-clean-host-floor-table.md +29 -0
- data/TODO.perf/33-cbound-root-set.md +29 -0
- data/TODO.perf/34-fragment-fast-lane.md +41 -0
- data/TODO.perf/35-parse-default-c-face.md +24 -0
- data/TODO.perf/36-raise-in-c-serializer-encoding.md +34 -0
- data/TODO.perf/37-document-lazy-pointer.md +28 -0
- data/TODO.perf/38-bulk-walk-and-bench-gate.md +23 -0
- data/TODO.restructure/01-constraint-compliance-audit.md +40 -0
- data/TODO.restructure/02-deep-copy-seam.md +21 -0
- data/TODO.restructure/03-evaluation-context-seam.md +18 -0
- data/TODO.restructure/04-spec-mece-restructure.md +20 -0
- data/TODO.restructure/05-memory-documentation.md +13 -0
- data/TODO.restructure/06-architecture-map-refresh.md +12 -0
- data/TODO.restructure/07-external-gates.md +16 -0
- data/TODO.restructure/08-new-code-audit-and-ext-memo.md +11 -0
- data/TODO.restructure/09-iteration-scope.md +29 -0
- data/TODO.restructure/10-cold-attr-read-diet.md +19 -0
- data/TODO.restructure/11-construction-factory-diet.md +16 -0
- data/TODO.restructure/12-resultattr-merge.md +12 -0
- data/TODO.restructure/13-spec-mece-followup.md +9 -0
- data/TODO.restructure/14-constraint-audit-refresh.md +15 -0
- data/TODO.restructure/15-readme-feature-documentation.md +10 -0
- data/TODO.restructure/16-claudemd-map-refresh.md +5 -0
- data/TODO.restructure/17-perf-drift-record.md +12 -0
- data/TODO.restructure/18-audit-spec-doubles-and-gem-contents.md +12 -0
- data/TODO.restructure/19-gitignore-hygiene.md +10 -0
- data/TODO.restructure/20-utf8proc-enablement.md +34 -0
- data/TODO.restructure/21-typeddata-variant-prototype.md +42 -0
- data/TODO.restructure/22-sax-drain-bulk-strip.md +28 -0
- data/docs/adr/0001-lockstep-mirror.md +17 -0
- data/docs/adr/0002-utf8-at-the-seam.md +19 -0
- data/docs/adr/0003-readonly-memoization-pattern.md +34 -0
- data/docs/adr/0004-lifetime-guard.md +21 -0
- data/docs/adr/0005-autoload-manifest-ordering.md +19 -0
- data/docs/adr/0006-ruby-variant-policy.md +25 -0
- data/ext/build_windows_native.rb +42 -0
- data/ext/leptris/native/extconf.rb +55 -0
- data/ext/leptris/native/native.c +2528 -0
- data/leptris.gemspec +43 -0
- data/lib/leptris/version.rb +5 -0
- data/lib/leptris/xml/attr.rb +76 -0
- data/lib/leptris/xml/c_string_array.rb +37 -0
- data/lib/leptris/xml/cdata.rb +27 -0
- data/lib/leptris/xml/comment.rb +27 -0
- data/lib/leptris/xml/css_to_xpath.rb +192 -0
- data/lib/leptris/xml/descriptor.rb +214 -0
- data/lib/leptris/xml/diff.rb +74 -0
- data/lib/leptris/xml/doc_type.rb +54 -0
- data/lib/leptris/xml/document.rb +716 -0
- data/lib/leptris/xml/document_fragment.rb +63 -0
- data/lib/leptris/xml/element.rb +771 -0
- data/lib/leptris/xml/entity_reference.rb +13 -0
- data/lib/leptris/xml/evaluation_context.rb +32 -0
- data/lib/leptris/xml/ffi.rb +1527 -0
- data/lib/leptris/xml/iteration_scope.rb +56 -0
- data/lib/leptris/xml/iterparse.rb +144 -0
- data/lib/leptris/xml/namespace.rb +43 -0
- data/lib/leptris/xml/native.so +0 -0
- data/lib/leptris/xml/native_layer.rb +92 -0
- data/lib/leptris/xml/node.rb +686 -0
- data/lib/leptris/xml/node_set.rb +212 -0
- data/lib/leptris/xml/parse_options.rb +97 -0
- data/lib/leptris/xml/plan_value.rb +121 -0
- data/lib/leptris/xml/processing_instruction.rb +90 -0
- data/lib/leptris/xml/pull.rb +212 -0
- data/lib/leptris/xml/relaxng.rb +126 -0
- data/lib/leptris/xml/result_attr.rb +39 -0
- data/lib/leptris/xml/result_text.rb +36 -0
- data/lib/leptris/xml/sax/document.rb +45 -0
- data/lib/leptris/xml/sax/dom_dispatch.rb +144 -0
- data/lib/leptris/xml/sax/parser.rb +326 -0
- data/lib/leptris/xml/sax/recorder.rb +374 -0
- data/lib/leptris/xml/sax.rb +14 -0
- data/lib/leptris/xml/schematron.rb +88 -0
- data/lib/leptris/xml/searchable.rb +361 -0
- data/lib/leptris/xml/serialization.rb +180 -0
- data/lib/leptris/xml/text.rb +32 -0
- data/lib/leptris/xml/xpath.rb +89 -0
- data/lib/leptris/xml/xquery.rb +77 -0
- data/lib/leptris/xml/xslt.rb +85 -0
- data/lib/leptris/xml.rb +108 -0
- data/lib/leptris.rb +53 -0
- data/lib/libleptris.so +0 -0
- data/lib/libutf8proc.so.3 +0 -0
- data/scripts/gem_smoke.rb +36 -0
- metadata +214 -0
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project
|
|
6
|
+
|
|
7
|
+
`leptris-ruby` is the official Ruby binding for `libleptris`
|
|
8
|
+
(https://github.com/leptris/leptris), a pure-C99 XML 1.0 parser with a
|
|
9
|
+
W3C-conformant XPath 1.0 engine (438/438 on the W3C suite), full SAX,
|
|
10
|
+
pull parsing, and C14N. The binding is **FFI-based** (no C extension,
|
|
11
|
+
no compilation at install) and ships **precompiled platform gems**
|
|
12
|
+
with the shared library vendored inside: x86_64/aarch64-linux (glibc
|
|
13
|
+
and musl), x86_64/arm64-darwin, x64-mingw32/ucrt, aarch64-mingw-ucrt,
|
|
14
|
+
plus the pure-Ruby fallback gem.
|
|
15
|
+
|
|
16
|
+
Version lockstep: the gem version is
|
|
17
|
+
`{libleptris full semver}.{binding patch}` — gem `1.9.76.0` pairs
|
|
18
|
+
with libleptris `1.9.76`; binding-only changes bump the fourth
|
|
19
|
+
segment (`1.9.76.1`), an upstream adoption moves to `{C}.0`. A C
|
|
20
|
+
release means one PR carrying version.rb + the Rakefile
|
|
21
|
+
`LIBLEPTRIS_VERSION` pin + the CHANGELOG entry, then the release
|
|
22
|
+
workflow (`next_version={C}.0`).
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
bundle exec rake compile # build libleptris (pinned tarball) into lib/
|
|
28
|
+
bundle exec rspec # full suite (uses the vendored library)
|
|
29
|
+
bundle exec rspec spec/xml/xpath_spec.rb:42 # one example
|
|
30
|
+
bundle exec rake gem:native:arm64-darwin # platform gem
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`LEPTRIS_LIB_PATH=/path/to/libleptris.dylib bundle exec rspec` runs
|
|
34
|
+
against an arbitrary build (e.g. a libleptris checkout under test).
|
|
35
|
+
|
|
36
|
+
## Architecture
|
|
37
|
+
|
|
38
|
+
The C DOM is the single source of truth; Ruby objects are thin FFI
|
|
39
|
+
handles. One Ruby method = one FFI call wherever possible.
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
lib/leptris.rb — Leptris::VERSION + eager FFI bootstrap
|
|
43
|
+
lib/leptris/xml.rb — autoload registry, error classes,
|
|
44
|
+
Leptris::XML.parse / parse_html
|
|
45
|
+
lib/leptris/xml/ffi.rb — every public C declaration + seam
|
|
46
|
+
helpers (check_status, read_owned_string,
|
|
47
|
+
serialize_into_string, scratch buffers)
|
|
48
|
+
lib/leptris/xml/document.rb — the only C-memory owner (finalizer);
|
|
49
|
+
factories; Document.copy_of: the single
|
|
50
|
+
deep-copy seam behind Node#dup/Element#dup
|
|
51
|
+
lib/leptris/xml/node.rb — Node.wrap: the ONLY wrapper constructor
|
|
52
|
+
(identity cache + type dispatch,
|
|
53
|
+
ResultText for sequence items)
|
|
54
|
+
lib/leptris/xml/element.rb — attributes via the v1.1.0 iteration
|
|
55
|
+
face; namespace= (nil-detach/rebind)
|
|
56
|
+
lib/leptris/xml/result_text.rb — sequence/map/array result items
|
|
57
|
+
(values captured at materialization)
|
|
58
|
+
lib/leptris/xml/result_attr.rb — attribute-node result items
|
|
59
|
+
(name/value captured at materialization)
|
|
60
|
+
lib/leptris/xml/iteration_scope.rb — owning context for iterparse
|
|
61
|
+
elements (liveness, identity, memos)
|
|
62
|
+
lib/leptris/xml/node_set.rb — lazy XPath/XQuery results; batch fetch
|
|
63
|
+
via get_nodes_ex; ResultText capture
|
|
64
|
+
lib/leptris/xml/searchable.rb — xpath/css/at_*; result materialization
|
|
65
|
+
lib/leptris/xml/evaluation_context.rb — receiver -> (document,
|
|
66
|
+
context-node ptr) for the expression faces
|
|
67
|
+
lib/leptris/xml/xpath.rb — compiled expressions (parse once,
|
|
68
|
+
eval many)
|
|
69
|
+
lib/leptris/xml/xquery.rb — compiled XQuery 1.0 core face
|
|
70
|
+
lib/leptris/xml/xslt.rb — compiled XSLT 1.0-3.0 face
|
|
71
|
+
lib/leptris/xml/sax/ — callback SAX (streaming + DOM dispatch)
|
|
72
|
+
lib/leptris/xml/pull.rb — StAX-style pull parsing
|
|
73
|
+
lib/leptris/xml/iterparse.rb — bounded-memory element iteration
|
|
74
|
+
lib/leptris/xml/serialization.rb — serialize/c14n (Document + Element
|
|
75
|
+
one-liners over this module)
|
|
76
|
+
lib/leptris/xml/c_string_array.rb — NULL-terminated char** adapter
|
|
77
|
+
lib/leptris/xml/css_to_xpath.rb — minimal CSS translation
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Ownership and seams
|
|
81
|
+
|
|
82
|
+
- `Document` owns C memory (explicit `#free` or GC finalizer; wrapper
|
|
83
|
+
cache is a strong Hash cleared on free). Every other class is a
|
|
84
|
+
borrowed handle valid while its Document lives.
|
|
85
|
+
- All wrapper construction goes through `Node.wrap` — wrapper
|
|
86
|
+
identity (`doc.root.equal?(doc.root)`) is guaranteed by the
|
|
87
|
+
per-document cache.
|
|
88
|
+
- Status checks go through `FFI.check_status`; C `char*` returns go
|
|
89
|
+
through `FFI.read_owned_string`; array wire format (both
|
|
90
|
+
directions) goes through `CStringArray`. Never hand-roll these.
|
|
91
|
+
- The release workflow's publish loop is idempotent (already-published
|
|
92
|
+
gems are skipped).
|
|
93
|
+
|
|
94
|
+
## Conventions
|
|
95
|
+
|
|
96
|
+
- Autoload only — no `require_relative` or intra-library `require`
|
|
97
|
+
inside `lib/` (sanctioned exceptions, with reasons in-file:
|
|
98
|
+
`leptris/version` at the gem root and the eager FFI bootstrap).
|
|
99
|
+
- No `instance_variable_set`/`_get` across objects; no `send` to
|
|
100
|
+
private methods; no `respond_to?` type checks (dispatch on types
|
|
101
|
+
with `is_a?`/`case`); specs use real documents, never doubles.
|
|
102
|
+
- New C surface: attach in `ffi.rb`, sugar where it earns its keep,
|
|
103
|
+
specs against a locally built library, CHANGELOG, lockstep release.
|
|
104
|
+
- All changes via PRs; no AI attribution; `git add` explicit paths.
|
|
105
|
+
|
|
106
|
+
## Reference
|
|
107
|
+
|
|
108
|
+
- Domain vocabulary: CONTEXT.md. Settled decisions: docs/adr/ —
|
|
109
|
+
check both before proposing refactors; they exist so reviews
|
|
110
|
+
stop re-deriving settled questions.
|
|
111
|
+
- libleptris public headers (`src/include/leptris/*.h`) are the
|
|
112
|
+
contract; when symbols change, bump lockstep and run
|
|
113
|
+
`rake audit:symbols` (attached == exported on the vendored
|
|
114
|
+
library; fails listing both directions of drift).
|
|
115
|
+
- Upstream issues worth tracking live at leptris/leptris.
|
data/CONTEXT.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Domain glossary
|
|
2
|
+
|
|
3
|
+
The vocabulary for talking about leptris-ruby. Architecture reviews
|
|
4
|
+
use these names; see docs/adr/ for settled decisions.
|
|
5
|
+
|
|
6
|
+
**The DOM** — the C tree built by libleptris. Single source of
|
|
7
|
+
truth: every Ruby object is a view over it, and one Ruby method is
|
|
8
|
+
one FFI call wherever possible.
|
|
9
|
+
|
|
10
|
+
**The seam** — `Leptris::XML::FFI`: every attach, every struct
|
|
11
|
+
layout, every buffer protocol, and the encoding policy (UTF-8 on
|
|
12
|
+
both faces: returns and callback params). ABI knowledge appears
|
|
13
|
+
nowhere else (document.rb's finalizer is ownership machinery;
|
|
14
|
+
CStringArray is the char** adapter).
|
|
15
|
+
|
|
16
|
+
**Ownership / the borrowed handle** — Document owns C memory
|
|
17
|
+
(explicit `#free` or GC finalizer); every other object (Node,
|
|
18
|
+
Element, Text, Comment, CDATA, PI, Attr, DocumentFragment, DocType)
|
|
19
|
+
is a handle borrowed for its document's lifetime. Mutations raise
|
|
20
|
+
ReadOnlyError on readonly documents; use of a handle after `#free`
|
|
21
|
+
raises UseAfterFreeError.
|
|
22
|
+
|
|
23
|
+
**Wrapper identity** — `Node.wrap` is the only wrapper constructor;
|
|
24
|
+
the per-document strong cache makes the same C node always yield the
|
|
25
|
+
same Ruby object (`doc.root.equal?(doc.root)`).
|
|
26
|
+
|
|
27
|
+
**The readonly contract** — `readonly: true` makes reads memoizable
|
|
28
|
+
because they cannot go stale; every read method follows the same
|
|
29
|
+
three-line pattern (return memo → compute → store memo). Mutations
|
|
30
|
+
are refused; detached factories still work.
|
|
31
|
+
|
|
32
|
+
**Lockstep** — the gem's major.minor tracks libleptris; a C release
|
|
33
|
+
is one PR (version.rb + Rakefile pin + CHANGELOG) then the release
|
|
34
|
+
workflow; ffi.rb mirrors the public header so the attached-vs-
|
|
35
|
+
exported audit (`nm -gU`) catches drift.
|
|
36
|
+
|
|
37
|
+
**The recover mode** — `recover: true` parses return an empty
|
|
38
|
+
document with the failure recorded on the thread-global last error
|
|
39
|
+
(+ position), instead of raising ParseError.
|
data/LICENSE.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Licenses & Copyright
|
|
2
|
+
====================
|
|
3
|
+
|
|
4
|
+
This license file adheres to the formatting guidelines of
|
|
5
|
+
[readable-licenses](https://github.com/nevir/readable-licenses).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Ribose's BSD 2-Clause License
|
|
9
|
+
-----------------------------
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2025, [Ribose Inc](https://www.ribose.com).
|
|
12
|
+
All rights reserved.
|
|
13
|
+
|
|
14
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
15
|
+
are permitted provided that the following conditions are met:
|
|
16
|
+
|
|
17
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
18
|
+
this list of conditions and the following disclaimer.
|
|
19
|
+
|
|
20
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
21
|
+
this list of conditions and the following disclaimer in the documentation
|
|
22
|
+
and/or other materials provided with the distribution.
|
|
23
|
+
|
|
24
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
25
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
26
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
28
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
29
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
30
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
32
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
33
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|