@std/text.ms#
Import each required symbol with import Name from "@std/text.ms".
quote Function#
Quotes text as a double-quoted literal, using the escapes of Manuscript string literals.
Printable Unicode stays as is; controls, bidi controls and U+2028/U+2029 become \u{..}.
Braces stay as they are, because plain "..." text never interpolates. The result is valid source text for the same string.
fn quote(text String) String { ... }quote_ascii Function#
Like quote, but every non-ASCII scalar is written as \u{..}, so the result is
pure ASCII.
fn quote_ascii(text String) String { ... }scalars Function#
A stream of the text’s scalars, each as a one-scalar String. Unlike get(index),
which walks from the start every time, the stream decodes the next scalar where it
stopped, so scanning long non-ASCII text is linear.
fn scalars(text String) ReadStream[String] { ... }unquote Function#
Reverses quote: reads a double-quoted literal and returns its text.
Supported escapes are \", \\, \n, \r, \t, \0, \u{hex} with 1 to 6 hexadecimal digits,
and \{ and \} (the escaped braces of f"..." text, which quote never writes).
Any other escape, or text that is not fully quoted, returns EINVAL.
fn unquote(text String) Result[String, Error] { ... }