Implement tuple pattern parsing

Step 2 of N in implementing #4465
This commit is contained in:
Joshua Warner 2022-11-11 14:18:53 -05:00
parent 5f74e10d32
commit ca5d084497
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
17 changed files with 369 additions and 25 deletions

View file

@ -2086,6 +2086,27 @@ fn to_pattern_in_parens_report<'a>(
}
}
PInParens::Empty(pos) => {
let surroundings = Region::new(start, pos);
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
let doc = alloc.stack([
alloc.reflow("I am partway through parsing a parenthesized pattern or tuple:"),
alloc.region_with_subregion(lines.convert_region(surroundings), region),
alloc.concat([
alloc.reflow(r"I was expecting to see a pattern next."),
alloc.reflow(r"Note, Roc doesn't use '()' as a null type."),
]),
]);
Report {
filename,
doc,
title: "EMPTY PARENTHESES".to_string(),
severity: Severity::RuntimeError,
}
}
PInParens::End(pos) => {
let surroundings = Region::new(start, pos);
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));