diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2013-01-20 17:34:43 +0000 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2013-01-20 17:34:43 +0000 |
commit | be51e8b61b1afbedb1e041b087236787f6e4df81 (patch) | |
tree | ef01be123978c60cf5122d7fa7e79990d808d8e5 | |
parent | b9d75f894401afcbc98081167555715a95e67d43 (diff) | |
download | Nim-be51e8b61b1afbedb1e041b087236787f6e4df81.tar.gz |
Reverted my 'do notation' fixes.
-rwxr-xr-x | compiler/parser.nim | 20 | ||||
-rw-r--r-- | tests/run/tdomulttest.nim | 3 |
2 files changed, 13 insertions, 10 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index e785a7e62..bfc6b3b65 100755 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -389,7 +389,7 @@ proc parseGStrLit(p: var TParser, a: PNode): PNode = else: result = a -proc identOrLiteral(p: var TParser): PNode = +proc identOrLiteral(p: var TParser): PNode = case p.tok.tokType of tkSymbol: result = newIdentNodeP(p.tok.ident, p) @@ -494,6 +494,12 @@ proc primarySuffix(p: var TParser, r: PNode): PNode = result = newNodeP(nkCall, p) addSon(result, a) exprColonEqExprListAux(p, nkExprEqExpr, tkParRi, tkEquals, result) + parseDoBlocks(p, result) + of tkDo: + var a = result + result = newNodeP(nkCall, p) + addSon(result, a) + parseDoBlocks(p, result) of tkDot: result = dotExpr(p, result) result = parseGStrLit(p, result) @@ -730,7 +736,7 @@ proc parseProcExpr(p: var TParser, isExpr: bool): PNode = proc isExprStart(p: TParser): bool = case p.tok.tokType of tkSymbol, tkAccent, tkOpr, tkNot, tkNil, tkCast, tkIf, - tkProc, tkDo, tkIterator, tkBind, + tkProc, tkIterator, tkBind, tkParLe, tkBracketLe, tkCurlyLe, tkIntLit..tkCharLit, tkVar, tkRef, tkPtr, tkTuple, tkObject, tkType, tkWhen, tkCase, tkShared: result = true @@ -826,8 +832,6 @@ proc primary(p: var TParser, mode: TPrimaryMode): PNode = getTok(p) optInd(p, result) addSon(result, primary(p, pmNormal)) - of tkDo: - result = parseDoBlock(p) else: result = identOrLiteral(p) if mode != pmSkipSuffix: @@ -852,7 +856,7 @@ proc parseExprStmt(p: var TParser): PNode = var call = if a.kind == nkCall: a else: newNode(nkCommand, a.info, @[a]) while true: - if not isExprStart(p): break + if not isExprStart(p): break var e = parseExpr(p) addSon(call, e) if p.tok.tokType != tkComma: break @@ -860,7 +864,7 @@ proc parseExprStmt(p: var TParser): PNode = optInd(p, a) if p.tok.tokType == tkDo: parseDoBlocks(p, call) - return call + return result = if call.sonsLen <= 1: a else: call if p.tok.tokType == tkColon: @@ -1548,14 +1552,14 @@ proc parseAll(p: var TParser): PNode = proc parseTopLevelStmt(p: var TParser): PNode = result = ast.emptyNode - while true: + while true: case p.tok.tokType of tkSad, tkSemicolon: getTok(p) of tkDed, tkInd: parMessage(p, errInvalidIndentation) getTok(p) of tkEof: break - else: + else: result = complexOrSimpleStmt(p) if result.kind == nkEmpty: parMessage(p, errExprExpected, p.tok) break diff --git a/tests/run/tdomulttest.nim b/tests/run/tdomulttest.nim index 76ab0963c..6842d38ed 100644 --- a/tests/run/tdomulttest.nim +++ b/tests/run/tdomulttest.nim @@ -1,6 +1,5 @@ discard """ - file: "tasynciossl.nim" - cmd: "nimrod cc --hints:on --define:ssl $# $#" + file: "tdomulttest.nim" output: "555\ntest\nmulti lines\n99999999\nend" """ proc foo(bar, baz: proc (x: int): int) = |