Skip to main content

Module text

Module text 

Source
Expand description

The text script format: a hand-writable, datadriven-style command file.

A script is a sequence of stanzas, each a command and its expected output:

write-single-ts shard=data ts=0 count=5000
----
wrote 5000

count id=1001 ts=5
----
10000

A stanza is a command (a directive line plus an optional indentation-structured body) up to a ---- separator, then the expected output up to a blank line. The ---- block is the assertion; REWRITE=1 regenerates it (see crate::script). A # at column 0 is a comment; an indented #0 is a column reference in MIR. Comments and blank lines are preserved across a rewrite.

Command bodies are indentation-structured: define-schema/write-rows/peek carry rows or columns, and define carries import/build/export sub-commands, with a build’s MIR as its own deeper-indented sub-body.

Structs§

Stanza
A command stanza: the input block, the expected output, and the parsed command.

Enums§

Item
One element of a parsed script file, retained so a REWRITE reproduces the file faithfully.

Functions§

parse_file
Parse a script file into items: each command stanza plus the comments and blank lines around it.
rewrite
Reproduce a script file with each stanza’s expected output replaced by its actual output, for REWRITE. actuals has one entry per Item::Stanza, in order.