diff options
author | Araq <rumpf_a@web.de> | 2012-10-10 00:59:09 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-10-10 00:59:09 +0200 |
commit | 74acf05e0eea4fcf8911243d44cf8a4a6c3a6d99 (patch) | |
tree | 63732a870379d1102f1b9d63b63adb31409364dc | |
parent | d43febf81e78ac79894ab136717c6100a5492b08 (diff) | |
download | Nim-74acf05e0eea4fcf8911243d44cf8a4a6c3a6d99.tar.gz |
bugfix: prevent endless loop in the parser for 'nimrod check'
-rwxr-xr-x | compiler/parser.nim | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index 095252d59..347c12b13 100755 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -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 = |