Open oxcrow opened 1 month ago
I might have fixed it.
This is a rust specific issue, and it can be resolved using r#type
. i.e
#[derive(Debug, Clone, FromPest)]
#[pest_ast(rule(Rule::r#type))] // <<< using r#type tells rust to not treat this as a keyword
pub enum Type {
Int(Int),
Id(Id),
}
This compiles correctly, although I need to do more tests to verify if everything is working correctly.
I don't think pest, or pest-ast created this issue, but documenting this issue maybe helpful for future users.
And it might be possible for pest maintainers to pattern match on the procedural macro attributes, and handle these cases internally by using r#ident
.
It is little bit more extra work for pest maintainers, but might provide a more comfortable experience for future users.
I need to do more tests, to see if this works correctly.
Thanks.
Hi everyone,
pest and pest-derived seem to accept grammar that has rust's reserved keywords, such as
type
,struct
,mod
etc.However, pest-ast fails.
Can this be fixed?
Thanks!