Clean up grammar (#268)
This commit is contained in:
parent
def1bda9ff
commit
659af49231
31
GRAMMAR.md
31
GRAMMAR.md
@ -11,22 +11,29 @@ tokens
|
|||||||
|
|
||||||
```
|
```
|
||||||
BACKTICK = `[^`\n\r]*`
|
BACKTICK = `[^`\n\r]*`
|
||||||
COLON = :
|
|
||||||
COMMENT = #([^!].*)?$
|
COMMENT = #([^!].*)?$
|
||||||
NEWLINE = \n|\r\n
|
DEDENT = emitted when indentation decreases
|
||||||
EQUALS = =
|
EOF = emitted at the end of the file
|
||||||
INTERPOLATION_START = {{
|
INDENT = emitted when indentation increases
|
||||||
INTERPOLATION_END = }}
|
LINE = emitted before a recipe line
|
||||||
NAME = [a-zA-Z_][a-zA-Z0-9_-]*
|
NAME = [a-zA-Z_][a-zA-Z0-9_-]*
|
||||||
PLUS = +
|
NEWLINE = \n|\r\n
|
||||||
RAW_STRING = '[^'\r\n]*'
|
RAW_STRING = '[^'\r\n]*'
|
||||||
STRING = "[^"]*" # also processes \n \r \t \" \\ escapes
|
STRING = "[^"]*" # also processes \n \r \t \" \\ escapes
|
||||||
INDENT = emitted when indentation increases
|
|
||||||
DEDENT = emitted when indentation decreases
|
|
||||||
LINE = emitted before a recipe line
|
|
||||||
TEXT = recipe text, only matches in a recipe body
|
TEXT = 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)
|
||||||
|
```
|
||||||
|
|
||||||
grammar
|
grammar
|
||||||
-------
|
-------
|
||||||
|
|
||||||
@ -45,11 +52,13 @@ assignment : NAME '=' expression eol
|
|||||||
|
|
||||||
export : 'export' assignment
|
export : 'export' assignment
|
||||||
|
|
||||||
expression : STRING
|
expression : value '+' expression
|
||||||
|
| value
|
||||||
|
|
||||||
|
value : STRING
|
||||||
| RAW_STRING
|
| RAW_STRING
|
||||||
| NAME
|
| NAME
|
||||||
| BACKTICK
|
| BACKTICK
|
||||||
| expression '+' expression
|
|
||||||
|
|
||||||
recipe : '@'? NAME parameter* ('+' parameter)? ':' dependencies? body?
|
recipe : '@'? NAME parameter* ('+' parameter)? ':' dependencies? body?
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user