protospec_build/parser/
error.rs1use thiserror::Error;
2use crate::{result::*, SpannedToken, Span};
3
4pub type ParseResult<T> = StdResult<T, ParseError>;
5
6#[derive(Error, Debug)]
7pub enum ParseError {
8 #[error("error tokenizing: `{0}`")]
9 TokenError(String),
10 #[error("unexpected eof")]
11 UnexpectedEOF,
12 #[error("unexpected token: {0}, expecting: {1}")]
13 Unexpected(SpannedToken, String),
14 #[error("length constraint cannot be empty")]
15 EmptyLengthConstraint(Span),
16 #[error("enum is missing representation scalar")]
17 EnumMissingRep(Span),
18 #[error("bitfield is missing representation scalar")]
19 BitfieldMissingRep(Span),
20 #[error("unknown container directive '{0}' @ {1}'")]
21 UnknownContainerDirective(String, Span),
22
23 #[error("unknown")]
24 Unknown(#[from] crate::Error),
25}