mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
WIP
This commit is contained in:
parent
7b4378219e
commit
d211ca7e61
30 changed files with 679 additions and 614 deletions
|
@ -1,4 +1,5 @@
|
|||
use roc_parse::parser::{Fail, FailReason};
|
||||
use roc_parse::parser::{Bag, DeadEnd, FailReason, ParseProblem};
|
||||
use roc_region::all::Region;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::report::{Report, RocDocAllocator};
|
||||
|
@ -7,12 +8,21 @@ use ven_pretty::DocAllocator;
|
|||
pub fn parse_problem<'b>(
|
||||
alloc: &'b RocDocAllocator<'b>,
|
||||
filename: PathBuf,
|
||||
problem: Fail,
|
||||
starting_line: u32,
|
||||
parse_problem: ParseProblem,
|
||||
) -> Report<'b> {
|
||||
use FailReason::*;
|
||||
|
||||
match problem.reason {
|
||||
ArgumentsBeforeEquals(region) => {
|
||||
let line = starting_line + parse_problem.line;
|
||||
let region = Region {
|
||||
start_line: line,
|
||||
end_line: line,
|
||||
start_col: parse_problem.column,
|
||||
end_col: parse_problem.column,
|
||||
};
|
||||
|
||||
match parse_problem.problem {
|
||||
ConditionFailed => {
|
||||
let doc = alloc.stack(vec![
|
||||
alloc.reflow("Unexpected tokens in front of the `=` symbol:"),
|
||||
alloc.region(region),
|
||||
|
@ -24,19 +34,6 @@ pub fn parse_problem<'b>(
|
|||
title: "PARSE PROBLEM".to_string(),
|
||||
}
|
||||
}
|
||||
other => {
|
||||
//
|
||||
// Unexpected(char, Region),
|
||||
// OutdentedTooFar,
|
||||
// ConditionFailed,
|
||||
// LineTooLong(u32 /* which line was too long */),
|
||||
// TooManyLines,
|
||||
// Eof(Region),
|
||||
// InvalidPattern,
|
||||
// ReservedKeyword(Region),
|
||||
// ArgumentsBeforeEquals,
|
||||
//}
|
||||
todo!("unhandled parse error: {:?}", other)
|
||||
}
|
||||
_ => todo!("unhandled parse error: {:?}", parse_problem.problem),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue