1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Debug, Error, PartialEq, Clone, Default)]
6#[doc(hidden)]
7pub enum LexError {
8 #[default]
10 #[error("parser lex error")]
11 Other,
12}
13
14#[derive(Debug, Error)]
16pub enum Error {
17 #[error("Bad command arguments: '{0}'")]
19 BadArguments(String),
20
21 #[error("include file '{0}' not found ({1})")]
23 Include(String, PathBuf),
24
25 #[error("unknown instruction '{0}'")]
27 UnknownInstruction(String),
28
29 #[error("invalid control code '{0}'")]
31 InvalidControlCode(String),
32
33 #[error("pragma declaration ($!) must be the first instruction")]
35 PragmaFirst,
36
37 #[error(transparent)]
39 Io(#[from] std::io::Error),
40
41 #[error(transparent)]
43 ParseInt(#[from] std::num::ParseIntError),
44
45 #[error(transparent)]
47 Expect(#[from] anticipate::Error),
48
49 #[error(transparent)]
51 Lex(#[from] LexError),
52}