nodes for blocks

This commit is contained in:
Aleksey Kladov
2018-08-24 19:27:30 +03:00
parent 4d29300396
commit 7edab6ae6b
122 changed files with 1743 additions and 1535 deletions

View File

@@ -144,18 +144,21 @@ fn name_ref(p: &mut Parser) {
}
fn error_block(p: &mut Parser, message: &str) {
assert!(p.at(L_CURLY));
let err = p.start();
p.error(message);
p.bump();
let mut level: u32 = 1;
while level > 0 && !p.at(EOF) {
match p.current() {
L_CURLY => level += 1,
R_CURLY => level -= 1,
_ => (),
go(p, Some(message));
fn go(p: &mut Parser, message: Option<&str>) {
assert!(p.at(L_CURLY));
let m = p.start();
if let Some(message) = message {
p.error(message);
}
p.bump();
while !p.at(EOF) && !p.at(R_CURLY) {
match p.current() {
L_CURLY => go(p, None),
_ => p.bump(),
}
}
p.eat(R_CURLY);
m.complete(p, ERROR);
}
err.complete(p, ERROR);
}