mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Graccefully handle overflowing unicode literals
This commit is contained in:
parent
a83f44188b
commit
6ef87b3b9d
11 changed files with 106 additions and 27 deletions
|
@ -3872,13 +3872,17 @@ fn apply_expr_access_chain<'a>(
|
|||
}
|
||||
|
||||
fn string_like_literal_help<'a>() -> impl Parser<'a, Expr<'a>, EString<'a>> {
|
||||
map_with_arena(
|
||||
then(
|
||||
crate::string_literal::parse_str_like_literal(),
|
||||
|arena, lit| match lit {
|
||||
StrLikeLiteral::Str(s) => Expr::Str(s),
|
||||
|arena, state, progress, lit| match lit {
|
||||
StrLikeLiteral::Str(s) => Ok((progress, Expr::Str(s), state)),
|
||||
StrLikeLiteral::SingleQuote(s) => {
|
||||
// TODO: preserve the original escaping
|
||||
Expr::SingleQuote(s.to_str_in(arena))
|
||||
Ok((
|
||||
progress,
|
||||
Expr::SingleQuote(s.to_str_in(arena).map_err(|e| (MadeProgress, e))?),
|
||||
state,
|
||||
))
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue