From 8b63b84924ed9de9d8bd3f348eac597e186916a0 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Mon, 10 Apr 2017 13:06:06 +0300 Subject: fix a regression in tlexerex --- compiler/parser.nim | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'compiler/parser.nim') 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 -- cgit 1.4.1-2-gfad0