mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-28 17:41:45 +00:00
lexer: add seven more unicode operators (#26074)
closes nim-lang/RFCs#571 Adds `⟑ ⟇ ⩓ ⩔ ■ □ ☆` with the same priority as `*`. Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
committed by
GitHub
parent
c69cf36610
commit
27763495bc
@@ -14,3 +14,26 @@ var y = 45
|
||||
y *= 9 + 4 * 3
|
||||
|
||||
assert x == y
|
||||
|
||||
proc `⟑`(x, y: int): int = x * y
|
||||
proc `⟇`(x, y: int): int = x * y
|
||||
proc `⩓`(x, y: int): int = x * y
|
||||
proc `⩔`(x, y: int): int = x * y
|
||||
proc `■`(x, y: int): int = x * y
|
||||
proc `□`(x, y: int): int = x * y
|
||||
proc `☆`(x, y: int): int = x * y
|
||||
proc `★`(x, y: int): int = x * y
|
||||
|
||||
assert 2 + 3 ⟑ 4 ⟇ 5 ⩓ 6 ⩔ 7 ■ 8 □ 9 ☆ 10 ★ 11 == 2 + 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11
|
||||
|
||||
proc `⟑=`(x: var int, y: int) = x *= y
|
||||
|
||||
proc `⩓++`(x, y: int): int = x * y
|
||||
|
||||
var z = 45
|
||||
z ⟑= a⩓++4⟑3
|
||||
|
||||
var w = 45
|
||||
w *= 9 * 4 * 3
|
||||
|
||||
assert z == w
|
||||
|
||||
Reference in New Issue
Block a user