Add token escaping for Rust output `r#use`

This commit is contained in:
Txreq 2024-04-04 07:38:06 +02:00
parent 3a935f5d73
commit c75480be3e
1 changed files with 6 additions and 5 deletions

View File

@ -78,11 +78,12 @@ impl CodeGen for Vec<Button> {
fmt.block("pub mod buttons", false, |fmt| {
for button in self {
writeln!(
fmt,
"pub const {}: usize = {:#X};",
button.name, button.value
)?;
let mut name = button.name.clone();
if name == "use" {
name = format!("r#{}", name);
}
writeln!(fmt, "pub const {}: usize = {:#X};", name, button.value)?;
}
Ok(())