otto/crates/parser/src/pipeline.pest

49 lines
1.2 KiB
Plaintext

// The pipeline PEG
pipeline = _{ SOI ~ "pipeline" ~
BLOCK_BEGIN ~
execBlocks ~
BLOCK_END ~ EOI }
execBlocks = { (stage
| steps
| parallel)* }
stage = { "stage" ~
BLOCK_BEGIN ~
(property*) ~
steps ~
BLOCK_END }
// The parallel block can contain multiple stages which run in parallel
//
// inside the parser this should result in multiple contexts in the same batch
parallel = { "parallel" ~
BLOCK_BEGIN ~
(stage)* ~
BLOCK_END }
steps = { "steps" ~ BLOCK_BEGIN ~ step+ ~ BLOCK_END }
step = { IDENT ~ (
args
| kwargs
)
}
args = { (STR ~ COMMA?)+ }
kwargs = _{ (kwarg ~ COMMA?)+ }
kwarg = { IDENT~ ":" ~ STR }
property = { IDENT ~ "=" ~ STR }
IDENT = @{ ASCII_ALPHA ~ (ASCII_ALPHANUMERIC | "_")* }
BLOCK_BEGIN = @{ "{" }
BLOCK_END = @{ "}" }
STR = { "'" ~ STRV ~ "'" }
STRV = @{ "''" | (!"'" ~ ANY)* }
COMMA = @{ "," }
WHITESPACE = _{ (" " | NEWLINE) }
BLOCK_COMMENT = _{ "/*" ~ (BLOCK_COMMENT | !"*/" ~ ANY)* ~ "*/" }
COMMENT = _{ BLOCK_COMMENT | ("//" ~ (!NEWLINE ~ ANY)*) }