bugfix: prevent endless loop in the parser for 'nimrod check'

This commit is contained in:
Araq
2012-10-10 00:59:09 +02:00
parent d43febf81e
commit 74acf05e0e

View File

@@ -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 =