add support for custom theming in mers errors

this also includes support for the NoTheme,
a theme which doesn't add any color to mers'
output.
If you compile mers with --no-default-features,
the `colored` dependency will disappear and
mers_lib will fall back to NoTheme.
This commit is contained in:
Mark
2024-06-26 01:02:19 +02:00
parent f055d2089f
commit a78367f27c
24 changed files with 517 additions and 336 deletions

View File

@@ -7,7 +7,7 @@ use std::{
use crate::{
data::{self, Data, Type},
errors::{error_colors, CheckError, SourceRange},
errors::{CheckError, EColor, SourceRange},
info,
};
@@ -98,10 +98,10 @@ pub trait MersStatement: Debug + Send + Sync {
if let Some(cutoff) = info.global.limit_runtime {
if Instant::now() >= cutoff {
return Err(CheckError::new()
.msg("maximum runtime exceeded".to_owned())
.msg_str("maximum runtime exceeded".to_owned())
.src(vec![(
self.source_range(),
Some(error_colors::MaximumRuntimeExceeded),
Some(EColor::MaximumRuntimeExceeded),
)]));
}
}