Tiled P0 — C-free parsing primitives: XML reader, base64 decode, gzip framing #67
Labels
No labels
area:ci
area:docs
area:input
area:net
area:rendering
area:repo
area:stdlib
area:tooling
area:types
cleanup
dx
priority:high
priority:low
priority:medium
proposal
status:in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: workshopsoft/ludic#67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up P0 of the Tiled design (#66). Design record: Design: Tiled maps.
Scope — C-free parsing primitives
Two of the four "foundations" the #66 body assumed are already in
mainand are reused, not rebuilt:z_inflateinruntime/native/inflate.ludic✅z_uncompress, same file ✅Json.parse/Value.*inruntime/native/value.ludic✅So P0 is the remaining primitives only:
Crypto.base64encode today; add decode (RFC 4648, all padding remainders).Golden fixtures
desert.tmx+.tsx(base64+zlib),sewers.tmx(base64+zlib),mapobject.tmx(base64+gzip), plus a hand-authored base64-uncompressed + CSV pair. Vendor SHA-pinned intoassets/tiled-fixtures/with attribution (design §4).Acceptance
.tsx/.tmxelement tree with golden-file tests.mapobject.tmx's layer data against a known-good decompression.Blocks P0.5/P1. No map model yet — that is P1.
P0 landed in
main(79776d1).The three parsing primitives the TMX path needed — the other three "foundations" (DEFLATE, zlib, JSON) were already in the tree and are reused:
runtime/native/xml.ludic, a minimal deterministic pure-Ludic reader for the element/attribute/CDATA subset TMX/TSX/TX use, spliced on demand asXml.*. Handles nested elements, single/double-quoted attributes, text +<![CDATA[…]]>, comments, the<?xml?>prolog +<!DOCTYPE>, the five predefined entities and&#NN;/&#xHH;character references.runtime/native/base64.ludic(Base64.decode/Base64.encode); the decoder skips the whitespace Tiled wraps into<data>, passes the RFC 4648 vectors for every padding remainder. SplicingBase64.*also pulls ininflate.ludic, so a plain tool can run the whole base64 → zlib/gzip decode chain.z_gunzipinruntime/native/inflate.ludic: parse the 10-byte header + optional FEXTRA/FNAME/FCOMMENT/FHCRC fields, inflate the body through the existing DEFLATE core, skip the CRC32/ISIZE trailer (decode doesn't need the CRC — §6.4 resolved: skip).Golden corpus vendored under
assets/tiled-fixtures/(mapeditor/tiledexamples/— desert/sewers/orthogonal-outside/isometric/hexagonal/perspective_walls, attributed — plus hand-authoredhandmade.tmx/.tsxwhose four layers carry the same GID array in CSV, base64-uncompressed, base64+gzip and base64+zlib).Acceptance
.tsx/.tmxelement tree with golden tests —examples/library/tiled_p0.ludicparses a TSX tree (tag/attrs/entities/children/CDATA text).Proven by
library/tiled_p0.ludic(21 assertions) in the regression suite (x test: 90 passed). Docs pages + inventory added;x check-impl/check-docsgreen. Unblocks P0.5/P1.