gcg_parser/error.rs
1use displaydoc::Display;
2use thiserror::Error;
3
4use crate::token;
5
6#[derive(Display, Error, Debug)]
7#[allow(clippy::module_name_repetitions)]
8pub enum Error {
9 /// Error on line {line_index:?}: {source}
10 InvalidLine {
11 /// 1 indexed
12 line_index: usize,
13 #[source]
14 source: token::Error,
15 },
16 /// Missing required pragma {keyword:?}
17 MissingPragma {
18 /// indicates type of pragma
19 keyword: String,
20 },
21 /// Unknown pragma on line {line_index:?}: {line:?}
22 UnknownPragma {
23 line: String,
24 // 1 indexed
25 line_index: usize,
26 },
27}
28
29pub type Result<T> = core::result::Result<T, Error>;