Skip to main content

Module scan

Module scan 

Source
Expand description

Scanning primitives. Each takes a buffer, a position and a stop, and returns the position after the construct it skips; the fallible ones fail on malformed input. They are the bricks the readers are built from and are exposed for tools that index C0DATA themselves.

Functions§

comment
Skip a comment starting at the BEL at pos: a note (text or plain to the next code) or a dead element (the next code’s whole element). Returns the position after it.
keyed_unit_end
From just after an SOH (not a header row), skip the key, US and value of one keyed unit. Returns the position after the value.
layout
Skip layout bytes.
level
Skip a nested level starting at the DLE at pos. Returns the position after the matching CAN.
plain
Skip a plain run of bytes >= 0x20 (a label, key, payload or plain value with its layout). Returns the position of the next control code or stop.
record_end
From just after an RS, find the end of the record: the next record-level code at this depth. Returns that position.
text
Skip a text (STX … ETX) starting at the STX at pos. Returns the position after the ETX. Fails on an unclosed text, a bad escape, a nested STX, or framing inside the text.
unit
From pos (just after a US, RS or a key’s US), find the end of one unit’s value: the next control code at this depth other than the ones that belong to the value (STX…ETX, DLE…CAN, ENQ, BEL note). Layout at the edges is included in the returned range.