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

Generic input lifetime for grammar #220

Closed
PurpleMyst opened this issue Mar 1, 2020 · 2 comments
Closed

Generic input lifetime for grammar #220

PurpleMyst opened this issue Mar 1, 2020 · 2 comments
Labels
feature Something not supported that perhaps should be

Comments

@PurpleMyst
Copy link

Hi, I have a type Tokens<'code> in my code that wants to use rust-peg's parser! proc-macro, however I can't figure out how to do something like the following:

peg::parser! {
    grammar feeny<'a>() for Tokens<'a> {
        // snip
    }
}

Is there a way to do this?

@kevinmehall
Copy link
Owner

Not currently. There is support for type and lifetime parameters on rules, but not on the grammar as a whole.

Implementing it would take adding rust_ty_params() to the peg_grammar rule in the meta-grammar, and then threading that through to the right places in the output.

@kevinmehall kevinmehall added the feature Something not supported that perhaps should be label Mar 1, 2020
@PurpleMyst
Copy link
Author

Is this particularly difficult? I'd be willing to do it with a small bit of mentoring

kevinmehall added a commit that referenced this issue Mar 14, 2021
Accept type parameters on grammar (e.g. lifetimes) (Fixes #220)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Something not supported that perhaps should be
Projects
None yet
Development

No branches or pull requests

2 participants