mirror of
https://github.com/rm-dr/daisy
synced 2025-08-02 01:34:50 -07:00
Removed =
operator
This commit is contained in:
@ -13,9 +13,7 @@ use super::Function;
|
||||
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
|
||||
ModuloLong, // Mod invoked with "mod"
|
||||
ModuloLong = 0, // Mod invoked with "mod"
|
||||
DivideLong, // Division invoked with "per"
|
||||
UnitConvert,
|
||||
Subtract,
|
||||
@ -69,7 +67,6 @@ impl Operator {
|
||||
}
|
||||
|
||||
return match s {
|
||||
"=" => {Some( Operator::Define )},
|
||||
"+" => {Some( Operator::Add )},
|
||||
"-" => {Some( Operator::Subtract )},
|
||||
"neg" => {Some( Operator::Negative )},
|
||||
@ -146,14 +143,6 @@ impl Operator {
|
||||
|
||||
pub fn print(&self, args: &VecDeque<Expression>) -> String {
|
||||
match self {
|
||||
Operator::Define => {
|
||||
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]));
|
||||
},
|
||||
|
@ -68,9 +68,8 @@ pub fn tokenize(input: &String) -> VecDeque<Token> {
|
||||
|
||||
for (i, c) in input.chars().enumerate() {
|
||||
match c {
|
||||
// Number
|
||||
// Commas act just like dots.
|
||||
',' | '.' | '0'..='9' => {
|
||||
// Numbers
|
||||
'.' | '0'..='9' => {
|
||||
match &mut t {
|
||||
// If we're already building a number,
|
||||
// append.
|
||||
@ -137,10 +136,10 @@ pub fn tokenize(input: &String) -> VecDeque<Token> {
|
||||
},
|
||||
|
||||
// Operator
|
||||
'^'|'!'|'%'|'\\'|
|
||||
'*'|'×'|'/'|'÷'|
|
||||
'^'|'!'|'%'|'='|
|
||||
'>'|'<'|'?'|'@'|
|
||||
'&'|'|'|'~'|'\\'
|
||||
'&'|'|'|'~'
|
||||
=> {
|
||||
match &mut t {
|
||||
Some(Token::Operator(_, val)) => { val.push(c); },
|
||||
|
Reference in New Issue
Block a user