feat: improved logging for current procedure

This commit is contained in:
Yandrik 2021-11-30 18:18:50 +01:00
parent 1f0e2724db
commit 0046edaa4b

View File

@ -47,7 +47,7 @@ pub fn parse(lexer: lexer::Lexer) -> Result<f64> {
} }
pub fn s_proc(tbox: &mut TokenBox) -> Result<f64> { pub fn s_proc(tbox: &mut TokenBox) -> Result<f64> {
println!("Proc S"); println!("╔═ S");
let result = a_proc(tbox)?; let result = a_proc(tbox)?;
match tbox.read_token()? { match tbox.read_token()? {
None => Ok(result), None => Ok(result),
@ -56,7 +56,7 @@ pub fn s_proc(tbox: &mut TokenBox) -> Result<f64> {
} }
fn a_proc(tbox: &mut TokenBox) -> Result<f64> { fn a_proc(tbox: &mut TokenBox) -> Result<f64> {
println!("Proc A"); println!("╠╦ A");
let result = m_proc(tbox)?; let result = m_proc(tbox)?;
match &tbox.read_token()? { match &tbox.read_token()? {
Some(Token::OP(_, OpType::ADD)) => Ok(result + a_proc(tbox)?), Some(Token::OP(_, OpType::ADD)) => Ok(result + a_proc(tbox)?),
@ -70,7 +70,7 @@ fn a_proc(tbox: &mut TokenBox) -> Result<f64> {
} }
fn m_proc(tbox: &mut TokenBox) -> Result<f64> { fn m_proc(tbox: &mut TokenBox) -> Result<f64> {
println!("Proc M"); println!("║╠╦ M");
let result = g_proc(tbox)?; let result = g_proc(tbox)?;
match &tbox.read_token()? { match &tbox.read_token()? {
Some(Token::OP(_, OpType::MUL)) => Ok(result * m_proc(tbox)?), Some(Token::OP(_, OpType::MUL)) => Ok(result * m_proc(tbox)?),
@ -84,7 +84,7 @@ fn m_proc(tbox: &mut TokenBox) -> Result<f64> {
} }
fn g_proc(tbox: &mut TokenBox) -> Result<f64> { fn g_proc(tbox: &mut TokenBox) -> Result<f64> {
println!("Proc G"); println!("║║╠╦ G");
let result = p_proc(tbox)?; let result = p_proc(tbox)?;
match tbox.read_token()? { match tbox.read_token()? {
Some(Token::OP(_, OpType::POW)) => Ok(result.powf(g_proc(tbox)?)), Some(Token::OP(_, OpType::POW)) => Ok(result.powf(g_proc(tbox)?)),
@ -97,7 +97,7 @@ fn g_proc(tbox: &mut TokenBox) -> Result<f64> {
} }
fn p_proc(tbox: &mut TokenBox) -> Result<f64> { fn p_proc(tbox: &mut TokenBox) -> Result<f64> {
println!("Proc P"); println!("║║║╚ P");
match expect_token(tbox.read_token()?)? { match expect_token(tbox.read_token()?)? {
Token::OBR(_) => { Token::OBR(_) => {
let result = a_proc(tbox)?; let result = a_proc(tbox)?;