Mibo.Markup Namespace
| Type/Module | Description |
|
The parser's token union. What a front-end hands over before any statement names the expected type. Consumed once, during resolution — never stored past it. Three cases, by design: a number token, a decimal token, and a word (a bare identifier, a quoted string, or `true`/`false`). There is no arithmetic case (the resolver computes; the text never does) and no parameter case (sizes come from properties). Not a struct union by language rule: a multi-case struct union needs one shared field type, and `Word` carries a string. Args live only at parse and resolve time (never per frame), so the allocations do not reach a hot path. |
|
|
A cell-space extent: width across, height down. The document model's named pair for element sizes (`w=`/`h=`, extents, per-axis gaps) — the counterpart of `Mibo.Layout.CellPoint`/`CellRect`, which carry points and rectangles. |
|
|
Document resolution: the resolved `Item` tree a front-end's `Node` tree becomes. Layout lives in properties (the style cascade); paint lives in bodies (`Op` data, interpreted at render time — the document text produces no closures of its own beyond one interpreter wrapper per element). Geometry rides the framework's own nouns (`CellPoint`, `CellSize`, `CellRect`, `Align`, `Track`). |
|
The Flow backend for the document surface: parses, resolves, and
lays a document out through the Flow authoring API
(`Mibo.Layout.Flow`) — one `Flow.run` per layer; `build` paints
through the no-registry path and reports no structure.
Stack pack -> `Flow.overlay` of stack children: an `x= y=` child
becomes `Flow.at`, alignment becomes `Dock` flags
Flow pack -> `Flow.grid`: named areas pass through, `col=`/`row=`
and flow children place as explicit slots, `auto`
tracks size from the children's footprints
Scatter -> `Flow.scatter`: the framework's seeded rule places
the sized children
Layers -> `Flow.runLayers`: one stamp per layer, one grid per
layer, bottom first
Build-time only, like every Flow consumer: the Item tree emits to
stamps that compose at paint time, so measurement sees the assigned
rectangle exactly as the document model describes it.
|
|
The KDL front-end. Produces the format-neutral `Node` tree from KDL
2.0 text on KdlSharp's token reader — the reader does all the
parsing, and node positions come from the reader's own line and
column, converted to character offsets against the source:
- a node is `kind args? props? { children }?`
- `name=value` pairs are properties (the layout channel); bare values
are positional args
- a node whose kind is `element` carries its template name as the
first word argument (moved to `Node.Label`)
- slashdash `/-` comments out a whole node — parsed and dropped, so a
bad body still errors
KDL's typed literals (hex, underscores, quoted numbers) have no XML
equivalent; XML attributes type by content. Unclosed and unbalanced
braces fail visibly, and adapter failures carry the reader's line
and column.
|
|
|
Format-neutral helpers over the node tree. The front-ends (`Xml`, `Kdl`) produce `Node` trees the resolver consumes without seeing the text format. |
|
|
One markup node: `kind args? props? { children }?`. `Position` is the character offset of the node's first token when the front-end tracks positions (KDL), or `-1` when it does not (XML) — resolution errors then name the element instead of pointing at a line. `Label` carries a template definition's name. |
|
|
One `name=value` property: the layout channel of a node. `w=6`, `place="center"`, `pack="flow"` — in XML terms, an attribute. |
|
The XML front-end. Produces the format-neutral `Node` tree with the BCL parser doing all the parsing — no hand-rolled scanning: - an element is a node (the tag is the kind); child elements are the node's children - an attribute is a property — the scalar channel, the way XML means it (`map w="36" h="20"`); a node's `Args` stay empty from this front-end, and the resolver reads every scalar by property name - the value is typed int, then finite float, then word (`x="1"` is a number, `place="center"` is a word) - an `element` definition carries its template name in the `name` attribute (the label) - comments and processing instructions are free; text is not markup — a non-whitespace text node inside an element fails the parse Namespace-free documents: `xmlns` attributes would become plain properties. Parse failures carry the parser's line and position. This front-end does not track node positions (the BCL line-info surface is not reachable from F# without fragile reference tricks), so a `Node` from XML carries `Position = -1` and resolution errors name the element instead of pointing at a line; KDL documents carry real positions. |
Mibo