use crate::parse::*;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ParseError {
#[error("Expected identifier")]
ExpectedIdentifier,
#[error("")]
InvalidUseStatement,
#[error("Error parsing floating point literal: {0}")]
ParseFloatError(#[from] std::num::ParseFloatError),
#[error("Error parsing integer literal: {0}")]
ParseIntError(#[from] std::num::ParseIntError),
#[error("Cannot parse rule: {0:?}")]
RuleError(Box<crate::parser::Rule>),
#[error("IO Error: {0}")]
IoError(#[from] std::io::Error),
#[error("Parser error: {0}")]
Parser(#[from] Box<pest::error::Error<crate::parser::Rule>>),
#[error("Error parsing color literal: {0}")]
ParseColorError(String),
#[error("Unknown unit: {0}")]
UnknownUnit(String),
#[error("Unexpected token")]
UnexpectedToken,
#[error("Tuple expression contains both named and positional arguments")]
MixedTupleArguments,
#[error("Duplicate named argument: {0}")]
DuplicateNamedArgument(Identifier),
#[error("Positional argument after named argument")]
PositionalArgumentAfterNamed,
#[error("Empty tuple expression")]
EmptyTupleExpression,
#[error("Missing type or value for definition parameter: {0}")]
ParameterMissingTypeOrValue(Identifier),
#[error("Duplicate parameter: {0}")]
DuplicateParameter(Identifier),
#[error("Duplicate argument: {0}")]
DuplicateCallArgument(Identifier),
#[error("Invalid map key type: {0}")]
InvalidMapKeyType(String),
#[error("Duplicated field name in map: {0}")]
DuplicatedMapField(Identifier),
#[error("Duplicate identifier: {0}")]
DuplicateIdentifier(Identifier),
#[error("Missing format expression")]
MissingFormatExpression,
#[error("Statement between two init statements")]
StatementBetweenModuleInit,
#[error("Module has both a parameter list and initializer")]
BothParameterListAndInitializer,
}
pub type ParseResult<T> = Result<T, ParseError>;