This commit is contained in:
Andreas Rumpf 2016-07-15 15:40:26 +02:00
commit 11b499f3ca
2 changed files with 23 additions and 4 deletions

View file

@ -686,11 +686,19 @@ proc primarySuffix(p: var TParser, r: PNode, baseIndent: int): PNode =
#| | '{' optInd indexExprList optPar '}'
#| | &( '`'|IDENT|literal|'cast'|'addr'|'type') expr # command syntax
result = r
template somePar() =
if p.tok.strongSpaceA > 0:
if p.strongSpaces:
break
else:
parMessage(p, warnDeprecated,
"a [b] will be parsed as command syntax; spacing")
while p.tok.indent < 0 or
(p.tok.tokType == tkDot and p.tok.indent >= baseIndent):
case p.tok.tokType
of tkParLe:
if p.strongSpaces and p.tok.strongSpaceA > 0: break
somePar()
result = namedParams(p, result, nkCall, tkParRi)
if result.len > 1 and result.sons[1].kind == nkExprColonExpr:
result.kind = nkObjConstr
@ -705,10 +713,10 @@ proc primarySuffix(p: var TParser, r: PNode, baseIndent: int): PNode =
result = dotExpr(p, result)
result = parseGStrLit(p, result)
of tkBracketLe:
if p.strongSpaces and p.tok.strongSpaceA > 0: break
somePar()
result = namedParams(p, result, nkBracketExpr, tkBracketRi)
of tkCurlyLe:
if p.strongSpaces and p.tok.strongSpaceA > 0: break
somePar()
result = namedParams(p, result, nkCurlyExpr, tkCurlyRi)
of tkSymbol, tkAccent, tkIntLit..tkCharLit, tkNil, tkCast, tkAddr, tkType:
if p.inPragma == 0: