fixes #2073; language spec change: arrow like operators are not right associative anymore
This commit is contained in:
parent
52e297c4e1
commit
c91ca82a43
3 changed files with 5 additions and 6 deletions
|
|
@ -198,8 +198,8 @@ proc isSigilLike(tok: TToken): bool {.inline.} =
|
||||||
|
|
||||||
proc isRightAssociative(tok: TToken): bool {.inline.} =
|
proc isRightAssociative(tok: TToken): bool {.inline.} =
|
||||||
## Determines whether the token is right assocative.
|
## Determines whether the token is right assocative.
|
||||||
result = tok.tokType == tkOpr and (tok.ident.s[0] == '^' or
|
result = tok.tokType == tkOpr and tok.ident.s[0] == '^'
|
||||||
(let L = tok.ident.s.len; L > 1 and tok.ident.s[L-1] == '>'))
|
# or (let L = tok.ident.s.len; L > 1 and tok.ident.s[L-1] == '>'))
|
||||||
|
|
||||||
proc getPrecedence(tok: TToken, strongSpaces: bool): int =
|
proc getPrecedence(tok: TToken, strongSpaces: bool): int =
|
||||||
## Calculates the precedence of the given token.
|
## Calculates the precedence of the given token.
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,8 @@ Binary operators have 11 different levels of precedence.
|
||||||
Associativity
|
Associativity
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Binary operators whose first character is ``^`` or its last character
|
Binary operators whose first character is ``^`` are right-associative, all
|
||||||
is ``>`` are right-associative, all other binary operators are left-associative.
|
other binary operators are left-associative.
|
||||||
|
|
||||||
Exception: The single "greater than" ``>`` operator is left-associative too.
|
|
||||||
|
|
||||||
Operators ending in ``>`` but longer than a single character are
|
Operators ending in ``>`` but longer than a single character are
|
||||||
called `arrow like`:idx:.
|
called `arrow like`:idx:.
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ News
|
||||||
``addHandler``, ``getHandlers``, ``setLogFilter`` and ``getLogFilter``
|
``addHandler``, ``getHandlers``, ``setLogFilter`` and ``getLogFilter``
|
||||||
should be used instead.
|
should be used instead.
|
||||||
- ``nim idetools`` has been replaced by a separate tool `nimsuggest`_.
|
- ``nim idetools`` has been replaced by a separate tool `nimsuggest`_.
|
||||||
|
- *arrow like* operators are not right associative anymore.
|
||||||
|
|
||||||
|
|
||||||
Language Additions
|
Language Additions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue