misc: cleanup

This commit is contained in:
Seymur Bagirov 2025-02-25 13:18:59 +04:00
parent 933b6e052d
commit 90f7755c0c
5 changed files with 5 additions and 6 deletions

View File

@ -3,7 +3,7 @@ use std::{cell::RefCell, fmt::Display, rc::Rc};
use crate::{ use crate::{
ast::Stmt, ast::Stmt,
environment::Environment, environment::Environment,
interpreter::{execute_block, InterpreterEnvironment, InterpreterSignal, RuntimeError}, interpreter::{execute_block, InterpreterEnvironment, InterpreterSignal},
token::{LiteralType, Token}, token::{LiteralType, Token},
}; };

View File

@ -1,9 +1,6 @@
use std::{cell::RefCell, collections::HashMap, rc::Rc}; use std::{cell::RefCell, collections::HashMap, rc::Rc};
use crate::{ use crate::token::{LiteralType, Token};
callable::Callable,
token::{LiteralType, Token},
};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Environment { pub struct Environment {

View File

@ -22,7 +22,7 @@ fn main() -> ExitCode {
return ExitCode::from(75); return ExitCode::from(75);
} }
if let Err(RunError::RuntimeError(r)) = result { if let Err(RunError::RuntimeError(_r)) = result {
return ExitCode::from(70); return ExitCode::from(70);
} }

View File

@ -1,5 +1,6 @@
use crate::{ast::Expr, token::LiteralType}; use crate::{ast::Expr, token::LiteralType};
#[allow(dead_code)]
pub fn pretty_print(expr: &Expr) -> String { pub fn pretty_print(expr: &Expr) -> String {
match expr { match expr {
Expr::Binary { left, op, right } => parenthesize(&op.lexeme, &[left, right]), Expr::Binary { left, op, right } => parenthesize(&op.lexeme, &[left, right]),

View File

@ -72,6 +72,7 @@ impl Scanner {
Ok(&self.tokens) Ok(&self.tokens)
} }
#[allow(dead_code)]
fn is_at_end(&self) -> bool { fn is_at_end(&self) -> bool {
self.current >= self.source.len() self.current >= self.source.len()
} }