mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes a parser bug
This commit is contained in:
@@ -1238,10 +1238,7 @@ proc parseExprStmt(p: var TParser): PNode =
|
||||
addSon(result, e)
|
||||
if p.tok.tokType != tkComma: break
|
||||
elif p.tok.indent < 0 and isExprStart(p):
|
||||
if a.kind == nkCommand:
|
||||
result = a
|
||||
else:
|
||||
result = newNode(nkCommand, a.info, @[a])
|
||||
result = newNode(nkCommand, a.info, @[a])
|
||||
while true:
|
||||
var e = parseExpr(p)
|
||||
addSon(result, e)
|
||||
|
||||
6
tests/parser/twrongcmdsyntax.nim
Normal file
6
tests/parser/twrongcmdsyntax.nim
Normal file
@@ -0,0 +1,6 @@
|
||||
discard """
|
||||
errormsg: '''identifier expected, but found 'echo 4'''
|
||||
line: 6
|
||||
"""
|
||||
|
||||
echo 4 +2
|
||||
Reference in New Issue
Block a user