-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Grant Wuerker
committed
May 9, 2024
1 parent
07e060a
commit f0dfd80
Showing
7 changed files
with
115 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/// Addition (e.g. `x + y`) | ||
pub trait Add<RHS, Out> { | ||
fn add(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Subtraction (e.g. `x - y`) | ||
pub trait Sub<RHS, Out> { | ||
fn sub(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Multiplication (e.g. `x * y`) | ||
pub trait Mul<RHS, Out> { | ||
fn mul(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Division (e.g. `x / y`) | ||
pub trait Div<RHS, Out> { | ||
fn div(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Modulo (e.g. `x % y`) | ||
pub trait Mod<RHS, Out> { | ||
fn mod_(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Exponentiation (e.g. `x ** y`) | ||
pub trait Exp<RHS, Out> { | ||
fn exp(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Left shift (e.g. `x << y`) | ||
pub trait Shl<RHS, Out> { | ||
fn shl(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Right shift (e.g. `x >> y`) | ||
pub trait Shr<RHS, Out> { | ||
fn shr(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Plus (e.g. `+x`) | ||
pub trait Plus<Out> { | ||
fn plus(self) -> Out | ||
} | ||
|
||
/// Minus (e.g. `-x`) | ||
pub trait Minus<Out> { | ||
fn minus(self) -> Out | ||
} | ||
|
||
/// Bitwise and (e.g. `x && y`) | ||
pub trait BitAnd<RHS, Out> { | ||
fn bit_and(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Bitwise or (e.g. `x || y`) | ||
pub trait BitOr<RHS, Out> { | ||
fn bit_or(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Bitwise not (e.g. `~x`) | ||
pub trait BitNot<Out> { | ||
fn bit_or(self) -> Out | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/// Equal (e.g. `x == y`) | ||
pub trait Eq<RHS, Out> { | ||
fn eq(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// `Not equal (e.g. `x != y`) | ||
pub trait NotEq<RHS, Out> { | ||
fn not_eq(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Less than (e.g. `x < y`) | ||
pub trait Lt<RHS, Out> { | ||
fn lt(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Less than or equal (e.g. `x <= y`) | ||
pub trait LtEq<RHS, Out> { | ||
fn lt_eq(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Greater than (e.g. `x > y`) | ||
pub trait Gt<RHS, Out> { | ||
fn gt(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Greater than or equal (e.g. `x >= y`) | ||
pub trait GtEq<RHS, Out> { | ||
fn gt_eq(self, rhs: RHS) -> Out | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// Logical and (e.g. `x && y`) | ||
pub trait And<RHS, Out> { | ||
fn and(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Logical or (e.g. `x || y`) | ||
pub trait Or<RHS, Out> { | ||
fn or(self, rhs: RHS) -> Out | ||
} | ||
|
||
/// Logical not (e.g. `!x`) | ||
pub trait Not<Out> { | ||
fn not(self) -> Out | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// / Overloaded operations of Fe. | ||
// / | ||
// / Each trait in this module corresponds with a syntax opperator. During compilation, | ||
// / these syntax opperators are replaced with calls to the trait methods defiend here. |
Empty file.