-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Alter merge signature to return a Result (#26)
Showing
6 changed files
with
279 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use std::error; | ||
use std::fmt; | ||
|
||
#[derive(Debug, PartialEq)] | ||
pub enum MergeError { | ||
MergingTerminalWithNonTerminal, | ||
InvalidMatchingConfiguration(bool, bool, bool, bool, bool), | ||
} | ||
|
||
impl fmt::Display for MergeError { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match self { | ||
MergeError::MergingTerminalWithNonTerminal => { | ||
write!(f, "Merging terminal with non-terminal") | ||
} | ||
MergeError::InvalidMatchingConfiguration(a, b, c, d, e) => write!( | ||
f, | ||
"Invalid matching configuration: {}, {}, {}, {}, {}", | ||
a, b, c, d, e | ||
), | ||
} | ||
} | ||
} | ||
|
||
impl error::Error for MergeError {} |
Oops, something went wrong.