Skip to content

Commit

Permalink
fix: issue with control letters.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Sep 2, 2024
1 parent c46f0fc commit 7c5d4b2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions crates/oxc_regular_expression/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,11 @@ fn character_to_string(
let Some(ch) = char::from_u32(cp) else { panic!("Invalid `Character` `{cp}`!") };
let result = match this.kind {
CharacterKind::ControlLetter => match ch {
'f' => r"\cL",
'\n' => r"\cJ",
'\r' => r"\cM",
'\t' => r"\cI",
'v' => r"\cK",
_ => panic!("Unknown control letter `{ch}`"),
}
.to_string(),
'\n' => r"\cJ".to_string(),
'\r' => r"\cM".to_string(),
'\t' => r"\cI".to_string(),
_ => format!(r"\c{ch}"),
},
CharacterKind::Identifier => {
format!(r"\{ch}")
}
Expand Down

0 comments on commit 7c5d4b2

Please sign in to comment.