diff options
author | Araq <rumpf_a@web.de> | 2013-05-27 23:19:11 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-05-27 23:19:11 +0200 |
commit | b7ea4a7e65ddf10bf3e425e59bc57e9f9c57e916 (patch) | |
tree | f639c5ac55585eef78e2b6f0ca4116e6938c0a14 /compiler | |
parent | 0662ec4a434f4656b5afc486bc4ebaab82c52da6 (diff) | |
download | Nim-b7ea4a7e65ddf10bf3e425e59bc57e9f9c57e916.tar.gz |
Revert "allow keyword params for the `[]` and `{}` operators"
This reverts commit bfff1ac8b2435595351194f6c4b1268d38301401.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/parser.nim | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index e400f4bb5..7cfd35a41 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -627,13 +627,6 @@ proc identOrLiteral(p: var TParser, mode: TPrimaryMode): PNode = getTok(p) # we must consume a token here to prevend endless loops! result = ast.emptyNode -proc namedParams(p: var TParser, callee: PNode, - kind: TNodeKind, endTok: TTokType): PNode = - let a = callee - result = newNodeP(kind, p) - addSon(result, a) - exprColonEqExprListAux(p, endTok, result) - proc primarySuffix(p: var TParser, r: PNode): PNode = #| primarySuffix = '(' (exprColonEqExpr comma?)* ')' doBlocks? #| | doBlocks @@ -643,8 +636,11 @@ proc primarySuffix(p: var TParser, r: PNode): PNode = result = r while p.tok.indent < 0: case p.tok.tokType - of tkParLe: - result = namedParams(p, result, nkCall, tkParRi) + of tkParLe: + var a = result + result = newNodeP(nkCall, p) + addSon(result, a) + exprColonEqExprListAux(p, tkParRi, result) if result.len > 1 and result.sons[1].kind == nkExprColonExpr: result.kind = nkObjConstr else: @@ -657,10 +653,10 @@ proc primarySuffix(p: var TParser, r: PNode): PNode = of tkDot: result = dotExpr(p, result) result = parseGStrLit(p, result) - of tkBracketLe: - result = namedParams(p, result, nkBracketExpr, tkBracketRi) + of tkBracketLe: + result = indexExprList(p, result, nkBracketExpr, tkBracketRi) of tkCurlyLe: - result = namedParams(p, result, nkCurlyExpr, tkCurlyRi) + result = indexExprList(p, result, nkCurlyExpr, tkCurlyRi) else: break proc primary(p: var TParser, mode: TPrimaryMode): PNode |