pub fn parse_subst_string(s: &str) -> Result<String, String>Expand description
Tokenize a string as if it were a normal command-line argument but it may contain separators. Used for ${…%…} substitutions.
Direct port of zsh/Src/lex.c:1796-1880 parse_subst_string.
zsh’s version sets noaliases = 1 + lexflags = 0 + uses
zcontext_save/inpush/strinbeg → dquote_parse(‘\0’, 1) →
strinend/inpop/zcontext_restore. zshrs’s standalone walker
produces the same BNULL/SNULL/DNULL/INPAR/INBRACK markers
without re-entering the lexer.
zshrs port note: the C source returns int (0=ok, char value = where it stopped on error); zshrs returns Result<String,String> returning the tokenized text directly. Lossy for callers that need to know the exact stop position, but nothing in zshrs’s expansion layer uses that yet.