implemented Unicode operators (#18789)
* implemented Unicode operators; refs https://github.com/nim-lang/RFCs/issues/388 * bugfix * better test * arguably more elegant implementation * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
This commit is contained in:
parent
905fae51f6
commit
c2b20516d3
6 changed files with 117 additions and 7 deletions
|
|
@ -700,6 +700,25 @@ contain a dot: `{..}` are the three tokens `{`:tok:, `..`:tok:, `}`:tok:
|
|||
and not the two tokens `{.`:tok:, `.}`:tok:.
|
||||
|
||||
|
||||
Unicode Operators
|
||||
-----------------
|
||||
|
||||
Under the `--experimental:unicodeOperators` switch these Unicode operators are
|
||||
also parsed as operators::
|
||||
|
||||
∙ ∘ × ★ ⊗ ⊘ ⊙ ⊛ ⊠ ⊡ ∩ ∧ ⊓ # same priority as * (multiplication)
|
||||
± ⊕ ⊖ ⊞ ⊟ ∪ ∨ ⊔ # same priority as + (addition)
|
||||
|
||||
|
||||
If enabled, Unicode operators can be combined with non-Unicode operator
|
||||
symbols. The usual precedence extensions then apply, for example, `⊠=` is an
|
||||
assignment like operator just like `*=` is.
|
||||
|
||||
No Unicode normalization step is performed.
|
||||
|
||||
**Note**: Due to parser limitations one **cannot** enable this feature via a
|
||||
pragma `{.experimental: "unicodeOperators".}` reliably.
|
||||
|
||||
|
||||
Syntax
|
||||
======
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue