make binary not not parse complex expressions on right side (#22078)

* binary `not` only parses simple expressions

fixes #16324

* switch to primary
This commit is contained in:
metagn
2023-06-12 07:22:50 +03:00
committed by GitHub
parent 7b1c448744
commit e0ad71a912
3 changed files with 25 additions and 7 deletions

View File

@@ -104,13 +104,13 @@ primary = simplePrimary (commandStart expr (doBlock extraPostExprBlock*)?)?
/ prefixOperator primary
rawTypeDesc = (tupleType | routineType | 'enum' | 'object' |
('var' | 'out' | 'ref' | 'ptr' | 'distinct') typeDesc?)
('not' expr)?
typeDescExpr = (routineType / simpleExpr) ('not' expr)?
('not' primary)?
typeDescExpr = (routineType / simpleExpr) ('not' primary)?
typeDesc = rawTypeDesc / typeDescExpr
typeDefValue = ((tupleDecl | enumDecl | objectDecl | conceptDecl |
('ref' | 'ptr' | 'distinct') (tupleDecl | objectDecl))
/ (simpleExpr (exprEqExpr ^+ comma postExprBlocks?)?))
('not' expr)?
('not' primary)?
extraPostExprBlock = ( IND{=} doBlock
| IND{=} 'of' exprList ':' stmt
| IND{=} 'elif' expr ':' stmt