Errors - Result subtype using SloxError

This commit is contained in:
Emmanuel BENOîT 2023-01-03 22:40:36 +01:00
parent d3398e5f79
commit a59dc21223

View file

@ -33,6 +33,9 @@ pub struct SloxError {
message: String, message: String,
} }
/// Return type for SLox functions.
pub type SloxResult<T> = Result<T, SloxError>;
impl SloxError { impl SloxError {
/// Initialize a record for a scanner error. /// Initialize a record for a scanner error.
pub fn scanner_error(line: usize, ch: Option<char>, message: String) -> Self { pub fn scanner_error(line: usize, ch: Option<char>, message: String) -> Self {