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 attached inline during the post-parse fill_heredoc_bodies walk. This method is the AST-side equivalent: writes back to the matching redir node by index. Port of setheredoc(int pc, int type, char *str, char *termstr, char *munged_termstr) from Src/parse.c:2347-2355. Patches the pending heredoc redir at pc with its body string + raw and munged terminator forms.