parser/grammar sync; fixes #9608 [backport]

This commit is contained in:
Andreas Rumpf 2018-11-07 20:07:20 +01:00
commit 4e94f49065
2 changed files with 6 additions and 5 deletions

View file

@ -282,7 +282,7 @@ proc checkBinary(p: TParser) {.inline.} =
#| #|
#| prefixOperator = operator #| prefixOperator = operator
#| #|
#| optInd = COMMENT? #| optInd = COMMENT? IND?
#| optPar = (IND{>} | IND{=})? #| optPar = (IND{>} | IND{=})?
#| #|
#| simpleExpr = arrowExpr (OP0 optInd arrowExpr)* pragma? #| simpleExpr = arrowExpr (OP0 optInd arrowExpr)* pragma?

View file

@ -9,7 +9,7 @@ operator = OP0 | OP1 | OP2 | OP3 | OP4 | OP5 | OP6 | OP7 | OP8 | OP9
| 'is' | 'isnot' | 'in' | 'notin' | 'of' | 'is' | 'isnot' | 'in' | 'notin' | 'of'
| 'div' | 'mod' | 'shl' | 'shr' | 'not' | 'static' | '..' | 'div' | 'mod' | 'shl' | 'shr' | 'not' | 'static' | '..'
prefixOperator = operator prefixOperator = operator
optInd = COMMENT? optInd = COMMENT? IND?
optPar = (IND{>} | IND{=})? optPar = (IND{>} | IND{=})?
simpleExpr = arrowExpr (OP0 optInd arrowExpr)* pragma? simpleExpr = arrowExpr (OP0 optInd arrowExpr)* pragma?
arrowExpr = assignExpr (OP1 optInd assignExpr)* arrowExpr = assignExpr (OP1 optInd assignExpr)*
@ -85,17 +85,19 @@ paramListColon = paramList? (':' optInd typeDesc)?
doBlock = 'do' paramListArrow pragmas? colcom stmt doBlock = 'do' paramListArrow pragmas? colcom stmt
procExpr = 'proc' paramListColon pragmas? ('=' COMMENT? stmt)? procExpr = 'proc' paramListColon pragmas? ('=' COMMENT? stmt)?
distinct = 'distinct' optInd typeDesc distinct = 'distinct' optInd typeDesc
forStmt = 'for' (identWithPragma ^+ comma) 'in' expr colcom stmt
forExpr = forStmt
expr = (blockExpr expr = (blockExpr
| ifExpr | ifExpr
| whenExpr | whenExpr
| caseExpr | caseExpr
| forExpr
| tryExpr) | tryExpr)
/ simpleExpr / simpleExpr
typeKeyw = 'var' | 'out' | 'ref' | 'ptr' | 'shared' | 'tuple' typeKeyw = 'var' | 'out' | 'ref' | 'ptr' | 'shared' | 'tuple'
| 'proc' | 'iterator' | 'distinct' | 'object' | 'enum' | 'proc' | 'iterator' | 'distinct' | 'object' | 'enum'
primary = typeKeyw typeDescK primary = typeKeyw typeDescK
/ prefixOperator* identOrLiteral primarySuffix* / prefixOperator* identOrLiteral primarySuffix*
/ 'static' primary
/ 'bind' primary / 'bind' primary
typeDesc = simpleExpr typeDesc = simpleExpr
typeDefAux = simpleExpr typeDefAux = simpleExpr
@ -142,12 +144,11 @@ tryExpr = 'try' colcom stmt &(optInd 'except'|'finally')
(optInd 'except' exprList colcom stmt)* (optInd 'except' exprList colcom stmt)*
(optInd 'finally' colcom stmt)? (optInd 'finally' colcom stmt)?
exceptBlock = 'except' colcom stmt exceptBlock = 'except' colcom stmt
forStmt = 'for' (identWithPragma ^+ comma) 'in' expr colcom stmt
blockStmt = 'block' symbol? colcom stmt blockStmt = 'block' symbol? colcom stmt
blockExpr = 'block' symbol? colcom stmt blockExpr = 'block' symbol? colcom stmt
staticStmt = 'static' colcom stmt staticStmt = 'static' colcom stmt
deferStmt = 'defer' colcom stmt deferStmt = 'defer' colcom stmt
asmStmt = 'asm' pragma? (STR_LIT | RSTR_LIT | TRIPLE_STR_LIT) asmStmt = 'asm' pragma? (STR_LIT | RSTR_LIT | TRIPLESTR_LIT)
genericParam = symbol (comma symbol)* (colon expr)? ('=' optInd expr)? genericParam = symbol (comma symbol)* (colon expr)? ('=' optInd expr)?
genericParamList = '[' optInd genericParamList = '[' optInd
genericParam ^* (comma/semicolon) optPar ']' genericParam ^* (comma/semicolon) optPar ']'