diff --git a/src/parse/parse.rs b/src/parse/parse.rs index cd7f1a8..d964f3d 100644 --- a/src/parse/parse.rs +++ b/src/parse/parse.rs @@ -32,6 +32,16 @@ pub fn parse_var_declaration(mut tokens: Lexer) -> Option { tok } +pub fn parse_value(token: (Token, &str)) -> Option> { + let mut value = None; + + if let Number(n) = token.0 { + value = Some(Value::Number(n)); + } else if token.0 == Identifier { + value = Some(Value::Var(VarReference { name: token.1 })); + } +} + pub fn parse_fun_call(mut tokens: Lexer) -> Option { // Is it an Ident? → Is it a LeftParen? → Is it a value (I should really make a function to parse that) or is it a RightParen? // ↓ ↓