mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
add EExpr error for unexpected comma
This commit is contained in:
parent
62cc19c64b
commit
ca01913ab3
3 changed files with 30 additions and 1 deletions
|
@ -687,6 +687,23 @@ fn to_expr_report<'a>(
|
|||
severity: Severity::RuntimeError,
|
||||
}
|
||||
}
|
||||
EExpr::UnexpectedComma(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 trying to parse an expression, but I got stuck here:"),
|
||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
||||
alloc.concat([alloc.reflow("This comma in an invalid position.")]),
|
||||
]);
|
||||
|
||||
Report {
|
||||
filename,
|
||||
doc,
|
||||
title: "UNEXPECTED COMMA".to_string(),
|
||||
severity: Severity::RuntimeError,
|
||||
}
|
||||
}
|
||||
_ => todo!("unhandled parse error: {:?}", parse_problem),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue