diff options
author | Zahary Karadjov <zahary@gmail.com> | 2017-07-18 11:50:06 +0300 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-08-19 08:57:43 +0200 |
commit | 7ad115f530942c0fc6718c146ee1a5a97ed61e6f (patch) | |
tree | 200af3aa9257690f92c6c91be478bfbbd17f1e51 /compiler | |
parent | c3e5c6c326747cf0acbe0e4f3d8dc71f9332a76e (diff) | |
download | Nim-7ad115f530942c0fc6718c146ee1a5a97ed61e6f.tar.gz |
Restore the old behavior of parsing "quote do:"
close #5845
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/parser.nim | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index 3cd1e4d92..253716247 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -685,6 +685,11 @@ proc namedParams(p: var TParser, callee: PNode, # progress guaranteed exprColonEqExprListAux(p, endTok, result) +proc commandParam(p: var TParser): PNode = + result = parseExpr(p) + if p.tok.tokType == tkDo: + result = postExprBlocks(p, result) + proc primarySuffix(p: var TParser, r: PNode, baseIndent: int): PNode = #| primarySuffix = '(' (exprColonEqExpr comma?)* ')' doBlocks? #| | doBlocks @@ -733,7 +738,7 @@ proc primarySuffix(p: var TParser, r: PNode, baseIndent: int): PNode = when true: # progress NOT guaranteed p.hasProgress = false - addSon result, parseExpr(p) + addSon result, commandParam(p) if not p.hasProgress: break else: while p.tok.tokType != tkEof: @@ -1253,14 +1258,12 @@ proc parseExprStmt(p: var TParser): PNode = while true: getTok(p) optInd(p, result) - var e = parseExpr(p) - addSon(result, e) + addSon(result, commandParam(p)) if p.tok.tokType != tkComma: break elif p.tok.indent < 0 and isExprStart(p): result = newNode(nkCommand, a.info, @[a]) while true: - var e = parseExpr(p) - addSon(result, e) + addSon(result, commandParam(p)) if p.tok.tokType != tkComma: break getTok(p) optInd(p, result) |