mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-18 19:10:18 +00:00
Merge remote-tracking branch 'origin/main' into packages
This commit is contained in:
commit
d022c19f5c
24 changed files with 392 additions and 490 deletions
|
@ -64,7 +64,7 @@ pub enum SyntaxError<'a> {
|
|||
Space(BadInputError),
|
||||
NotEndOfFile(Position),
|
||||
}
|
||||
pub trait SpaceProblem {
|
||||
pub trait SpaceProblem: std::fmt::Debug {
|
||||
fn space_problem(e: BadInputError, pos: Position) -> Self;
|
||||
}
|
||||
|
||||
|
@ -266,6 +266,8 @@ pub enum EGeneratesWith {
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum BadInputError {
|
||||
HasTab,
|
||||
HasMisplacedCarriageReturn,
|
||||
HasAsciiControl,
|
||||
///
|
||||
TooManyLines,
|
||||
///
|
||||
|
@ -273,15 +275,6 @@ pub enum BadInputError {
|
|||
BadUtf8,
|
||||
}
|
||||
|
||||
pub fn bad_input_to_syntax_error<'a>(bad_input: BadInputError) -> SyntaxError<'a> {
|
||||
use crate::parser::BadInputError::*;
|
||||
match bad_input {
|
||||
HasTab => SyntaxError::NotYetImplemented("call error on tabs".to_string()),
|
||||
TooManyLines => SyntaxError::TooManyLines,
|
||||
BadUtf8 => SyntaxError::BadUtf8,
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> SourceError<'a, T> {
|
||||
pub fn new(problem: T, state: &State<'a>) -> Self {
|
||||
Self {
|
||||
|
@ -324,6 +317,8 @@ impl<'a> SyntaxError<'a> {
|
|||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum EExpr<'a> {
|
||||
TrailingOperator(Position),
|
||||
|
||||
Start(Position),
|
||||
End(Position),
|
||||
BadExprEnd(Position),
|
||||
|
@ -561,6 +556,7 @@ pub enum EPattern<'a> {
|
|||
Record(PRecord<'a>, Position),
|
||||
List(PList<'a>, Position),
|
||||
Underscore(Position),
|
||||
NotAPattern(Position),
|
||||
|
||||
Start(Position),
|
||||
End(Position),
|
||||
|
@ -774,7 +770,7 @@ pub struct FileError<'a, T> {
|
|||
pub trait Parser<'a, Output, Error> {
|
||||
fn parse(
|
||||
&self,
|
||||
alloc: &'a Bump,
|
||||
arena: &'a Bump,
|
||||
state: State<'a>,
|
||||
min_indent: u32,
|
||||
) -> ParseResult<'a, Output, Error>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue