diff options
author | Ivan Tham <[email protected]> | 2020-11-01 17:28:05 +0000 |
---|---|---|
committer | Ivan Tham <[email protected]> | 2020-11-01 17:28:05 +0000 |
commit | ea95516537b9ef2c9badd01abcf72f20066f9c55 (patch) | |
tree | 3c58c044b38618a808d53ca81654c0a36b32b7e5 /src/lex | |
parent | d31097959f29d7b82dabfd050eb988a896c2e44b (diff) |
Add help command
Close #41
Diffstat (limited to 'src/lex')
-rw-r--r-- | src/lex/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lex/mod.rs b/src/lex/mod.rs index 3222c12..b3faff8 100644 --- a/src/lex/mod.rs +++ b/src/lex/mod.rs | |||
@@ -70,14 +70,14 @@ pub enum Token { | |||
70 | } | 70 | } |
71 | 71 | ||
72 | lazy_static! { | 72 | lazy_static! { |
73 | static ref CONSTANTS: HashMap<&'static str, Token> = { | 73 | pub static ref CONSTANTS: HashMap<&'static str, Token> = { |
74 | let mut m = HashMap::new(); | 74 | let mut m = HashMap::new(); |
75 | m.insert("e", Token::Num(std::f64::consts::E)); | 75 | m.insert("e", Token::Num(std::f64::consts::E)); |
76 | m.insert("pi", Token::Num(std::f64::consts::PI)); | 76 | m.insert("pi", Token::Num(std::f64::consts::PI)); |
77 | m | 77 | m |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static ref FUNCTIONS: HashMap<&'static str, Token> = { | 80 | pub static ref FUNCTIONS: HashMap<&'static str, Token> = { |
81 | let mut m = HashMap::new(); | 81 | let mut m = HashMap::new(); |
82 | m.insert("sin", Function::token_from_fn("sin".into(), |x| is_radian_mode(x, CONFIGURATION.radian_mode).sin())); | 82 | m.insert("sin", Function::token_from_fn("sin".into(), |x| is_radian_mode(x, CONFIGURATION.radian_mode).sin())); |
83 | m.insert("cos", Function::token_from_fn("cos".into(), |x| is_radian_mode(x, CONFIGURATION.radian_mode).cos())); | 83 | m.insert("cos", Function::token_from_fn("cos".into(), |x| is_radian_mode(x, CONFIGURATION.radian_mode).cos())); |
@@ -106,7 +106,7 @@ lazy_static! { | |||
106 | m | 106 | m |
107 | }; | 107 | }; |
108 | 108 | ||
109 | static ref OPERATORS: HashMap<char, Token> = { | 109 | pub static ref OPERATORS: HashMap<char, Token> = { |
110 | let mut m = HashMap::new(); | 110 | let mut m = HashMap::new(); |
111 | m.insert('+', Operator::token_from_op('+', |x, y| x + y, 2, true)); | 111 | m.insert('+', Operator::token_from_op('+', |x, y| x + y, 2, true)); |
112 | m.insert('-', Operator::token_from_op('-', |x, y| x - y, 2, true)); | 112 | m.insert('-', Operator::token_from_op('-', |x, y| x - y, 2, true)); |