Small parser loop fix (#17904)
* Fix loop on error with nim check in semiStmtList * Add test
This commit is contained in:
parent
20248a68fd
commit
76f93877cd
2 changed files with 5 additions and 1 deletions
|
|
@ -556,6 +556,7 @@ proc semiStmtList(p: var Parser, result: PNode) =
|
||||||
let a = complexOrSimpleStmt(p)
|
let a = complexOrSimpleStmt(p)
|
||||||
if a.kind == nkEmpty:
|
if a.kind == nkEmpty:
|
||||||
parMessage(p, errExprExpected, p.tok)
|
parMessage(p, errExprExpected, p.tok)
|
||||||
|
getTok(p)
|
||||||
else:
|
else:
|
||||||
result.add a
|
result.add a
|
||||||
dec p.inSemiStmtList
|
dec p.inSemiStmtList
|
||||||
|
|
|
||||||
|
|
@ -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(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(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(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
|
# line 20
|
||||||
block:
|
block:
|
||||||
proc fn1()
|
proc fn1()
|
||||||
|
|
@ -56,3 +56,6 @@ block:
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
discard
|
discard
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
# semiStmtList loop issue
|
||||||
|
proc bar(k:static bool):SomeNumber = (when k: 3, else: 3.0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue