bareword_char = @{ !("|" | ";" | "\"" | "'" | WHITESPACE | COMMENT) ~ ANY } single_string_char = @{ "\\'" | (!"'" ~ ANY) } double_string_char = @{ "\\\"" | (!"\"" ~ ANY) } bareword = @{ bareword_char+ } single_string = @{ single_string_char+ } double_string = @{ double_string_char+ } word = ${ bareword | "'" ~ single_string ~ "'" | "\"" ~ double_string ~ "\"" } exe = { word+ } pipeline = { exe ~ ("|" ~ exe)* } commands = { pipeline ~ (";" ~ pipeline)* } line = { SOI ~ commands ~ EOI } WHITESPACE = _{ (" " | "\t" | "\n") } COMMENT = _{ "#" ~ ANY* }