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

@ -20,6 +20,10 @@ pub fn check(
))
}
if let Err(e_span) = check_missing_sink(&syntax) {
errs.push(SyntaxError::MissingSink(vec![(file_id, e_span)]));
}
if errs.is_empty() {
Ok(syntax)
} else {
@ -44,11 +48,11 @@ fn check_missing_filters(syntax: &Vec<PipelineElement>) -> Result<(), Vec<logos:
for i in 0..syntax.len() {
if let (
Some(PipelineElement {
Some(&PipelineElement {
kind: PipelineElementKind::Pipe,
ref span,
}),
Some(PipelineElement {
Some(&PipelineElement {
kind: PipelineElementKind::Pipe,
span: ref span1,
}),
@ -64,3 +68,15 @@ fn check_missing_filters(syntax: &Vec<PipelineElement>) -> Result<(), Vec<logos:
Err(missing_filter_locs)
}
}
fn check_missing_sink(syntax: &Vec<PipelineElement>) -> Result<(), logos::Span> {
if let Some(&PipelineElement {
kind: PipelineElementKind::Pipe,
ref span,
}) = syntax.last()
{
Err(span.clone())
} else {
Ok(())
}
}