This repository was archived by the owner on Jul 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Pipe Script 文法
许兴逸 edited this page Oct 27, 2021
·
2 revisions
PipeScript是用于描述Pipe构建任务的脚本语言。
digit = '0' | '1' ... | '9'
alpha = 'a' | 'b' .. | 'z' | 'A' | 'B' .. | 'Z'
identifier = ('-' | '_' | alpha) { alpha | digit | '-' | '_' | '.' }
variable = '%' identifier '%'
bool = 'true' | 'false'
int = [ '-' ] digit { digit }
number = [ '-' ] digit { digit } '.' { digit }
strChar = any except '\' and '"' | '\r' | '\n' | '\\' | '\"' | '\''
stringConstant = '"' { strChar } '"'
comment = '#' { any }
whitespace = ' ' | '\t'
ws0 = { whitespace }
ws1 = whitespace { whitespace }
lineEnd = ws0 [comment] ( '\n' | '\r' | '\r\n' )
whitespaceOrLineEnd = whitespace | lineEnd
wsle0 = { whitespaceOrLineEnd }
wsle1 = whitespaceOrLineEnd wsle0
atomic = number | bool | stringConstant | int | variable | identifier
listExpr = '[' wsle0 exprList wsle0 ']'
applyExpr = exprList
wexpr = '(' wsle0 expr wsle0 ')' | atomic | listExpr
exprList = wexpr { wsle1 wexpr }
expr = applyExpr | atomic | Wexpr | listExpr
exprStat = expr
statBlock = '{' wsle0 stats wsle0 '}'
ifStat =
'if' wsle1 expr wsle0 statBlock
{ wsle0 'else' wsle1 'if' wsle1 expr wsle0 statBlock }
[ wsle0 'else' wsle0 statBlock ]
forStat =
'for' wsle1 varaible wsle1 'in' wsle1 expr wsle0 statBlock
stat = forStat | ifStat | exprStat
stats = wsle0 [stat { wsle1 stats }]
include = '-' ws1 'include' ws0 stringConstant
platformSet = identifier | ('{' ws0 [identifier { ws0 ',' ws0 identifier }] '}')
platformFilter = [ 'for' ws0 platformSet ] ws0 [ 'to' ws0 platformSet ]
blocks =
'-' ws1 ('task' | 'action' | 'before' ws1 'action' | 'after' ws1 'action' | 'operation') ws1
identifier { ws1 variable } platformFilter ws1 stats
pipeScript = { wsle0 blocks wsle0 } eof