pub fn split_wrapper_flags(occurrences: &[WrapperOccurrence]) -> WrapperFlagsExpand description
What:
Split the wrapper occurrences of a parse whose flag list was built as
“own escape hatch first,
then the caller’s flags”.
&[WrapperOccurrence] borrows
the occurrence list of that parse.
Why:
Every command module builds its list that way,
so the caller’s indexes are the
tokenizer’s indexes minus one.
In TS you’d write (pseudocode):
const escape = wrapper.filter(w => w.flag === 0).map(w => w.token);
const other = wrapper.filter(w => w.flag > 0).map(w => ({ flag: w.flag - 1, token: w.token }));