Improved tuple parsing

This commit is contained in:
2023-08-05 09:29:59 -07:00
parent c0b0402a7d
commit fbd984c36e
7 changed files with 116 additions and 51 deletions

View File

@ -15,9 +15,7 @@ use super::Function;
pub enum Operator {
// When adding operators, don't forget to update help command text.
// It isn't automatically generated.
Tuple = 0,
ModuloLong, // Mod invoked with "mod"
ModuloLong = 0, // Mod invoked with "mod"
DivideLong, // Division invoked with "per"
UnitConvert,
Subtract,
@ -76,7 +74,6 @@ impl Operator {
}
return match s {
"," => {Some( Operator::Tuple )},
"+" => {Some( Operator::Add )},
"-" => {Some( Operator::Subtract )},
"neg" => {Some( Operator::Negative )},
@ -155,14 +152,6 @@ impl Operator {
pub fn print(&self, args: &VecDeque<Expression>) -> String {
match self {
Operator::Tuple => {
return format!(
"{}, {}",
self.add_parens_to_arg(&args[0]),
self.add_parens_to_arg(&args[1])
);
},
Operator::Negative => {
return format!("-{}", self.add_parens_to_arg(&args[0]));
},