2022-10-20 13:47:43 +11:00
|
|
|
use crate::parse::Span;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum ParsePresetError {
|
2022-10-20 16:59:15 +11:00
|
|
|
#[error("shader preset lexing error")]
|
2022-10-20 13:47:43 +11:00
|
|
|
LexerError { offset: usize, row: u32, col: usize },
|
|
|
|
#[error("shader preset parse error")]
|
2022-10-20 16:59:15 +11:00
|
|
|
ParserError {
|
|
|
|
offset: usize,
|
|
|
|
row: u32,
|
|
|
|
col: usize,
|
|
|
|
kind: ParseErrorKind,
|
|
|
|
},
|
2022-10-20 13:47:43 +11:00
|
|
|
#[error("invalid scale type")]
|
|
|
|
InvalidScaleType(String),
|
|
|
|
#[error("exceeded maximum reference depth (16)")]
|
|
|
|
ExceededReferenceDepth,
|
|
|
|
#[error("shader presents must be resolved against an absolute path")]
|
|
|
|
RootPathWasNotAbsolute,
|
|
|
|
#[error("the file was not found during resolution")]
|
|
|
|
IOError(PathBuf, std::io::Error),
|
|
|
|
#[error("expected utf8 bytes but got invalid utf8")]
|
|
|
|
Utf8Error(Vec<u8>),
|
|
|
|
}
|
2022-10-20 16:59:15 +11:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum ParseErrorKind {
|
|
|
|
Index(&'static str),
|
|
|
|
Int,
|
|
|
|
Float,
|
|
|
|
Bool,
|
|
|
|
}
|