Comments and whitespace

pull/2/head
Mark 2023-08-01 09:44:05 -07:00
parent 47cbd29c27
commit 5d234b9ff6
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
2 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,9 @@
#[derive(Debug)] #[derive(Debug)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub enum Function { pub enum Function {
// When adding a function, don't forget to update help command text.
// It isn't automatically generated.
Abs, Abs,
Floor, Floor,
Ceil, Ceil,

View File

@ -11,13 +11,16 @@ use super::Function;
#[derive(Copy)] #[derive(Copy)]
#[repr(usize)] #[repr(usize)]
pub enum Operator { pub enum Operator {
// When adding operators, don't forget to update help command text.
// It isn't automatically generated.
Define = 0, // Variable and function definition Define = 0, // Variable and function definition
ModuloLong, // Mod invoked with "mod" ModuloLong, // Mod invoked with "mod"
DivideLong, DivideLong, // Division invoked with "per"
UnitConvert, UnitConvert,
Subtract, Subtract,
Add, Add,
Divide, Divide, // Division invoked with "/"
Multiply, Multiply,
Modulo, // Mod invoked with % Modulo, // Mod invoked with %
Negative, Negative,
@ -76,7 +79,7 @@ impl Operator {
"%" => {Some( Operator::Modulo )}, "%" => {Some( Operator::Modulo )},
"mod" => {Some( Operator::ModuloLong )}, "mod" => {Some( Operator::ModuloLong )},
"per" => {Some( Operator::DivideLong )}, "per" => {Some( Operator::DivideLong )},
"to" => {Some( Operator::UnitConvert )}, "to" => {Some( Operator::UnitConvert )},
"^"|"**" => {Some( Operator::Power )}, "^"|"**" => {Some( Operator::Power )},
"!" => {Some( Operator::Factorial )}, "!" => {Some( Operator::Factorial )},
"sqrt"|"rt"|"" => {Some( Operator::Sqrt )}, "sqrt"|"rt"|"" => {Some( Operator::Sqrt )},