mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 12:07:51 +00:00
bugfix: prevent endless loop in the parser for 'nimrod check'
This commit is contained in:
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user