Allow full commands and blocks in type sections (#19181)

* allow full commands and blocks in type sections
* update grammar
* fix changelog [skip ci]
* more tests
* even more tests
This commit is contained in:
hlaaftana 2022-01-02 09:29:55 +03:00 • committed by GitHub
commit 61d682e733
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 393 additions and 11 deletions

View file

@ -60,7 +60,7 @@ primarySuffix = '(' (exprColonEqExpr comma?)* ')'
| DOTLIKEOP optInd symbol generalizedLit?
| '[' optInd exprColonEqExprList optPar ']'
| '{' optInd exprColonEqExprList optPar '}'
| &( '`'|IDENT|literal|'cast'|'addr'|'type') expr # command syntax
| &( '`'|IDENT|literal|'cast'|'addr'|'type') expr (comma expr)* # command syntax
pragma = '{.' optInd (exprColonEqExpr comma?)* optPar ('.}' | '}')
identVis = symbol OPR? # postfix position
identVisDot = symbol '.' optInd symbol OPR?
@ -93,7 +93,8 @@ primary = operatorB primary primarySuffix* |
('var' | 'out' | 'ref' | 'ptr' | 'distinct') primary
/ prefixOperator* identOrLiteral primarySuffix*
typeDesc = simpleExpr ('not' expr)?
typeDefAux = simpleExpr ('not' expr)?
typeDefAux = simpleExpr ('not' expr
| postExprBlocks)?
postExprBlocks = ':' stmt? ( IND{=} doBlock
| IND{=} 'of' exprList ':' stmt
| IND{=} 'elif' expr ':' stmt