implement error message for HasMisplacedCarriageReturn

Also had to filter out the escape characters
so the erroe message does not get messed up
This commit is contained in:
Fabian Schmalzried 2023-09-10 17:17:26 +02:00
parent 49a1a3b46d
commit 3e41f6eb5a
No known key found for this signature in database
GPG key ID: D691D5DA4CEF42E7
3 changed files with 47 additions and 13 deletions

View file

@ -3888,6 +3888,23 @@ fn to_space_report<'a>(
}
}
BadInputError::HasMisplacedCarriageReturn => {
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
let doc = alloc.stack([
alloc.reflow(r"I encountered a carriage return (\r)"),
alloc.region(region),
alloc.reflow(r"A carriage return (\r) has to be followed by a newline (\n)."),
]);
Report {
filename,
doc,
title: "MISPLACED CARRIAGE RETURN".to_string(),
severity: Severity::RuntimeError,
}
}
_ => todo!("unhandled type parse error: {:?}", &parse_problem),
}
}