Block expressions (#6695)

* enabled parsing of block expressions
* added test case; closes #3827
* adjusted grammar doc strings
* updated grammar in docs
This commit is contained in:
Fabian Keller 2017-11-06 20:33:01 +01:00 • committed by Andreas Rumpf
commit 40a6caeed8
3 changed files with 18 additions and 3 deletions

View file

@ -83,7 +83,8 @@ paramListColon = paramList? (':' optInd typeDesc)?
doBlock = 'do' paramListArrow pragmas? colcom stmt
procExpr = 'proc' paramListColon pragmas? ('=' COMMENT? stmt)?
distinct = 'distinct' optInd typeDesc
expr = (ifExpr
expr = (blockExpr
| ifExpr
| whenExpr
| caseExpr
| tryExpr)
@ -141,6 +142,7 @@ tryExpr = 'try' colcom stmt &(optInd 'except'|'finally')
exceptBlock = 'except' colcom stmt
forStmt = 'for' (identWithPragma ^+ comma) 'in' expr colcom stmt
blockStmt = 'block' symbol? colcom stmt
blockExpr = 'block' symbol? colcom stmt
staticStmt = 'static' colcom stmt
deferStmt = 'defer' colcom stmt
asmStmt = 'asm' pragma? (STR_LIT | RSTR_LIT | TRIPLE_STR_LIT)