Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add boolean bitwise operators ?|, ?&, and ?^.
  • Loading branch information
colomon committed Feb 4, 2010
1 parent 1516520 commit 17dd439
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Perl6/Grammar.pm
Expand Up @@ -999,6 +999,7 @@ token infix:sym<div> { <sym> <O('%multiplicative')> }
token infix:sym<%> { <sym> <O('%multiplicative')> }
token infix:sym<+&> { <sym> <O('%multiplicative')> }
token infix:sym<~&> { <sym> <O('%multiplicative')> }
token infix:sym<?&> { <sym> <O('%multiplicative')> }

token infix:sym<+> { <sym> <O('%additive')> }
token infix:sym<-> { <sym> <![>]> <O('%additive')> }
Expand All @@ -1008,6 +1009,8 @@ token infix:sym<~|> { <sym> <O('%additive')> }
token infix:sym<~^> { <sym> <O('%additive')> }
token infix:sym«+<» { <sym> <O('%additive')> }
token infix:sym«+>» { <sym> <O('%additive')> }
token infix:sym<?|> { <sym> <O('%additive')> }
token infix:sym<?^> { <sym> <O('%additive')> }

token infix:sym<x> { <sym> <O('%replication')> }
token infix:sym<xx> { <sym> <O('%replication')> }
Expand Down
12 changes: 12 additions & 0 deletions src/core/operators.pm
Expand Up @@ -98,3 +98,15 @@ our multi infix:<before>($a, $b) {
our multi infix:<after>($a, $b) {
($a cmp $b) == +1;
}

our multi infix:<?|>($a, $b) {
?pir::bor__III($a, $b)
}

our multi infix:<?&>($a, $b) {
?pir::band__III($a, $b)
}

our multi infix:<?^>($a, $b) {
?pir::bxor__III($a, $b)
}

0 comments on commit 17dd439

Please sign in to comment.