Implement initial tuple syntax

This commit is contained in:
Joshua Warner 2022-11-05 17:39:13 -04:00
parent 9abed3472a
commit 1753c9cf5b
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
11 changed files with 152 additions and 52 deletions

View file

@ -1007,6 +1007,26 @@ fn to_expr_in_parens_report<'a>(
expr,
pos,
),
EInParens::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 expression or tuple:"),
alloc.region_with_subregion(lines.convert_region(surroundings), region),
alloc.concat([
alloc.reflow(r"I was expecting to see an expression next."),
alloc.reflow(r"Note, Roc doesn't use '()' as a null type."),
]),
]);
Report {
filename,
doc,
title: "EMPTY PARENTHESES".to_string(),
severity: Severity::RuntimeError,
}
}
EInParens::End(pos) | EInParens::IndentEnd(pos) => {
let surroundings = Region::new(start, pos);
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));