summary refs log tree commit diff stats
path: root/compiler/parser.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/parser.nim')
-rwxr-xr-xcompiler/parser.nim11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index 095252d59..347c12b13 100755
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -1552,11 +1552,16 @@ proc parseAll(p: var TParser): PNode =
   while true: 
     case p.tok.tokType
     of tkSad: getTok(p)
-    of tkDed, tkInd: parMessage(p, errInvalidIndentation)
-    of tkEof: break 
+    of tkDed, tkInd: 
+      parMessage(p, errInvalidIndentation)
+      getTok(p)
+    of tkEof: break
     else: 
       var a = complexOrSimpleStmt(p)
-      if a.kind == nkEmpty: parMessage(p, errExprExpected, p.tok)
+      if a.kind == nkEmpty: 
+        parMessage(p, errExprExpected, p.tok)
+        # bugfix: consume a token here to prevent an endless loop:
+        getTok(p)
       addSon(result, a)
 
 proc parseTopLevelStmt(p: var TParser): PNode =