Function: splitEscapeAware()
splitEscapeAware(
text,delimiter,escape):string[]
Split text on delimiter, treating any escape sequence (escape … escape) as an opaque atom so a delimiter that appears inside an escape body
never causes a split. Returns the raw (still-encoded) segments: decoding is
the caller's next step, per the escape-aware-split-then-decode contract.
For the four canonical mnemonics this is belt-and-suspenders (their bodies are letters, not delimiters), but it makes the "an escaped delimiter is one token" guarantee hold for any declared delimiter set, including adversarial input.
Parameters
text
string
The field or repeat string to split.
delimiter
string
The delimiter to split on.
escape
string
The active escape character.
Returns
string[]
The raw segments, in order.
Example
import { splitEscapeAware } from "@cosyte/astm";
splitEscapeAware("a^b^c", "^", "&"); // ["a", "b", "c"]
splitEscapeAware("1&S&40", "^", "&"); // ["1&S&40"] (escape body is opaque)