multiline comment
This commit is contained in:
parent
2613eb426c
commit
4ceb052b46
@ -3,9 +3,11 @@ use wasm_bindgen::prelude::*;
|
|||||||
|
|
||||||
pub type DrawResult<T> = Result<T, Box<dyn std::error::Error>>;
|
pub type DrawResult<T> = Result<T, Box<dyn std::error::Error>>;
|
||||||
|
|
||||||
// EXTREMELY Janky function that tries to put asterisks in the proper places to be parsed. This is so cursed. But it works, and I hopefully won't ever have to touch it again.
|
/*
|
||||||
// One limitation though, variables with multiple characters like `pi` cannot be multiplied (like `pipipipi` won't result in `pi*pi*pi*pi`). But that's such a niche use case (and that same thing could be done by using exponents) that it doesn't really matter.
|
EXTREMELY Janky function that tries to put asterisks in the proper places to be parsed. This is so cursed. But it works, and I hopefully won't ever have to touch it again.
|
||||||
// In the future I may want to completely rewrite this or implement this natively into mevel-rs (which would probably be good to do)
|
One limitation though, variables with multiple characters like `pi` cannot be multiplied (like `pipipipi` won't result in `pi*pi*pi*pi`). But that's such a niche use case (and that same thing could be done by using exponents) that it doesn't really matter.
|
||||||
|
In the future I may want to completely rewrite this or implement this natively into mevel-rs (which would probably be good to do)
|
||||||
|
*/
|
||||||
pub fn add_asterisks(function_in: String) -> String {
|
pub fn add_asterisks(function_in: String) -> String {
|
||||||
let function = function_in.replace("log10(", "log(").replace("pi", "π"); // pi -> π and log10 -> log
|
let function = function_in.replace("log10(", "log(").replace("pi", "π"); // pi -> π and log10 -> log
|
||||||
let valid_variables: Vec<char> = "xeπ".chars().collect();
|
let valid_variables: Vec<char> = "xeπ".chars().collect();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user