* fix RFC #341: dot-like operators are now parsed with same precedence as `.` * fixup * [skip ci] address comment in changelog * address comment * update grammmar * add manual entry * fixup * -d:nimPreviewDotLikeOps * address comment to unblock PR: move nimPreviewDotLikeOps out of config/config.nims
This commit is contained in:
parent
3d1bba04ab
commit
3aa16c1de0
7 changed files with 74 additions and 5 deletions
|
|
@ -748,6 +748,7 @@ has the second-lowest precedence.
|
|||
|
||||
Otherwise, precedence is determined by the first character.
|
||||
|
||||
|
||||
================ ======================================================= ================== ===============
|
||||
Precedence level Operators First character Terminal symbol
|
||||
================ ======================================================= ================== ===============
|
||||
|
|
@ -783,6 +784,14 @@ of a call or whether it is parsed as a tuple constructor:
|
|||
.. code-block:: nim
|
||||
echo (1, 2) # pass the tuple (1, 2) to echo
|
||||
|
||||
Dot-like operators
|
||||
------------------
|
||||
|
||||
Terminal symbol in the grammar: `DOTLIKEOP`.
|
||||
|
||||
Dot-like operators are operators starting with `.`, but not with `..`, for e.g. `.?`;
|
||||
they have the same precedence as `.`, so that `a.?b.c` is parsed as `(a.?b).c` instead of `a.?(b.c)`.
|
||||
|
||||
|
||||
Grammar
|
||||
-------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue