Report lacking to while parsing app header

This commit is contained in:
caryoscelus 2023-11-27 19:10:24 +00:00
parent d5511a57e1
commit d141237a17
No known key found for this signature in database
GPG Key ID: 254EDDB85B66CB1F

View File

@ -3515,6 +3515,31 @@ fn to_provides_report<'a>(
EProvides::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos), EProvides::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos),
EProvides::IndentTo(pos) => {
let surroundings = Region::new(start, pos);
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
let doc = alloc.stack([
alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"),
alloc.region_with_subregion(lines.convert_region(surroundings), region),
alloc.concat([
alloc.reflow("I am expecting the "),
alloc.keyword("to"),
alloc.reflow(" keyword next, like"),
]),
alloc
.parser_suggestion("to pf")
.indent(4),
]);
Report {
filename,
doc,
title: "WEIRD PROVIDES".to_string(),
severity: Severity::RuntimeError,
}
}
_ => todo!("unhandled parse error {:?}", parse_problem), _ => todo!("unhandled parse error {:?}", parse_problem),
} }
} }