diff options
-rw-r--r-- | doc/grammar.txt | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/doc/grammar.txt b/doc/grammar.txt index d92f1dc..4df88d7 100644 --- a/doc/grammar.txt +++ b/doc/grammar.txt @@ -16,7 +16,7 @@ constant := [ COMMENT ] block := "{" command* "}" -command := block | statement | control +command := block | statement control := if | for @@ -24,8 +24,6 @@ statement := ( return | break | continue | declaration - | assignment - | call | defer ) ";" if := "if" expression block elseif* else* @@ -42,11 +40,11 @@ continue := "continue" ":" NAME declaration := "let" [ "mut" ] NAME "=" expression ";" assignment := location "=" expression ";" -location := NAME ( index | field )* [ "*" ] +location := path ( index | field )* [ "*" ] index := "[" expression "]" field := "." NAME -call := path "(" ( expression ), ")" +call := location "(" ( expression ), ")" defer := "defer" call @@ -81,7 +79,8 @@ bitsummand := bitfactor ( "^" | bitfactor )* bitfactor := unaryprefix ( "&" unaryprefix )* unaryprefix := [ "-" | "!" | "~" ] unarypostfix unarypostfix := primary [ "*" | "?" | "!" ] -primary := grouping | literal | call | path +primary := control | grouping | literal | named +named := assignment | call | location grouping := "(" expression ")" literal := bool | string | number | arrayelems bool := "true" | "false" |