From c91ca82a43917163f00cf86e59d80a8909dca80a Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 8 Feb 2015 13:37:22 +0100 Subject: [PATCH] fixes #2073; language spec change: arrow like operators are not right associative anymore --- compiler/parser.nim | 4 ++-- doc/manual/syntax.txt | 6 ++---- web/news.txt | 1 + 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/compiler/parser.nim b/compiler/parser.nim index aae0ce7f95..f249b37c84 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -198,8 +198,8 @@ proc isSigilLike(tok: TToken): bool {.inline.} = proc isRightAssociative(tok: TToken): bool {.inline.} = ## Determines whether the token is right assocative. - result = tok.tokType == tkOpr and (tok.ident.s[0] == '^' or - (let L = tok.ident.s.len; L > 1 and tok.ident.s[L-1] == '>')) + result = tok.tokType == tkOpr and tok.ident.s[0] == '^' + # or (let L = tok.ident.s.len; L > 1 and tok.ident.s[L-1] == '>')) proc getPrecedence(tok: TToken, strongSpaces: bool): int = ## Calculates the precedence of the given token. diff --git a/doc/manual/syntax.txt b/doc/manual/syntax.txt index c975e7f480..b40a8ce91c 100644 --- a/doc/manual/syntax.txt +++ b/doc/manual/syntax.txt @@ -12,10 +12,8 @@ Binary operators have 11 different levels of precedence. Associativity ------------- -Binary operators whose first character is ``^`` or its last character -is ``>`` are right-associative, all other binary operators are left-associative. - -Exception: The single "greater than" ``>`` operator is left-associative too. +Binary operators whose first character is ``^`` are right-associative, all +other binary operators are left-associative. Operators ending in ``>`` but longer than a single character are called `arrow like`:idx:. diff --git a/web/news.txt b/web/news.txt index ac7971f208..f765479a29 100644 --- a/web/news.txt +++ b/web/news.txt @@ -20,6 +20,7 @@ News ``addHandler``, ``getHandlers``, ``setLogFilter`` and ``getLogFilter`` should be used instead. - ``nim idetools`` has been replaced by a separate tool `nimsuggest`_. + - *arrow like* operators are not right associative anymore. Language Additions