mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
remove more syntax errors
This commit is contained in:
parent
b688fd11a9
commit
e815e57dcf
5 changed files with 37 additions and 30 deletions
|
@ -172,6 +172,8 @@ enum Node {
|
|||
IfElseBranch,
|
||||
ListElement,
|
||||
InsideParens,
|
||||
RecordConditionalDefault,
|
||||
StringFormat,
|
||||
}
|
||||
|
||||
fn to_expr_report<'a>(
|
||||
|
@ -343,6 +345,8 @@ fn to_expr_report<'a>(
|
|||
]),
|
||||
),
|
||||
Node::ListElement => (r, c, alloc.text("a list")),
|
||||
Node::RecordConditionalDefault => (r, c, alloc.text("record field default")),
|
||||
Node::StringFormat => (r, c, alloc.text("a string format")),
|
||||
Node::InsideParens => (r, c, alloc.text("some parentheses")),
|
||||
},
|
||||
Context::InDef(r, c) => (r, c, alloc.text("a definition")),
|
||||
|
@ -662,7 +666,7 @@ fn to_unfinished_lambda_report<'a>(
|
|||
fn to_str_report<'a>(
|
||||
alloc: &'a RocDocAllocator<'a>,
|
||||
filename: PathBuf,
|
||||
_context: Context,
|
||||
context: Context,
|
||||
parse_problem: &roc_parse::parser::EString<'a>,
|
||||
start_row: Row,
|
||||
start_col: Col,
|
||||
|
@ -671,7 +675,14 @@ fn to_str_report<'a>(
|
|||
|
||||
match *parse_problem {
|
||||
EString::Open(_row, _col) => unreachable!("another branch would be taken"),
|
||||
EString::Format(syntax, row, col) => to_syntax_report(alloc, filename, syntax, row, col),
|
||||
EString::Format(expr, row, col) => to_expr_report(
|
||||
alloc,
|
||||
filename,
|
||||
Context::InNode(Node::StringFormat, start_row, start_col, Box::new(context)),
|
||||
expr,
|
||||
row,
|
||||
col,
|
||||
),
|
||||
EString::Space(error, row, col) => to_space_report(alloc, filename, &error, row, col),
|
||||
EString::UnknownEscape(row, col) => {
|
||||
let surroundings = Region::from_rows_cols(start_row, start_col, row, col);
|
||||
|
@ -885,7 +896,6 @@ fn to_list_report<'a>(
|
|||
use roc_parse::parser::List;
|
||||
|
||||
match *parse_problem {
|
||||
List::Syntax(syntax, row, col) => to_syntax_report(alloc, filename, syntax, row, col),
|
||||
List::Space(error, row, col) => to_space_report(alloc, filename, &error, row, col),
|
||||
|
||||
List::Expr(expr, row, col) => to_expr_report(
|
||||
|
@ -994,7 +1004,6 @@ fn to_if_report<'a>(
|
|||
use roc_parse::parser::If;
|
||||
|
||||
match *parse_problem {
|
||||
If::Syntax(syntax, row, col) => to_syntax_report(alloc, filename, syntax, row, col),
|
||||
If::Space(error, row, col) => to_space_report(alloc, filename, &error, row, col),
|
||||
|
||||
If::Condition(expr, row, col) => to_expr_report(
|
||||
|
@ -1165,7 +1174,6 @@ fn to_when_report<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
When::Syntax(syntax, row, col) => to_syntax_report(alloc, filename, syntax, row, col),
|
||||
When::Space(error, row, col) => to_space_report(alloc, filename, &error, row, col),
|
||||
|
||||
When::Branch(expr, row, col) => to_expr_report(
|
||||
|
@ -1558,7 +1566,20 @@ fn to_precord_report<'a>(
|
|||
PRecord::Pattern(pattern, row, col) => {
|
||||
to_pattern_report(alloc, filename, pattern, row, col)
|
||||
}
|
||||
PRecord::Syntax(syntax, row, col) => to_syntax_report(alloc, filename, syntax, row, col),
|
||||
|
||||
PRecord::Expr(expr, row, col) => to_expr_report(
|
||||
alloc,
|
||||
filename,
|
||||
Context::InNode(
|
||||
Node::RecordConditionalDefault,
|
||||
start_row,
|
||||
start_col,
|
||||
Box::new(Context::InDef(row, col)),
|
||||
),
|
||||
expr,
|
||||
row,
|
||||
col,
|
||||
),
|
||||
|
||||
PRecord::IndentOpen(row, col) => {
|
||||
let surroundings = Region::from_rows_cols(start_row, start_col, row, col);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue