Updated parse_var_declaration().
This commit is contained in:
parent
db1bc88e7b
commit
86e5a5a5ca
|
@ -2,7 +2,7 @@ use super::ast::*;
|
|||
use crate::lex::tok::*;
|
||||
use logos::Lexer;
|
||||
|
||||
fn parse_var_declaration(tokens: Lexer) -> Option<Expr<VarDefinition>> {
|
||||
fn parse_var_declaration(tokens: Lexer) -> Option<Expr> {
|
||||
let tok = None;
|
||||
match tokens.next() {
|
||||
Let => {
|
||||
|
@ -16,7 +16,12 @@ fn parse_var_declaration(tokens: Lexer) -> Option<Expr<VarDefinition>> {
|
|||
Number(n) => {
|
||||
let value = Value::Number(n);
|
||||
println!("{:?}", value);
|
||||
return VarDefenition {name, value};
|
||||
return Expr::VarDefenition {name, value};
|
||||
},
|
||||
|
||||
Identifier => {
|
||||
let value = Value::Var(VarReference { name: tokens.slice() });
|
||||
return Expr::Vardefenition {name, value};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue