Skip to main content

Module op_text

Module op_text 

Source
Expand description

The pieces of an op field’s text.

Every reader of op-field text divides it the same way, with pieces: the bind-point scanner (extract_bind_points), the scope resolver that writes phase-constant values into a field, and the renderers that produce the text an adapter sends. One division means a brace is a bind point to all of them or to none.

The rules, in the order they are tried at each position:

  1. \{ and \} are one literal brace (Piece::Brace). A backslash before anything else is an ordinary character.
  2. {{ … }} is an inline expression (Piece::Inline).
  3. { whose next character, after any whitespace, is ' or " is a literal brace: the opening of a CQL map or a JSON object. The text after it is still scanned, so a bind point inside the map is found.
  4. { … } with balanced braces and a body that is not blank is a group (Piece::Group). What a group means is decided by classify_group.
  5. Any other { (no closing brace, or a blank body) is literal.

A reader that passes text on to a later reader carries Piece::Brace as it was written (Piece::as_written), so the later reader still sees an escape. The reader that produces final text writes the brace alone; unescape does that for a field that holds no bind points.

Enums§

Piece
One piece of an op field’s text. See the module documentation for the rules that divide a text into pieces.

Functions§

pieces
Divide an op field’s text into its pieces.
unescape
The final text of a field that holds no bind points: each \{ and \} becomes the brace alone, and everything else is kept.