diff options
Diffstat (limited to 'compiler/parser.nim')
-rw-r--r-- | compiler/parser.nim | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index a91760e15..ff620b5fb 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -505,7 +505,7 @@ proc parsePar(p: var TParser): PNode = getTok(p) optInd(p, result) if p.tok.tokType in {tkDiscard, tkInclude, tkIf, tkWhile, tkCase, - tkTry, tkFinally, tkExcept, tkFor, tkBlock, + tkTry, tkDefer, tkFinally, tkExcept, tkFor, tkBlock, tkConst, tkLet, tkWhen, tkVar, tkMixin}: # XXX 'bind' used to be an expression, so we exclude it here; @@ -1980,15 +1980,17 @@ proc parseTopLevelStmt(p: var TParser): PNode = ## top-level statement or emptyNode if end of stream. result = ast.emptyNode while true: - if p.tok.indent != 0: + if p.tok.indent != 0: if p.firstTok and p.tok.indent < 0: discard - else: parMessage(p, errInvalidIndentation) + elif p.tok.tokType != tkSemiColon: + parMessage(p, errInvalidIndentation) p.firstTok = false case p.tok.tokType of tkSemiColon: getTok(p) if p.tok.indent <= 0: discard else: parMessage(p, errInvalidIndentation) + p.firstTok = true of tkEof: break else: result = complexOrSimpleStmt(p) |