diff options
-rw-r--r-- | compiler/parser.nim | 5 | ||||
-rw-r--r-- | tests/parser/twrongcmdsyntax.nim | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index e9dff25ac..fabe4bcc8 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -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) diff --git a/tests/parser/twrongcmdsyntax.nim b/tests/parser/twrongcmdsyntax.nim new file mode 100644 index 000000000..affe72c34 --- /dev/null +++ b/tests/parser/twrongcmdsyntax.nim @@ -0,0 +1,6 @@ +discard """ + errormsg: '''identifier expected, but found 'echo 4''' + line: 6 +""" + +echo 4 +2 |