diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2023-12-01 14:00:46 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2023-12-01 14:00:46 +0100 |
| commit | 871398ff821255debdbd9452e46ca55a05e8cb92 (patch) | |
| tree | bac4777cf6123ff3640f4377fa33091b68d02d91 /crates/parser/src/error.rs | |
| parent | 266afb16777970b37a61889039a0a2ea1ad1f83a (diff) | |
feat: wip: seperate parser and types crates
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser/src/error.rs')
| -rw-r--r-- | crates/parser/src/error.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/parser/src/error.rs b/crates/parser/src/error.rs new file mode 100644 index 0000000..c99fa01 --- /dev/null +++ b/crates/parser/src/error.rs @@ -0,0 +1,25 @@ +use alloc::string::{String, ToString}; +use wasmparser::Encoding; + +pub enum ParseError { + UnsupportedSection(String), + DuplicateSection(String), + EmptySection(String), + UnsupportedOperator(String), + ParseError { message: String, offset: usize }, + InvalidEncoding(Encoding), + InvalidLocalCount { expected: u32, actual: u32 }, + EndNotReached, + Other(String), +} + +impl From<wasmparser::BinaryReaderError> for ParseError { + fn from(value: wasmparser::BinaryReaderError) -> Self { + Self::ParseError { + message: value.message().to_string(), + offset: value.offset(), + } + } +} + +pub type Result<T, E = ParseError> = core::result::Result<T, E>; |
