mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 04:12:42 +00:00
Lox Interpreter done (Chapter 13)
This commit is contained in:
parent
10540708d4
commit
719a014977
16 changed files with 707 additions and 196 deletions
|
|
@ -1,10 +1,12 @@
|
|||
use std::rc::Rc;
|
||||
|
||||
use itertools::Itertools;
|
||||
use rlox2_frontend::lexer::LexerError;
|
||||
use rlox2_frontend::parser::{BinaryOp, ParserError, UnaryOp};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::ResolverError;
|
||||
use crate::Value;
|
||||
use crate::{LoxClass, ResolverError};
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum RuntimeError {
|
||||
|
|
@ -30,6 +32,14 @@ pub enum RuntimeError {
|
|||
Return { value: Value },
|
||||
#[error("Exit with exit code {exit_code}")]
|
||||
Exit { exit_code: i32 },
|
||||
#[error("Only objects have attributes")]
|
||||
InvalidGetTarget,
|
||||
#[error("Only objects have attributes")]
|
||||
InvalidSetTarget,
|
||||
#[error("Class {0} has no property {name}", class.name())]
|
||||
UndefinedAttribute { class: Rc<LoxClass>, name: String },
|
||||
#[error("{value} is not a valid superclass")]
|
||||
InvalidSuperclass { value: Value },
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue