diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lex/mod.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/lex/mod.rs b/src/lex/mod.rs index c54722f..e6b2000 100644 --- a/src/lex/mod.rs +++ b/src/lex/mod.rs | |||
@@ -56,16 +56,19 @@ pub enum Token { | |||
56 | 56 | ||
57 | fn get_functions() -> HashMap<&'static str, Token> { | 57 | fn get_functions() -> HashMap<&'static str, Token> { |
58 | return [ | 58 | return [ |
59 | ("sin", Function::token_from_fn("sin".into(), |x| x.to_radians().sin())), | 59 | ("sin", Function::token_from_fn("sin".into(), |x| x.to_radians().sin())), |
60 | ("cos", Function::token_from_fn("cos".into(), |x| x.to_radians().cos())), | 60 | ("cos", Function::token_from_fn("cos".into(), |x| x.to_radians().cos())), |
61 | ("tan", Function::token_from_fn("tan".into(), |x| x.to_radians().tan())), | 61 | ("tan", Function::token_from_fn("tan".into(), |x| x.to_radians().tan())), |
62 | ("csc", Function::token_from_fn("csc".into(), |x| 1. / x.to_radians().sin())), | 62 | ("csc", Function::token_from_fn("csc".into(), |x| x.to_radians().sin().recip())), |
63 | ("sec", Function::token_from_fn("sec".into(), |x| 1. / x.to_radians().cos())), | 63 | ("sec", Function::token_from_fn("sec".into(), |x| x.to_radians().cos().recip())), |
64 | ("cot", Function::token_from_fn("cot".into(), |x| 1. / x.to_radians().tan())), | 64 | ("cot", Function::token_from_fn("cot".into(), |x| x.to_radians().tan().recip())), |
65 | ("ln", Function::token_from_fn("ln".into(), |x| x.ln())), | 65 | ("sinh", Function::token_from_fn("sinh".into(), |x| x.sinh())), |
66 | ("log", Function::token_from_fn("log".into(), |x| x.log10())), | 66 | ("cosh", Function::token_from_fn("cosh".into(), |x| x.cosh())), |
67 | ("sqrt", Function::token_from_fn("sqrt".into(), |x| x.sqrt())), | 67 | ("tanh", Function::token_from_fn("tanh".into(), |x| x.tanh())), |
68 | ("ceil", Function::token_from_fn("ceil".into(), |x| x.ceil())), | 68 | ("ln", Function::token_from_fn("ln".into(), |x| x.ln())), |
69 | ("log", Function::token_from_fn("log".into(), |x| x.log10())), | ||
70 | ("sqrt", Function::token_from_fn("sqrt".into(), |x| x.sqrt())), | ||
71 | ("ceil", Function::token_from_fn("ceil".into(), |x| x.ceil())), | ||
69 | ("floor", Function::token_from_fn("floor".into(), |x| x.floor())), | 72 | ("floor", Function::token_from_fn("floor".into(), |x| x.floor())), |
70 | ].iter().cloned().collect(); | 73 | ].iter().cloned().collect(); |
71 | } | 74 | } |