Skip to content

Commit

Permalink
Merge pull request #379 from A4-Tacks/fix-raw_ident_format_failed
Browse files Browse the repository at this point in the history
Fix raw ident format to invalid ident (#378)
  • Loading branch information
kevinmehall authored Jul 9, 2024
2 parents d888952 + e5c473a commit 8aa2de0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion peg-macros/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ fn compile_rule_export(context: &Context, rule: &Rule) -> TokenStream {
..
} = rule;
let ret_ty = rule.ret_type.clone().unwrap_or_else(|| quote!(()));
let parse_fn = format_ident!("__parse_{}", rule.name.to_string(), span = name.span());
let parse_fn = format_ident!("__parse_{}", rule.name, span = name.span());
let ty_params = ty_params_slice(&rule.ty_params);
let where_clause = rule.where_clause.as_ref().into_iter();
let rule_params = rule_params_list(context, rule);
Expand Down
12 changes: 12 additions & 0 deletions tests/run-pass/raw_ident.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extern crate peg;
use peg::parser;

parser!{
pub grammar g() for str {
pub rule r#break() = "foo"
}
}

fn main() {
assert_eq!(g::r#break("foo"), Ok(()));
}

0 comments on commit 8aa2de0

Please sign in to comment.