Un-macro map_with_arena

This commit is contained in:
Jackson Wambolt 2024-04-15 20:35:08 -05:00
parent f6c977fb96
commit a9724dda5e
No known key found for this signature in database
GPG key ID: 76F29A42FEE8811C
5 changed files with 74 additions and 124 deletions

View file

@ -4,8 +4,9 @@ use crate::ident::{lowercase_ident, parse_ident, Accessor, Ident};
use crate::keyword;
use crate::parser::Progress::{self, *};
use crate::parser::{
self, backtrackable, byte, fail_when, loc, map, optional, skip_first, specialize_err,
specialize_err_ref, then, three_bytes, two_bytes, EPattern, PInParens, PList, PRecord, Parser,
self, backtrackable, byte, fail_when, loc, map, map_with_arena, optional, skip_first,
specialize_err, specialize_err_ref, then, three_bytes, two_bytes, EPattern, PInParens, PList,
PRecord, Parser,
};
use crate::state::State;
use crate::string_literal::StrLikeLiteral;
@ -255,7 +256,7 @@ fn number_pattern_help<'a>() -> impl Parser<'a, Pattern<'a>, EPattern<'a>> {
fn string_like_pattern_help<'a>() -> impl Parser<'a, Pattern<'a>, EPattern<'a>> {
specialize_err(
|_, pos| EPattern::Start(pos),
map_with_arena!(
map_with_arena(
crate::string_literal::parse_str_like_literal(),
|arena, lit| match lit {
StrLikeLiteral::Str(s) => Pattern::StrLiteral(s),
@ -263,7 +264,7 @@ fn string_like_pattern_help<'a>() -> impl Parser<'a, Pattern<'a>, EPattern<'a>>
// TODO: preserve the original escaping
Pattern::SingleQuote(s.to_str_in(arena))
}
}
},
),
)
}