feat(stdlib): Tiled P0 — XML reader + base64 decode + gzip framing (#67)
The three parsing primitives the TMX path needs that were not already in the tree (zlib inflate + the JSON reader already shipped): - Xml.* — a minimal, deterministic pure-Ludic XML reader for the element/attribute/CDATA subset TMX/TSX/TX use, spliced on demand. Handles nested elements, single/double-quoted attributes, text + <![CDATA[…]]>, comments, the <?xml?> prolog and <!DOCTYPE>, the five predefined entities and numeric character references. - Base64.* — standard base64 (RFC 4648) decode + a matching pure-Ludic encoder; the decoder ignores the whitespace Tiled wraps into <data>. Splicing Base64.* also pulls in inflate.ludic so a plain tool can run the full base64 -> zlib/gzip decode chain. - z_gunzip — gzip framing (RFC 1952) over the existing DEFLATE inflater: skip the 10-byte header + optional fields, inflate the body, ignore the CRC32/ISIZE trailer. Golden corpus vendored under assets/tiled-fixtures/ (mapeditor/tiled examples, attributed, + hand-authored multi-encoding fixtures). New example library/tiled_p0.ludic proves all three (21 assertions); docs pages + inventory added so check-impl stays green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
0b149a6876
commit
79776d1f6a
35 changed files with 20549 additions and 18415 deletions
7
docs/language/xml/_section.md
Normal file
7
docs/language/xml/_section.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
id: xml
|
||||
title: Xml
|
||||
order: 40
|
||||
---
|
||||
|
||||
A minimal, deterministic XML reader for the element/attribute/CDATA subset the native Tiled formats (TMX/TSX/TX) use. <a href="xml-parse"><code>Xml.parse</code></a> turns a document into an element tree; the accessors read a node's <a href="xml-tag"><code>tag</code></a>, <a href="xml-text"><code>text</code></a>, attributes (<a href="xml-attr"><code>Xml.attr</code></a>/<a href="xml-attr_int"><code>Xml.attr_int</code></a>/<a href="xml-has"><code>Xml.has</code></a>) and children (<a href="xml-child"><code>Xml.child</code></a>/<a href="xml-find"><code>Xml.find</code></a>/<a href="xml-count"><code>Xml.count</code></a>). It expands the five predefined entities and numeric character references, skips the <code><?xml?></code> prolog, comments and <code><!DOCTYPE></code>, and is best-effort rather than validating — the same contract as <a href="json"><code>Json</code></a>. Spliced on demand when a program mentions <code>Xml.*</code>.
|
||||
Loading…
Add table
Add a link
Reference in a new issue