summary refs log tree commit diff stats
path: root/compiler/parser.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-07-12 08:17:22 +0200
committerAraq <rumpf_a@web.de>2012-07-12 08:17:22 +0200
commit94013a4cff5c19ecef2dbd7a7bdcb9811c5cce4d (patch)
tree3ae9d775ae6fc8ae29f4ddd2c64984c83b7a2bec /compiler/parser.nim
parenteee99ab2725562195e7324cf8ccc521a15a0611e (diff)
downloadNim-94013a4cff5c19ecef2dbd7a7bdcb9811c5cce4d.tar.gz
';' as statement separator
Diffstat (limited to 'compiler/parser.nim')
-rwxr-xr-xcompiler/parser.nim13
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index e65503b2c..26ffaf59c 100755
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -1481,7 +1481,7 @@ proc parseStmt(p: var TParser): PNode =
     getTok(p)
     while true: 
       case p.tok.tokType
-      of tkSad: getTok(p)
+      of tkSad, tkSemicolon: getTok(p)
       of tkEof: break 
       of tkDed: 
         getTok(p)
@@ -1494,16 +1494,17 @@ proc parseStmt(p: var TParser): PNode =
           break 
         addSon(result, a)
     popInd(p.lex)
-  else: 
+  else:
     # the case statement is only needed for better error messages:
     case p.tok.tokType
-    of tkIf, tkWhile, tkCase, tkTry, tkFor, tkBlock, tkAsm, tkProc, tkIterator, 
-       tkMacro, tkType, tkConst, tkWhen, tkVar: 
+    of tkIf, tkWhile, tkCase, tkTry, tkFor, tkBlock, tkAsm, tkProc, tkIterator,
+       tkMacro, tkType, tkConst, tkWhen, tkVar:
       parMessage(p, errComplexStmtRequiresInd)
       result = ast.emptyNode
-    else: 
+    else:
       result = simpleStmt(p)
       if result.kind == nkEmpty: parMessage(p, errExprExpected, p.tok)
+      if p.tok.tokType == tkSemicolon: getTok(p)
       if p.tok.tokType == tkSad: getTok(p)
   
 proc parseAll(p: var TParser): PNode = 
@@ -1522,7 +1523,7 @@ proc parseTopLevelStmt(p: var TParser): PNode =
   result = ast.emptyNode
   while true: 
     case p.tok.tokType
-    of tkSad: getTok(p)
+    of tkSad, tkSemicolon: getTok(p)
     of tkDed, tkInd: 
       parMessage(p, errInvalidIndentation)
       getTok(p)