oca_file/ocafile/
error.rs

1use oca_file_semantics::ocafile::error::ParseError as SemanticsParseError;
2use oca_file_transformation::ocafile::error::ParseError as TransformationParseError;
3
4#[derive(thiserror::Error, Debug, serde::Serialize)]
5#[serde(untagged)]
6pub enum ParseError {
7    #[error("Error at line {line_number} ({raw_line}): {message}")]
8    GrammarError {
9        #[serde(rename = "ln")]
10        line_number: usize,
11        #[serde(rename = "col")]
12        column_number: usize,
13        #[serde(rename = "c")]
14        raw_line: String,
15        #[serde(rename = "e")]
16        message: String,
17    },
18    #[error("Error parsing meta: {0}")]
19    MetaError(String),
20
21    #[error("Error parsing semantics: {0}")]
22    SemanticsError(#[from] SemanticsParseError),
23
24    #[error("Error parsing transformation: {0}")]
25    TransformationError(#[from] TransformationParseError),
26
27    #[error("{0}")]
28    Custom(String),
29}