Skip to main content

parse_string

Function parse_string 

Source
pub fn parse_string(s: &str, reset_lineno: i32) -> Option<eprog>
Expand description

Port of parse_string(char *s, int reset_lineno) from Src/exec.c:283.

C body:

Eprog p; zlong oldlineno;
zcontext_save();
inpush(s, INP_LINENO, NULL);
strinbeg(0);
oldlineno = lineno;
if (reset_lineno) lineno = 1;
p = parse_list();
lineno = oldlineno;
if (tok == LEXERR && !lastval) lastval = 1;
strinend();
inpop();
zcontext_restore();
return p;

Parses an arbitrary string as a zsh command list, returning the Eprog (compiled wordcode). Used by getoutput for $(cmd), bin_eval for eval, and the autoload path.