diff options
author | Araq <rumpf_a@web.de> | 2013-06-03 08:05:32 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-06-03 08:05:32 +0200 |
commit | b3ac785f95950791ae342d8973864684c78cc09b (patch) | |
tree | c68ca631ee4ae850c90d51064ee4825fa2930772 /compiler | |
parent | 865a43050d17bef796da956f080913076cf8e866 (diff) | |
download | Nim-b3ac785f95950791ae342d8973864684c78cc09b.tar.gz |
fixes semicolon parsing issue
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/parser.nim | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index 7cfd35a41..46294925d 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -1748,7 +1748,7 @@ proc complexOrSimpleStmt(p: var TParser): PNode = proc parseStmt(p: var TParser): PNode = #| stmt = (IND{>} complexOrSimpleStmt^+(IND{=} / ';') DED) - #| / simpleStmt + #| / simpleStmt ^+ ';' if p.tok.indent > p.currInd: result = newNodeP(nkStmtList, p) withInd(p): @@ -1779,10 +1779,14 @@ proc parseStmt(p: var TParser): PNode = parMessage(p, errComplexStmtRequiresInd) result = ast.emptyNode else: - if p.tok.indent >= 0: parMessage(p, errInvalidIndentation) - result = simpleStmt(p) - if result.kind == nkEmpty: parMessage(p, errExprExpected, p.tok) - #while p.tok.tokType == tkSemicolon: getTok(p) + result = newNodeP(nkStmtList, p) + while true: + if p.tok.indent >= 0: parMessage(p, errInvalidIndentation) + let a = simpleStmt(p) + if a.kind == nkEmpty: parMessage(p, errExprExpected, p.tok) + result.add(a) + if p.tok.tokType != tkSemicolon: break + getTok(p) proc parseAll(p: var TParser): PNode = result = newNodeP(nkStmtList, p) |