php-dextrin

Text

Table of Contents

Classes

Escapes
Shared escape decoding/encoding for DXN's `string`/`char`/quoted -`keyword` bodies (`dxn/DXN.md` §1.1's `escape` production) -- one implementation so no caller duplicates it.
Formatter
Multi-line, indented `.dxn` rendering -- the `pretty: true` option on `Dextrin::encode()`, built on top of {@see Printer}. Every empty collection and every scalar falls through to the single-line printer unchanged (there's nothing multi-line about `[]` or `42`).
Lexer
Hand-written `.dxn` tokenizer, directly off `dxn/DXN.md` §1.1's lexical grammar. No parser-generator dependency -- the grammar is small and fully normative.
LexError
ParseError
Parser
Hand-written recursive-descent `.dxn` parser -- the reverse of {@see Printer}, built directly on {@see Lexer}'s token stream.
Printer
`.dxn` printer -- the reverse of {@see Parser}. Single-line, minimal-whitespace output: a printer, not a formatter (no line-wrapping/indentation policy is specified anywhere in `dxn/DXN.md`) -- {@see Formatter} owns multi-line, human-readable rendering, built on top of this class.
SyntaxNode
One node of a document's syntax tree, as {@see Parser::parseTree()} records it: its kind, its first and last token (indices into the tokens), the nodes inside it, and which of its tokens open it, key it, or name it. The trivia between two tokens is the text between them.
Temporal
DXN's dates and times as text (DXN.md §1.2, §1.5; Jan, 2026-10-20): the ISO 8601 strings under `@date`, `@time`, `@datetime`, `@local-datetime` and `@duration`, read and written in one place so the parser, the printer and the canonical form never drift apart.
Token
One lexed token. `start`/`end` are **codepoint indices**, not byte offsets -- {@see Lexer} operates on the source split into an array of single-codepoint strings (`preg_split('//u', ...)`) rather than raw byte-indexed PHP strings, which sidesteps multi-byte UTF-8 sequences entirely (a JS port indexes UTF-16 code units natively; PHP strings are raw bytes, so this port picks codepoints as its own natural, consistently-defined unit instead).
On this page

Search results