Skip to main content

setheredoc

Function setheredoc 

Source
pub fn setheredoc(
    _pc: usize,
    _redir_type: i32,
    _doc: &str,
    _term: &str,
    _munged_term: &str,
)
Expand description

Wire a here-document body onto the redirection token that requested it. Direct port of zsh/Src/parse.c:2347 setheredoc. Called when a heredoc terminator has been matched and the body is ready to be attached to the redir.

zshrs port note: zsh’s setheredoc patches the wordcode in-place via pc[1] = ecstrcode(doc); pc[2] = ecstrcode(term);. zshrs threads heredoc bodies through HereDocInfo structs that resolve_redir applies during the post-parse fill_in pass. This method is the AST-side equivalent: writes back to the matching redir node by index.