implement basic namespacing for types, traits and commands

This commit is contained in:
Schrottkatze 2023-11-16 19:22:26 +01:00
commit b6b8c5085a
5 changed files with 287 additions and 6 deletions

View file

@ -13,11 +13,11 @@ pub enum SyntaxError {
MissingSink(Vec<(FileId, logos::Span)>),
/// This indicates a missing filter somewhere in the pipeline, meaning that there's 2 pipes after one another
MissingFilter(Vec<(FileId, logos::Span)>),
/// A literal cannot be a sink
/// A literal cannot be a sink, TODO
LiteralAsSink,
/// A literal can't be a filter either
/// A literal can't be a filter either, TODO
LiteralAsFilter,
/// A literal acting as streamer cannot take arguments
/// A literal acting as streamer cannot take arguments, TODO
LiteralWithArgs,
}
@ -51,7 +51,16 @@ impl SyntaxError {
})
.collect(),
),
_ => todo!(),
Self::MissingSink(locs) => Diagnostic::error()
.with_message("pipelines cannot end on a pipe")
.with_labels(
locs.into_iter()
.map(|(file_id, span)| {
Label::primary(*file_id, span.clone()).with_message("no sink")
})
.collect(),
),
_ => unimplemented!(),
}
}
}