You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pest and pest-derived seem to accept grammar that has rust's reserved keywords, such as type, struct, mod etc.
However, pest-ast fails.
#[derive(Debug,Clone,FromPest)]#[pest_ast(rule(Rule::type))]// <<< Causes issue, and fails to compile, since type is a reserved keywordpubenumType{Int(Int),Id(Id),}
Can this be fixed?
Thanks!
The text was updated successfully, but these errors were encountered:
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 keywordpubenumType{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.
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!
The text was updated successfully, but these errors were encountered: