This commit is contained in:
2025-05-31 15:47:20 +02:00
parent cfe35bcc9d
commit 2c92cbe0b2
7 changed files with 9 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ use std::{error::Error, fmt::Write};
use crate::{
codegen::{Codegen, Env},
parser::{Expr, Stmt},
tokenizer::{MotError, TokenType, error},
tokenizer::{TokenType, ZernError, error},
};
pub struct CodegenX86_64 {

View File

@@ -1,6 +1,6 @@
use std::error::Error;
use crate::tokenizer::{MotError, Token, TokenType, error};
use crate::tokenizer::{Token, TokenType, ZernError, error};
#[derive(Debug, Clone)]
pub struct Param {

View File

@@ -44,22 +44,22 @@ pub enum TokenType {
}
#[derive(Debug)]
pub struct MotError {
pub struct ZernError {
pub loc: Loc,
pub message: String,
}
impl fmt::Display for MotError {
impl fmt::Display for ZernError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{} \x1b[91mERROR\x1b[0m: {}", self.loc, self.message)
}
}
impl std::error::Error for MotError {}
impl std::error::Error for ZernError {}
macro_rules! error {
($loc:expr, $msg:expr) => {
Err(Box::new(MotError {
Err(Box::new(ZernError {
loc: $loc.clone(),
message: $msg.into(),
}))