protospec-build 0.3.0

One binary format language to rule them all, One binary format language to find them, One binary format language to bring them all and in the darkness bind them.
Documentation
use thiserror::Error;
use crate::{result::*, SpannedToken, Span};

pub type ParseResult<T> = StdResult<T, ParseError>;

#[derive(Error, Debug)]
pub enum ParseError {
    #[error("error tokenizing: `{0}`")]
    TokenError(String),
    #[error("unexpected eof")]
    UnexpectedEOF,
    #[error("unexpected token: {0}, expecting: {1}")]
    Unexpected(SpannedToken, String),
    #[error("length constraint cannot be empty")]
    EmptyLengthConstraint(Span),
    #[error("enum is missing representation scalar")]
    EnumMissingRep(Span),
    #[error("bitfield is missing representation scalar")]
    BitfieldMissingRep(Span),
    #[error("unknown container directive '{0}' @ {1}'")]
    UnknownContainerDirective(String, Span),

    #[error("unknown")]
    Unknown(#[from] crate::Error),
}