|
|
@ -28,6 +28,7 @@ pub fn exec(src: String) { |
|
|
|
let mut lexer = Lexer::new(&src); |
|
|
|
let mut lexer = Lexer::new(&src); |
|
|
|
lexer.lex().unwrap(); |
|
|
|
lexer.lex().unwrap(); |
|
|
|
let tokens = lexer.tokens; |
|
|
|
let tokens = lexer.tokens; |
|
|
|
|
|
|
|
// dbg!(&tokens);
|
|
|
|
|
|
|
|
|
|
|
|
// Setup executor
|
|
|
|
// Setup executor
|
|
|
|
let expr = Parser::new(tokens).parse_all().unwrap(); |
|
|
|
let expr = Parser::new(tokens).parse_all().unwrap(); |
|
|
@ -58,7 +59,7 @@ pub fn evaluate(src: &str) -> String { |
|
|
|
Ok(v) => { |
|
|
|
Ok(v) => { |
|
|
|
expr = v; |
|
|
|
expr = v; |
|
|
|
} |
|
|
|
} |
|
|
|
Err(v) => { |
|
|
|
Err(_v) => { |
|
|
|
log("parsing fail"); |
|
|
|
log("parsing fail"); |
|
|
|
return String::from("parsing failed"); |
|
|
|
return String::from("parsing failed"); |
|
|
|
} |
|
|
|
} |
|
|
|