fix expression indentation error

This commit is contained in:
Tim Whiting 2022-09-28 20:00:56 -06:00
parent 4f23bc39f0
commit f323fe6534
No known key found for this signature in database
GPG key ID: 6032120E589B8CFF
2 changed files with 40 additions and 0 deletions

View file

@ -529,6 +529,24 @@ fn to_expr_report<'a>(
EExpr::Ability(err, pos) => to_ability_def_report(alloc, lines, filename, err, *pos),
EExpr::IndentEnd(pos) => {
let surroundings = Region::new(start, *pos);
let region = LineColumnRegion::from_pos(lines.convert_pos(*pos));
let doc = alloc.stack(vec![
alloc.reflow(r"I am partway through parsing an expression, but I got stuck here:"),
alloc.region_with_subregion(lines.convert_region(surroundings), region),
alloc.concat(vec![alloc.reflow(
"Looks like the indentation ends prematurely after an expression",
)]),
]);
Report {
filename,
doc,
title: "INDENT ENDS AFTER EXPRESSION".to_string(),
severity: Severity::RuntimeError,
}
}
_ => todo!("unhandled parse error: {:?}", parse_problem),
}
}