implement check for missing filters in pipeline

This commit is contained in:
Schrottkatze 2023-11-16 08:58:39 +01:00
commit 1b6d2a9b62
3 changed files with 53 additions and 2 deletions

View file

@ -10,9 +10,9 @@ pub enum SyntaxError {
/// `MissingStreamer` means, that the pipeline starts with a Pipe (`|`), so it has no streamer as input in front of it.
MissingStreamer(Vec<(FileId, logos::Span)>),
/// `MissingSink` means, that the pipeline ends with a Pipe (`|`), meaning that the output can't go anywhere
MissingSink,
MissingSink(Vec<(FileId, logos::Span)>),
/// This indicates a missing filter somewhere in the pipeline, meaning that there's 2 pipes after one another
MissingFilter,
MissingFilter(Vec<(FileId, logos::Span)>),
/// A literal cannot be a sink
LiteralAsSink,
/// A literal can't be a filter either
@ -42,6 +42,15 @@ impl SyntaxError {
})
.collect(),
),
Self::MissingFilter(locs) => Diagnostic::error()
.with_message("missing filters in pipelines")
.with_labels(
locs.into_iter()
.map(|(file_id, span)| {
Label::primary(*file_id, span.clone()).with_message("no filter here")
})
.collect(),
),
_ => todo!(),
}
}