1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum ParseErrorKind {
5 #[error("unexpected token: {0}")]
6 UnexpectedToken(String),
7 #[error("unexpected end of input")]
8 UnexpectedEof,
9 #[error("invalid integer literal: {0}")]
10 InvalidInteger(String),
11 #[error("invalid float literal: {0}")]
12 InvalidFloat(String),
13 #[error("expected {0}")]
14 Expected(String),
15 #[error("unsupported directive: {0}")]
16 UnsupportedDirective(String),
17 #[error("unsupported instruction form: {0}")]
18 UnsupportedInstruction(String),
19 #[error("trailing input")]
20 TrailingInput,
21}
22
23#[derive(Debug, Error)]
24#[error("{kind} at offset {offset}")]
25pub struct ParseError {
26 pub kind: ParseErrorKind,
27 pub offset: usize,
28}