bytebraise_syntax/parser/
mod.rs

1use thiserror::Error;
2
3pub mod parser;
4pub mod tests;
5
6pub use parser::parse_bitbake_from_str;
7
8#[derive(Error, Debug)]
9#[error("{line_no}: {kind}")]
10pub struct ParseError {
11    line_no: usize,
12    kind: ParseErrorKind,
13}
14
15#[derive(Error, Debug, Eq, PartialEq)]
16pub enum ParseErrorKind {
17    #[error("AAA")]
18    A,
19    #[error("AAA")]
20    B,
21}
22
23pub type ParserResult<T> = Result<T, ParseError>;
24
25pub type Identifier<'ast> = &'ast str;
26
27#[derive(Debug, PartialEq, Eq)]
28pub enum BitBakeParserMode {
29    /// .conf
30    Conf,
31    /// .bb, .bbclass, .inc
32    BB,
33}
34
35impl BitBakeParserMode {
36    pub fn is_conf(&self) -> bool {
37        matches!(self, BitBakeParserMode::Conf)
38    }
39
40    pub fn is_bb(&self) -> bool {
41        matches!(&self, BitBakeParserMode::BB)
42    }
43}