Skip to main content

Module text

Module text 

Source
Expand description

The text form of every tool: one record per line, | between columns, strings of the program in JSON quotes.

Strings come from the program under audit, so whatever could break a line or change how it reads is escaped: control characters, the line and paragraph separators, the bidirectional controls that reorder the text around them, and the invisible format characters (zero-width spaces and joiners, the byte order mark, tag characters). A row then shows exactly the code points it holds, and reads back with any JSON parser.

Functionsยง

must_escape
Whether c is written as a \u escape rather than as itself: a control character, a line or paragraph separator, or a format character (Unicode category Cf: bidirectional controls, zero-width characters, the byte order mark, tag characters, and the rest).
push_unicode_escape
Append the \u escape of c: one per UTF-16 unit, as JSON writes a character beyond the BMP.
quote_into
Append s in double quotes, escaped as JSON does (\", \\, \n, \t, \r) and every other character must_escape names as \uXXXX, so it stays on one line and shows what it holds.
quoted
s in double quotes (quote_into).
value
The value of a key=value pair: as it is, or quoted when it is empty or holds whitespace, a quote, a backslash, = or a character must_escape names, which would otherwise blur where the pair ends or what it says.