Reverted my 'do notation' fixes.

This commit is contained in:
Dominik Picheta 2013-01-20 17:34:43 +00:00
commit be51e8b61b
2 changed files with 13 additions and 10 deletions

View file

@ -389,7 +389,7 @@ proc parseGStrLit(p: var TParser, a: PNode): PNode =
else: else:
result = a result = a
proc identOrLiteral(p: var TParser): PNode = proc identOrLiteral(p: var TParser): PNode =
case p.tok.tokType case p.tok.tokType
of tkSymbol: of tkSymbol:
result = newIdentNodeP(p.tok.ident, p) result = newIdentNodeP(p.tok.ident, p)
@ -494,6 +494,12 @@ proc primarySuffix(p: var TParser, r: PNode): PNode =
result = newNodeP(nkCall, p) result = newNodeP(nkCall, p)
addSon(result, a) addSon(result, a)
exprColonEqExprListAux(p, nkExprEqExpr, tkParRi, tkEquals, result) 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: of tkDot:
result = dotExpr(p, result) result = dotExpr(p, result)
result = parseGStrLit(p, result) result = parseGStrLit(p, result)
@ -730,7 +736,7 @@ proc parseProcExpr(p: var TParser, isExpr: bool): PNode =
proc isExprStart(p: TParser): bool = proc isExprStart(p: TParser): bool =
case p.tok.tokType case p.tok.tokType
of tkSymbol, tkAccent, tkOpr, tkNot, tkNil, tkCast, tkIf, of tkSymbol, tkAccent, tkOpr, tkNot, tkNil, tkCast, tkIf,
tkProc, tkDo, tkIterator, tkBind, tkProc, tkIterator, tkBind,
tkParLe, tkBracketLe, tkCurlyLe, tkIntLit..tkCharLit, tkVar, tkRef, tkPtr, tkParLe, tkBracketLe, tkCurlyLe, tkIntLit..tkCharLit, tkVar, tkRef, tkPtr,
tkTuple, tkObject, tkType, tkWhen, tkCase, tkShared: tkTuple, tkObject, tkType, tkWhen, tkCase, tkShared:
result = true result = true
@ -826,8 +832,6 @@ proc primary(p: var TParser, mode: TPrimaryMode): PNode =
getTok(p) getTok(p)
optInd(p, result) optInd(p, result)
addSon(result, primary(p, pmNormal)) addSon(result, primary(p, pmNormal))
of tkDo:
result = parseDoBlock(p)
else: else:
result = identOrLiteral(p) result = identOrLiteral(p)
if mode != pmSkipSuffix: if mode != pmSkipSuffix:
@ -852,7 +856,7 @@ proc parseExprStmt(p: var TParser): PNode =
var call = if a.kind == nkCall: a var call = if a.kind == nkCall: a
else: newNode(nkCommand, a.info, @[a]) else: newNode(nkCommand, a.info, @[a])
while true: while true:
if not isExprStart(p): break if not isExprStart(p): break
var e = parseExpr(p) var e = parseExpr(p)
addSon(call, e) addSon(call, e)
if p.tok.tokType != tkComma: break if p.tok.tokType != tkComma: break
@ -860,7 +864,7 @@ proc parseExprStmt(p: var TParser): PNode =
optInd(p, a) optInd(p, a)
if p.tok.tokType == tkDo: if p.tok.tokType == tkDo:
parseDoBlocks(p, call) parseDoBlocks(p, call)
return call return
result = if call.sonsLen <= 1: a result = if call.sonsLen <= 1: a
else: call else: call
if p.tok.tokType == tkColon: if p.tok.tokType == tkColon:
@ -1548,14 +1552,14 @@ proc parseAll(p: var TParser): PNode =
proc parseTopLevelStmt(p: var TParser): PNode = proc parseTopLevelStmt(p: var TParser): PNode =
result = ast.emptyNode result = ast.emptyNode
while true: while true:
case p.tok.tokType case p.tok.tokType
of tkSad, tkSemicolon: getTok(p) of tkSad, tkSemicolon: getTok(p)
of tkDed, tkInd: of tkDed, tkInd:
parMessage(p, errInvalidIndentation) parMessage(p, errInvalidIndentation)
getTok(p) getTok(p)
of tkEof: break of tkEof: break
else: else:
result = complexOrSimpleStmt(p) result = complexOrSimpleStmt(p)
if result.kind == nkEmpty: parMessage(p, errExprExpected, p.tok) if result.kind == nkEmpty: parMessage(p, errExprExpected, p.tok)
break break

View file

@ -1,6 +1,5 @@
discard """ discard """
file: "tasynciossl.nim" file: "tdomulttest.nim"
cmd: "nimrod cc --hints:on --define:ssl $# $#"
output: "555\ntest\nmulti lines\n99999999\nend" output: "555\ntest\nmulti lines\n99999999\nend"
""" """
proc foo(bar, baz: proc (x: int): int) = proc foo(bar, baz: proc (x: int): int) =