summary refs log tree commit diff stats
path: root/compiler/parser.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/parser.nim')
-rw-r--r--compiler/parser.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index be39a6bc1..fe82da594 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -1308,6 +1308,7 @@ proc postExprBlocks(p: var Parser, x: PNode): PNode =
   #|                            | IND{=} 'of' exprList ':' stmt
   #|                            | IND{=} 'elif' expr ':' stmt
   #|                            | IND{=} 'except' exprList ':' stmt
+  #|                            | IND{=} 'finally' ':' stmt
   #|                            | IND{=} 'else' ':' stmt )*
   result = x
   if p.tok.indent >= 0: return
@@ -1362,6 +1363,9 @@ proc postExprBlocks(p: var Parser, x: PNode): PNode =
         of tkExcept:
           nextBlock = newNodeP(nkExceptBranch, p)
           exprList(p, tkColon, nextBlock)
+        of tkFinally:
+          nextBlock = newNodeP(nkFinally, p)
+          getTok(p)
         of tkElse:
           nextBlock = newNodeP(nkElse, p)
           getTok(p)
@@ -1372,7 +1376,7 @@ proc postExprBlocks(p: var Parser, x: PNode): PNode =
       nextBlock.flags.incl nfBlockArg
       result.add nextBlock
 
-      if nextBlock.kind == nkElse: break
+      if nextBlock.kind in {nkElse, nkFinally}: break
   else:
     if openingParams.kind != nkEmpty:
       parMessage(p, "expected ':'")