more intuitive behaviour for 'discardable' in expression bodies
This commit is contained in:
parent
af441e607f
commit
f8af7ed6b4
6 changed files with 99 additions and 22 deletions
|
|
@ -35,7 +35,14 @@ qualifiedIdent = symbol ('.' optInd ('type' | 'addr' | symbol))?
|
|||
exprColonEqExprList = exprColonEqExpr (comma exprColonEqExpr)* (comma)?
|
||||
setOrTableConstr = '{' ((exprColonEqExpr comma)* | ':' ) '}'
|
||||
castExpr = 'cast' '[' optInd typeDesc optPar ']' '(' optInd expr optPar ')'
|
||||
generalizedLit ::= GENERALIZED_STR_LIT | GENERALIZED_TRIPLESTR_LIT
|
||||
parKeyw = 'discard' | 'include' | 'if' | 'while' | 'case' | 'try'
|
||||
| 'finally' | 'except' | 'for' | 'block' | 'const' | 'let'
|
||||
| 'when' | 'var' | 'mixin'
|
||||
par = '(' optInd (&parKeyw complexOrSimpleStmt ^+ ';'
|
||||
| simpleExpr ('=' expr (';' complexOrSimpleStmt ^+ ';' )? )?
|
||||
| (':' expr)? (',' (exprColonEqExpr comma?)*)? )?
|
||||
optPar ')'
|
||||
generalizedLit = GENERALIZED_STR_LIT | GENERALIZED_TRIPLESTR_LIT
|
||||
identOrLiteral = generalizedLit | symbol
|
||||
| INT_LIT | INT8_LIT | INT16_LIT | INT32_LIT | INT64_LIT
|
||||
| UINT_LIT | UINT8_LIT | UINT16_LIT | UINT32_LIT | UINT64_LIT
|
||||
|
|
@ -43,7 +50,7 @@ identOrLiteral = generalizedLit | symbol
|
|||
| STR_LIT | RSTR_LIT | TRIPLESTR_LIT
|
||||
| CHAR_LIT
|
||||
| NIL
|
||||
| tupleConstr | arrayConstr | setOrTableConstr
|
||||
| par | arrayConstr | setOrTableConstr
|
||||
| castExpr
|
||||
tupleConstr = '(' optInd (exprColonEqExpr comma?)* optPar ')'
|
||||
arrayConstr = '[' optInd (exprColonEqExpr comma?)* optPar ']'
|
||||
|
|
@ -76,7 +83,8 @@ doBlocks = doBlock ^* IND{=}
|
|||
procExpr = 'proc' paramListColon pragmas? ('=' COMMENT? stmt)?
|
||||
expr = (ifExpr
|
||||
| whenExpr
|
||||
| caseExpr)
|
||||
| caseExpr
|
||||
| tryStmt)
|
||||
/ simpleExpr
|
||||
typeKeyw = 'var' | 'ref' | 'ptr' | 'shared' | 'type' | 'tuple'
|
||||
| 'proc' | 'iterator' | 'distinct' | 'object' | 'enum'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue