Skip to main content

Module blockdoc

Module blockdoc 

Source
Expand description

The ct block document (.ctb) — the suite’s one script format for batched operations whose payloads are verbatim text.

Delimited text, not JSON: payloads are code, and code must paste in with zero escaping. A fence line starts with the fence string (#% by default). A fence whose name the consuming tool declared as item-opening (edit for ct-edit, set/delete for ct-patch batches) opens an item and carries key=value attributes; other fence names open verbatim payload sections of the current item; end closes the item. Outside items, blank lines and #-comment lines are ignored.

#% edit expect="=1" file=src/ast.rs
#% find
            Value::U64(v) => v.to_string(),
#% replace
            Value::U64(v) => v.to_string(),
            Value::I64(v) => v.to_string(),
#% end

Structs§

Item
One parsed item: an opening directive, its attributes, and its payload sections in document order.

Constants§

DEFAULT_FENCE
The default fence string opening every directive line.

Functions§

parse
Parse a block document. item_names declares which directive names open an item; every other fence name is a payload section. An item-opening directive implicitly closes the previous item, and end closes one explicitly — so attribute-only items (#% delete path=…) need no end.