Revert "allow keyword params for the [] and {} operators"
This reverts commit bfff1ac8b2.
This commit is contained in:
parent
0662ec4a43
commit
b7ea4a7e65
1 changed files with 8 additions and 12 deletions
|
|
@ -627,13 +627,6 @@ proc identOrLiteral(p: var TParser, mode: TPrimaryMode): PNode =
|
||||||
getTok(p) # we must consume a token here to prevend endless loops!
|
getTok(p) # we must consume a token here to prevend endless loops!
|
||||||
result = ast.emptyNode
|
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 =
|
proc primarySuffix(p: var TParser, r: PNode): PNode =
|
||||||
#| primarySuffix = '(' (exprColonEqExpr comma?)* ')' doBlocks?
|
#| primarySuffix = '(' (exprColonEqExpr comma?)* ')' doBlocks?
|
||||||
#| | doBlocks
|
#| | doBlocks
|
||||||
|
|
@ -643,8 +636,11 @@ proc primarySuffix(p: var TParser, r: PNode): PNode =
|
||||||
result = r
|
result = r
|
||||||
while p.tok.indent < 0:
|
while p.tok.indent < 0:
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
of tkParLe:
|
of tkParLe:
|
||||||
result = namedParams(p, result, nkCall, tkParRi)
|
var a = result
|
||||||
|
result = newNodeP(nkCall, p)
|
||||||
|
addSon(result, a)
|
||||||
|
exprColonEqExprListAux(p, tkParRi, result)
|
||||||
if result.len > 1 and result.sons[1].kind == nkExprColonExpr:
|
if result.len > 1 and result.sons[1].kind == nkExprColonExpr:
|
||||||
result.kind = nkObjConstr
|
result.kind = nkObjConstr
|
||||||
else:
|
else:
|
||||||
|
|
@ -657,10 +653,10 @@ proc primarySuffix(p: var TParser, r: PNode): PNode =
|
||||||
of tkDot:
|
of tkDot:
|
||||||
result = dotExpr(p, result)
|
result = dotExpr(p, result)
|
||||||
result = parseGStrLit(p, result)
|
result = parseGStrLit(p, result)
|
||||||
of tkBracketLe:
|
of tkBracketLe:
|
||||||
result = namedParams(p, result, nkBracketExpr, tkBracketRi)
|
result = indexExprList(p, result, nkBracketExpr, tkBracketRi)
|
||||||
of tkCurlyLe:
|
of tkCurlyLe:
|
||||||
result = namedParams(p, result, nkCurlyExpr, tkCurlyRi)
|
result = indexExprList(p, result, nkCurlyExpr, tkCurlyRi)
|
||||||
else: break
|
else: break
|
||||||
|
|
||||||
proc primary(p: var TParser, mode: TPrimaryMode): PNode
|
proc primary(p: var TParser, mode: TPrimaryMode): PNode
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue