mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Implement error message for ASCII control characters
This commit is contained in:
parent
15a97c60b9
commit
49a1a3b46d
2 changed files with 40 additions and 6 deletions
|
@ -3858,9 +3858,9 @@ fn to_space_report<'a>(
|
|||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
||||
|
||||
let doc = alloc.stack([
|
||||
alloc.reflow(r"I encountered a tab character"),
|
||||
alloc.reflow("I encountered a tab character"),
|
||||
alloc.region(region),
|
||||
alloc.concat([alloc.reflow("Tab characters are not allowed.")]),
|
||||
alloc.reflow("Tab characters are not allowed."),
|
||||
]);
|
||||
|
||||
Report {
|
||||
|
@ -3871,6 +3871,23 @@ fn to_space_report<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
BadInputError::HasAsciiControl => {
|
||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
||||
|
||||
let doc = alloc.stack([
|
||||
alloc.reflow("I encountered an ASCII control character"),
|
||||
alloc.region(region),
|
||||
alloc.reflow("ASCII control characters are not allowed."),
|
||||
]);
|
||||
|
||||
Report {
|
||||
filename,
|
||||
doc,
|
||||
title: "ASII CONTROL CHARACTER".to_string(),
|
||||
severity: Severity::RuntimeError,
|
||||
}
|
||||
}
|
||||
|
||||
_ => todo!("unhandled type parse error: {:?}", &parse_problem),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue