Skip to main content

Module structure

Module structure 

Source
Expand description

Structural boundary and grouping Tokel Transformers.

This module provides transformers for modifying the structural hierarchy and boundaries of token streams.

§Available Transformers

TransformerArgument TypeDescription
Flattensyn::parse::NothingRecursively removes all (), {}, and [] boundaries, flattening into a 1D stream.
EncapsulateEncapsulateGroupWraps the entire input stream inside the delimiter type of the provided argument.

§Argument Types

§Examples

Basic Usage:

  • [< (()) [[Hello]] ([{ AA }]) >]:flatten -> Hello AA
  • [< Hello >]:encapsulate[[()]] -> (Hello)

§Remarks

  • Flatten recursively traverses all nested groups within the token stream and extracts their inner contents, resulting in a single, flat, one-dimensional token sequence.
  • Encapsulate takes the entire evaluated input stream and places it directly inside a new group matching the delimiter provided in the argument.

Structs§

Encapsulate
Wraps the entire input stream in the delimiter type of the provided argument Group.
EncapsulateGroup
The argument type used for the Encapsulate pass.
Flatten
Recursively removes all (), {}, and [] boundaries, flattening into a 1D stream.

Functions§

register
Inserts all structure-related Transformers into the specified Registry.