mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Refactor ParseProblem
* Remove the `pos` field, which was always being assigned Position::default() * Remove one use of this `pos`, by removing the never-used SyntaxError::ConditionFailed variant * Adjust the other use to do what was probably intended - which is to say, pointing to the beginning of the def with the error * Rename to FileError, reuse `SourceError` as an inner field, to avoid duplicating the `bytes`
This commit is contained in:
parent
226237d1cd
commit
f22f96843e
9 changed files with 53 additions and 66 deletions
|
@ -7,8 +7,8 @@ use crate::header::{
|
|||
use crate::ident::{lowercase_ident, unqualified_ident, uppercase_ident};
|
||||
use crate::parser::Progress::{self, *};
|
||||
use crate::parser::{
|
||||
backtrackable, specialize, word1, word2, EEffects, EExposes, EHeader, EImports, EPackages,
|
||||
EProvides, ERequires, ETypedIdent, Parser, SourceError, SyntaxError,
|
||||
backtrackable, specialize, specialize_region, word1, word2, EEffects, EExposes, EHeader,
|
||||
EImports, EPackages, EProvides, ERequires, ETypedIdent, Parser, SourceError, SyntaxError,
|
||||
};
|
||||
use crate::state::State;
|
||||
use crate::string_literal;
|
||||
|
@ -31,7 +31,10 @@ pub fn module_defs<'a>() -> impl Parser<'a, Vec<'a, Loc<Def<'a>>>, SyntaxError<'
|
|||
// force that we parse until the end of the input
|
||||
let min_indent = 0;
|
||||
skip_second!(
|
||||
specialize(|e, _| SyntaxError::Expr(e), crate::expr::defs(min_indent),),
|
||||
specialize_region(
|
||||
|e, r| SyntaxError::Expr(e, r.start()),
|
||||
crate::expr::defs(min_indent),
|
||||
),
|
||||
end_of_file()
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue