blob: e61b5bd8c9d040bb944722842a157649e0705730 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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* }
|