summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2017-04-10 13:06:06 +0300
committerZahary Karadjov <zahary@gmail.com>2017-04-10 13:06:06 +0300
commit8b63b84924ed9de9d8bd3f348eac597e186916a0 (patch)
treea9a3411564258e80dfc056d36c66cbf946103e35 /compiler
parent8cb11aac4f35b6b75e5238a71ede9224c1a5ed05 (diff)
downloadNim-8b63b84924ed9de9d8bd3f348eac597e186916a0.tar.gz
fix a regression in tlexerex
Diffstat (limited to 'compiler')
-rw-r--r--compiler/parser.nim27
1 files changed, 14 insertions, 13 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index d549e1358..8b335efd5 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -1168,19 +1168,20 @@ proc postExprBlocks(p: var TParser, x: PNode): PNode =
     result = makeCall(result)
     getTok(p)
     skipComment(p, result)
-    var stmtList = newNodeP(nkStmtList, p)
-    let body = parseStmt(p)
-    stmtList.add body
-
-    if stmtList.len == 1 and stmtList[0].kind == nkStmtList:
-      # to keep backwards compatibility (see tests/vm/tstringnil)
-      stmtList = stmtList[0]
-
-    if openingParams.kind != nkEmpty:
-      result.add newProcNode(nkDo, stmtList.info, stmtList,
-                             params = openingParams, pragmas = openingPragmas)
-    else:
-      result.add stmtList
+    if p.tok.tokType notin {tkOf, tkElif, tkElse, tkExcept}:
+      var stmtList = newNodeP(nkStmtList, p)
+      let body = parseStmt(p)
+      stmtList.add body
+
+      if stmtList.len == 1 and stmtList[0].kind == nkStmtList:
+        # to keep backwards compatibility (see tests/vm/tstringnil)
+        stmtList = stmtList[0]
+
+      if openingParams.kind != nkEmpty:
+        result.add newProcNode(nkDo, stmtList.info, stmtList,
+                               params = openingParams, pragmas = openingPragmas)
+      else:
+        result.add stmtList
 
     while sameInd(p):
       var nextBlock: PNode