Function parse_exec
Source pub fn parse_exec(raw: &str, start: usize) -> Result<Vec<ExecStage>, Diag>
Expand description
Parse the Exec value. start is the absolute byte offset of the first
character in the source, used to translate spans for diagnostics.
1fn main() {
2 use mii_http::parse::exec::parse_exec;
3 let cases = ["echo Hello, [%name] [%guest]", "$ | xargs echo", "echo title=[$.title] count=[$.count]", "echo user [:user_id]"];
4 for c in &cases {
5 println!("--- {}", c);
6 match parse_exec(c, 0) {
7 Ok(stages) => for s in &stages { println!(" {:#?}", s); },
8 Err(e) => println!(" ERR: {} @ {:?}", e.message, e.span),
9 }
10 }
11}