Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix raw ident format to invalid ident (#378) #379

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(()));
}
Loading