svg-filters & basic parser #15

Merged
schrottkatze merged 67 commits from schrottkatze/iowo:svg-filters into main 2024-07-08 18:29:05 +00:00
2 changed files with 20 additions and 0 deletions
Showing only changes of commit ed151c2e3c - Show all commits

View file

@ -4,4 +4,7 @@ use crate::lst_parser::syntax_kind::SyntaxKind;
pub enum SyntaxError {
Expected(Vec<SyntaxKind>),
PipelineNeedsSink,
// if there was two space seperated items in a list
SpaceSepInList,
SemicolonInList,
}

View file

@ -17,8 +17,10 @@ pub fn vec_matrix_list(p: &mut Parser) -> CompletedMarker {
finish_mat_or_vec(p, start, row_start)
} else if p.eat(R_BRACK) {
row_start.abandon(p);
start.complete(p, LIST)
} else {
row_start.abandon(p);
start.complete_err(p, SyntaxError::Expected(vec![EXPR, R_BRACK]))
}
}
@ -35,6 +37,21 @@ fn finish_list(p: &mut Parser, list_start: Marker) -> CompletedMarker {
}
} else if p.eat(R_BRACK) {
return list_start.complete(p, LIST);
} else if let Some(item) = atom(p) {
item.precede(p, "next_item")
.complete(p, COLLECTION_ITEM)
.precede(p, "err_space_sep")
.complete_err(p, SyntaxError::SpaceSepInList);
} else if p.at(SEMICOLON) {
let semi_err = p.start("semicolon_err");
p.eat(SEMICOLON);
semi_err.complete_err(p, SyntaxError::SemicolonInList);
if let Some(item) = atom(p) {
item.precede(p, "coll_item_start")
.complete(p, COLLECTION_ITEM);
} else if p.eat(R_BRACK) {
return list_start.complete(p, LIST);
}
}
}
}