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
Showing only changes of commit db2643359c - Show all commits

View file

@ -1,5 +1,45 @@
use crate::parser::{CompletedMarker, Parser}; use crate::parser::{
error::SyntaxError,
grammar::expression::{atom, expression},
CompletedMarker, Marker, Parser,
SyntaxKind::*,
};
pub fn attr_set(p: &mut Parser) -> CompletedMarker { pub fn attr_set(p: &mut Parser) -> CompletedMarker {
todo!() let start = p.start("attr_set_start");
assert!(p.eat(L_BRACE));
loop {
if attr(p).is_some() {
// TODO: handle others
if p.eat(COMMA) {
continue;
} else if p.eat(R_BRACE) {
return start.complete(p, ATTR_SET);
}
// TODO: check for newline and stuff following that for recov of others
} else if p.eat(R_BRACE) {
return start.complete(p, ATTR_SET);
}
}
}
fn attr(p: &mut Parser) -> Option<CompletedMarker> {
if p.at(IDENT) {
let attr_start = p.start("attr");
let attr_name_start = p.start("attr_name");
p.do_bump();
attr_name_start.complete(p, ATTR_NAME);
// TODO: handle comma, expr/atom, other
p.eat(COLON);
// TODO: handle failed expr parser too
let attr_value = p.start("attr_value");
let _ = expression(p);
attr_value.complete(p, ATTR_VALUE);
Some(attr_start.complete(p, ATTR))
} else {
None
}
} }