diff options
author | Clyybber <darkmine956@gmail.com> | 2021-04-30 17:17:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-30 17:17:29 +0200 |
commit | 76f93877cdb2a2baf28eed6edda5bcc96f4ef404 (patch) | |
tree | 46f4e6347f82f2fc1c10e844d5946882f9b50cfa | |
parent | 20248a68fd867ce64822698b316f1a8b6300d7ca (diff) | |
download | Nim-76f93877cdb2a2baf28eed6edda5bcc96f4ef404.tar.gz |
Small parser loop fix (#17904)
* Fix loop on error with nim check in semiStmtList * Add test
-rw-r--r-- | compiler/parser.nim | 1 | ||||
-rw-r--r-- | tests/parser/t15667.nim | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index fd9d06de5..9cddf8e4f 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -556,6 +556,7 @@ proc semiStmtList(p: var Parser, result: PNode) = let a = complexOrSimpleStmt(p) if a.kind == nkEmpty: parMessage(p, errExprExpected, p.tok) + getTok(p) else: result.add a dec p.inSemiStmtList diff --git a/tests/parser/t15667.nim b/tests/parser/t15667.nim index d15178789..fcb862825 100644 --- a/tests/parser/t15667.nim +++ b/tests/parser/t15667.nim @@ -7,6 +7,7 @@ t15667.nim(28, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.n t15667.nim(33, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.nim(31, 25) ? t15667.nim(42, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.nim(38, 12) ? t15667.nim(56, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.nim(55, 13) ? +t15667.nim(61, 48) Error: expression expected, but found ',' ''' """ @@ -16,7 +17,6 @@ t15667.nim(56, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.n - # line 20 block: proc fn1() @@ -56,3 +56,6 @@ block: runnableExamples: discard discard + +# semiStmtList loop issue +proc bar(k:static bool):SomeNumber = (when k: 3, else: 3.0) |