improvements
General code improvements and optimizations.
This commit is contained in:
@@ -13,7 +13,7 @@ pub use crate::{
|
||||
autocomplete_hashmap::compile_hashmap,
|
||||
parsing::{process_func_str, BackingFunction},
|
||||
suggestions::{
|
||||
generate_hint, get_last_term, split_function, split_function_chars, Hint, HINT_EMPTY,
|
||||
SUPPORTED_FUNCTIONS,
|
||||
generate_hint, get_last_term, split_function, split_function_chars, Hint, SplitType,
|
||||
HINT_EMPTY, SUPPORTED_FUNCTIONS,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -191,5 +191,6 @@ pub fn process_func_str(function_in: &str) -> String {
|
||||
return String::new();
|
||||
}
|
||||
|
||||
crate::suggestions::split_function(&function_in).join("*")
|
||||
crate::suggestions::split_function(&function_in, crate::suggestions::SplitType::Multiplication)
|
||||
.join("*")
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ macro_rules! test_print {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn split_function(input: &str) -> Vec<String> {
|
||||
pub fn split_function(input: &str, split: SplitType) -> Vec<String> {
|
||||
split_function_chars(
|
||||
&input
|
||||
.replace("pi", "π") // replace "pi" text with pi symbol
|
||||
@@ -22,7 +22,7 @@ pub fn split_function(input: &str) -> Vec<String> {
|
||||
.replace("exp", "\u{1fc93}") // stop-gap solution to fix the `exp` function
|
||||
.chars()
|
||||
.collect::<Vec<char>>(),
|
||||
SplitType::Multiplication,
|
||||
split,
|
||||
)
|
||||
.iter()
|
||||
.map(|x| x.replace("\u{1fc93}", "exp")) // Convert back to `exp` text
|
||||
|
||||
Reference in New Issue
Block a user