mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 12:22:42 +00:00
improved REPL a bit
now uses rustyline for input
This commit is contained in:
parent
ca6e092b38
commit
fb88595b6c
13 changed files with 560 additions and 100 deletions
|
|
@ -17,7 +17,11 @@ pub enum RuntimeError {
|
|||
#[error("Opcopde {opcode} had invalid operand {operand}")]
|
||||
UnaryInvalidOperand { opcode: Opcode, operand: Value },
|
||||
#[error("Opcopde {opcode} had invalid operands {left} and {right}")]
|
||||
BinaryInvalidOperand { opcode: Opcode, left: Value, right: Value },
|
||||
BinaryInvalidOperand {
|
||||
opcode: Opcode,
|
||||
left: Value,
|
||||
right: Value,
|
||||
},
|
||||
#[error("Division by zero")]
|
||||
DivisionByZero,
|
||||
}
|
||||
|
|
@ -52,7 +56,7 @@ impl From<RuntimeError> for LoxError {
|
|||
}
|
||||
}
|
||||
|
||||
fn format_multiple_errors(errs: &Vec<impl std::error::Error>) -> String {
|
||||
fn format_multiple_errors(errs: &[impl std::error::Error]) -> String {
|
||||
let msg = if errs.len() == 1 {
|
||||
errs[0].to_string()
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue