Skip to content

Commit c53d36e

Browse files
authored
Fix bug with primes in macro names (#814)
1 parent 124c4c6 commit c53d36e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

parser/src/lex.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,10 @@ fn canonicalize_primes(ident: &str) -> Ident {
18131813
}
18141814

18151815
fn place_primes(ident: &str, count: usize) -> Ident {
1816-
let mut new: Ident = ident.trim_end_matches(['\'', '′', '″', '‴']).into();
1816+
let exclams_removed = ident.trim_end_matches(['!', '‼']);
1817+
let mut new: Ident = exclams_removed
1818+
.trim_end_matches(['\'', '′', '″', '‴'])
1819+
.into();
18171820
let num_triple = count / 3;
18181821
let trailing_num = count % 3;
18191822
for _ in 0..num_triple {
@@ -1825,6 +1828,7 @@ fn place_primes(ident: &str, count: usize) -> Ident {
18251828
2 => new.push('″'),
18261829
_ => unreachable!(),
18271830
}
1831+
new.push_str(&ident[exclams_removed.len()..]);
18281832
new
18291833
}
18301834

0 commit comments

Comments
 (0)