Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small parser loop fix #17904

Merged
merged 2 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/parser.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion tests/parser/t15667.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 ','
'''
"""

Expand All @@ -16,7 +17,6 @@ t15667.nim(56, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.n




# line 20
block:
proc fn1()
Expand Down Expand Up @@ -56,3 +56,6 @@ block:
runnableExamples:
discard
discard

# semiStmtList loop issue
proc bar(k:static bool):SomeNumber = (when k: 3, else: 3.0)