2017-04-21 14:35:12 +03:00
|
|
|
#![allow(dead_code, unused_variables, missing_docs)]
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
|
|
pub enum Error {
|
|
|
|
Program(String),
|
|
|
|
Initialization(String),
|
|
|
|
Function(String),
|
|
|
|
Table(String),
|
|
|
|
Memory(String),
|
|
|
|
Variable(String),
|
|
|
|
Global(String),
|
|
|
|
Local(String),
|
2017-04-26 12:37:27 +03:00
|
|
|
Stack(String),
|
2017-04-21 14:35:12 +03:00
|
|
|
Value(String),
|
|
|
|
Interpreter(String),
|
|
|
|
Trap,
|
|
|
|
NotImplemented,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<String> for Error {
|
|
|
|
fn into(self) -> String {
|
|
|
|
match self {
|
|
|
|
Error::Program(s) => s,
|
|
|
|
Error::Initialization(s) => s,
|
|
|
|
Error::Function(s) => s,
|
|
|
|
Error::Table(s) => s,
|
|
|
|
Error::Memory(s) => s,
|
|
|
|
Error::Variable(s) => s,
|
|
|
|
Error::Global(s) => s,
|
|
|
|
Error::Local(s) => s,
|
2017-04-26 12:37:27 +03:00
|
|
|
Error::Stack(s) => s,
|
2017-04-21 14:35:12 +03:00
|
|
|
Error::Interpreter(s) => s,
|
|
|
|
Error::Value(s) => s,
|
|
|
|
Error::Trap => "trap".into(),
|
|
|
|
Error::NotImplemented => "not implemented".into(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod imports;
|
|
|
|
mod memory;
|
|
|
|
mod module;
|
|
|
|
mod program;
|
|
|
|
mod runner;
|
2017-04-26 12:37:27 +03:00
|
|
|
mod stack;
|
2017-04-21 14:35:12 +03:00
|
|
|
mod table;
|
|
|
|
mod value;
|
|
|
|
mod variable;
|