Merge pull request #2503 from ReneSac/arrowLike

Restrict arrow-like operators to those ending with `->`, `~>` or `=>`
This commit is contained in:
Andreas Rumpf 2015-04-15 19:24:44 +02:00
commit b4e938ca21
4 changed files with 29 additions and 9 deletions

View file

@ -212,7 +212,8 @@ proc getPrecedence(tok: TToken, strongSpaces: bool): int =
let relevantChar = tok.ident.s[0]
# arrow like?
if L > 1 and tok.ident.s[L-1] == '>': return considerStrongSpaces(1)
if L > 1 and tok.ident.s[L-1] == '>' and
tok.ident.s[L-2] in {'-', '~', '='}: return considerStrongSpaces(1)
template considerAsgn(value: expr) =
result = if tok.ident.s[L-1] == '=': 1 else: value