fixes a parser bug
This commit is contained in:
parent
c6a8bd264e
commit
05c20bc4ff
2 changed files with 7 additions and 4 deletions
|
|
@ -1238,9 +1238,6 @@ proc parseExprStmt(p: var TParser): PNode =
|
||||||
addSon(result, e)
|
addSon(result, e)
|
||||||
if p.tok.tokType != tkComma: break
|
if p.tok.tokType != tkComma: break
|
||||||
elif p.tok.indent < 0 and isExprStart(p):
|
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:
|
while true:
|
||||||
var e = parseExpr(p)
|
var e = parseExpr(p)
|
||||||
|
|
|
||||||
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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue