Skip to content

Commit

Permalink
Add ⩶ and ⩵ as unicode synonyms for === and == (#4392)
Browse files Browse the repository at this point in the history
- ⩶  aka U+2A76 THREE CONSECUTIVE EQUALS SIGNS
- ⩵  aka U+2A75 TWO CONSECUTIVE EQUALS SIGNS
  • Loading branch information
lizmat committed Jun 29, 2021
1 parent cf7b4f1 commit eab780f
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Perl6/Grammar.nqp
Expand Up @@ -4159,6 +4159,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
token infix:sym«=~=» { <sym> <O(|%chaining)> }
token infix:sym«» { <sym> <O(|%chaining)> }
token infix:sym«==» { <sym> <O(|%chaining)> }
token infix:sym«» { <sym> <O(|%chaining)> }
token infix:sym«!=» { <sym> <?before \s|']'> <O(|%chaining)> }
token infix:sym«» { <sym> <O(|%chaining)> }
token infix:sym«<=» { <sym> <O(|%chaining)> }
Expand All @@ -4175,6 +4176,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
token infix:sym«gt» { <sym> >> <O(|%chaining)> }
token infix:sym«=:=» { <sym> <O(|%chaining)> }
token infix:sym<===> { <sym> <O(|%chaining)> }
token infix:sym<> { <sym> <O(|%chaining)> }
token infix:sym<eqv> { <sym> >> <O(|%chaining)> }
token infix:sym<before> { <sym> >> <O(|%chaining)> }
token infix:sym<after> { <sym> >> <O(|%chaining)> }
Expand Down
2 changes: 2 additions & 0 deletions src/core.c/Any.pm6
Expand Up @@ -465,6 +465,8 @@ multi sub infix:<===>(\a, \b --> Bool:D) {
&& nqp::iseq_s(nqp::unbox_s(a.WHICH), nqp::unbox_s(b.WHICH)))
)
}
# U+2A76 THREE CONSECUTIVE EQUALS SIGNS
my constant &infix:<> = &infix:<===>;

proto sub prefix:<++>(Mu, *%) {*}
multi sub prefix:<++>(Mu:D $a is rw) { $a = $a.succ }
Expand Down
3 changes: 3 additions & 0 deletions src/core.c/Numeric.pm6
Expand Up @@ -268,6 +268,9 @@ proto sub infix:<==>($?, $?, *%) is pure {*}
multi sub infix:<==>($?) { Bool::True }
multi sub infix:<==>(\a, \b) { a.Numeric == b.Numeric }

# U+2A75 TWO CONSECUTIVE EQUALS SIGNS
my constant &infix:<> = &infix:<==>;

proto sub infix:<=~=>($?, $?, *%) {*} # note, can't be pure due to dynvar
multi sub infix:<=~=>($?) { Bool::True }
multi sub infix:<=~=>(\a, \b, :$tolerance = $*TOLERANCE) {
Expand Down
2 changes: 2 additions & 0 deletions t/02-rakudo/03-corekeys-6c.t
Expand Up @@ -201,7 +201,9 @@ my @expected = (
Q{&infix:</>},
Q{&infix:<=:=>},
Q{&infix:<===>},
Q{&infix:<⩶>},
Q{&infix:<==>},
Q{&infix:<⩵>},
Q{&infix:<=>},
Q{&infix:<=~=>},
Q{&infix:<=~>},
Expand Down
2 changes: 2 additions & 0 deletions t/02-rakudo/03-corekeys-6d.t
Expand Up @@ -201,7 +201,9 @@ my @expected = (
Q{&infix:</>},
Q{&infix:<=:=>},
Q{&infix:<===>},
Q{&infix:<⩶>},
Q{&infix:<==>},
Q{&infix:<⩵>},
Q{&infix:<=>},
Q{&infix:<=~=>},
Q{&infix:<=~>},
Expand Down
2 changes: 2 additions & 0 deletions t/02-rakudo/03-corekeys-6e.t
Expand Up @@ -203,7 +203,9 @@ my @expected = (
Q{&infix:</>},
Q{&infix:<=:=>},
Q{&infix:<===>},
Q{&infix:<⩶>},
Q{&infix:<==>},
Q{&infix:<⩵>},
Q{&infix:<=>},
Q{&infix:<=~=>},
Q{&infix:<=~>},
Expand Down
2 changes: 2 additions & 0 deletions t/02-rakudo/03-corekeys.t
Expand Up @@ -204,7 +204,9 @@ my @allowed =
Q{&infix:</>},
Q{&infix:<=:=>},
Q{&infix:<===>},
Q{&infix:<⩶>},
Q{&infix:<==>},
Q{&infix:<⩵>},
Q{&infix:<=>},
Q{&infix:<=~=>},
Q{&infix:<=~>},
Expand Down
2 changes: 2 additions & 0 deletions t/02-rakudo/04-settingkeys-6c.t
Expand Up @@ -200,7 +200,9 @@ my %allowed = (
Q{&infix:</>},
Q{&infix:<=:=>},
Q{&infix:<===>},
Q{&infix:<⩶>},
Q{&infix:<==>},
Q{&infix:<⩵>},
Q{&infix:<=>},
Q{&infix:<=~=>},
Q{&infix:<=~>},
Expand Down
2 changes: 2 additions & 0 deletions t/02-rakudo/04-settingkeys-6e.t
Expand Up @@ -200,7 +200,9 @@ my %allowed = (
Q{&infix:</>},
Q{&infix:<=:=>},
Q{&infix:<===>},
Q{&infix:<⩶>},
Q{&infix:<==>},
Q{&infix:<⩵>},
Q{&infix:<=>},
Q{&infix:<=~=>},
Q{&infix:<=~>},
Expand Down

0 comments on commit eab780f

Please sign in to comment.