mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
parameterize Parser on an Error type
This commit is contained in:
parent
da28486184
commit
148fffe969
17 changed files with 372 additions and 271 deletions
|
@ -3,12 +3,12 @@ use crate::expr;
|
|||
use crate::parser::Progress::*;
|
||||
use crate::parser::{
|
||||
allocated, ascii_char, ascii_hex_digits, loc, parse_utf8, unexpected, unexpected_eof, Bag,
|
||||
FailReason, ParseResult, Parser, State,
|
||||
ParseResult, Parser, State, SyntaxError,
|
||||
};
|
||||
use bumpalo::collections::vec::Vec;
|
||||
use bumpalo::Bump;
|
||||
|
||||
pub fn parse<'a>() -> impl Parser<'a, StrLiteral<'a>> {
|
||||
pub fn parse<'a>() -> impl Parser<'a, StrLiteral<'a>, SyntaxError> {
|
||||
use StrLiteral::*;
|
||||
|
||||
move |arena: &'a Bump, mut state: State<'a>| {
|
||||
|
@ -256,7 +256,7 @@ fn parse_block_string<'a, I>(
|
|||
arena: &'a Bump,
|
||||
state: State<'a>,
|
||||
bytes: &mut I,
|
||||
) -> ParseResult<'a, StrLiteral<'a>>
|
||||
) -> ParseResult<'a, StrLiteral<'a>, SyntaxError>
|
||||
where
|
||||
I: Iterator<Item = &'a u8>,
|
||||
{
|
||||
|
@ -294,7 +294,7 @@ where
|
|||
Bag::from_state(
|
||||
arena,
|
||||
&state,
|
||||
FailReason::NotYetImplemented(format!(
|
||||
SyntaxError::NotYetImplemented(format!(
|
||||
"TODO parse this line in a block string: {:?}",
|
||||
line
|
||||
)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue