justfile 语法
Justfiles 由温和的上下文敏感的标记化器,和深度(往下)递归解析器,处理。语法主要是 LL(1), 尽管多了个额外的前瞻标记,它用于区分,导出任务和带参数配方的。
这里,中文会不太清晰,还是看english吧
标记(token)
BACKTICK = `[^`\n\r]*`COMMENT = #([^!].*)?$DEDENT = emitted when indentation decreasesEOF = emitted at the end of the fileINDENT = emitted when indentation increasesLINE = emitted before a recipe lineNAME = [a-zA-Z_][a-zA-Z0-9_-]*NEWLINE = \n|\r\nRAW_STRING = '[^'\r\n]*'STRING = "[^"]*" # also processes \n \r \t \" \\ escapesTEXT = recipe text, only matches in a recipe body
语言句法(grammar syntax)
| alternation() grouping_? option (0 or 1 times)_* repetition (0 or more times)_+ repetition (1 or more times)
语法
justfile : item* EOFitem : recipe| assignment| export| eoleol : NEWLINE| COMMENT NEWLINEassignment : NAME '=' expression eolexport : 'export' assignmentexpression : value '+' expression| valuevalue : NAME '(' arguments? ')'| STRING| RAW_STRING| BACKTICK| NAMEarguments : expression ',' arguments| expression ','?recipe : '@'? NAME parameter* ('+' parameter)? ':' dependencies? body?parameter : NAME| NAME '=' STRING| NAME '=' RAW_STRINGdependencies : NAME+body : INDENT line+ DEDENTline : LINE (TEXT | interpolation)+ NEWLINE| NEWLINEinterpolation : '{{' expression '}}'
