Skip to content

Commit

Permalink
undo changes on error.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
cre4ture committed Jan 10, 2024
1 parent 086062e commit 54b2943
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! Module containing error details.
/// An error that can occur during variable substitution.
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub enum Error {
/// The input string contains an invalid escape sequence.
InvalidEscapeSequence(InvalidEscapeSequence),
Expand Down Expand Up @@ -138,7 +139,8 @@ impl std::fmt::Display for CharOrByte {
}

/// The input string contains an invalid escape sequence.
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct InvalidEscapeSequence {
/// The byte offset within the input where the error occurs.
///
Expand Down Expand Up @@ -168,7 +170,8 @@ impl std::fmt::Display for InvalidEscapeSequence {
}

/// The input string contains a variable placeholder without a variable name (`"${}"`).
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct MissingVariableName {
/// The byte offset within the input where the error occurs.
///
Expand All @@ -189,7 +192,8 @@ impl std::fmt::Display for MissingVariableName {
}

/// The input string contains an unexpected character.
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct UnexpectedCharacter {
/// The byte offset within the input where the error occurs.
///
Expand Down Expand Up @@ -221,7 +225,8 @@ impl std::fmt::Display for UnexpectedCharacter {
}

/// A struct to describe what was expected instead of the unexpected character.
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct ExpectedCharacter {
/// A human readable message to describe what is expected.
pub(crate) message: &'static str,
Expand All @@ -236,7 +241,8 @@ impl ExpectedCharacter {
}

/// The input string contains an unclosed variable placeholder.
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct MissingClosingBrace {
/// The byte offset within the input where the error occurs.
///
Expand All @@ -254,7 +260,8 @@ impl std::fmt::Display for MissingClosingBrace {
}

/// The input string contains a placeholder for a variable that is not in the variable map.
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct NoSuchVariable {
/// The byte offset within the input where the error occurs.
///
Expand Down

0 comments on commit 54b2943

Please sign in to comment.