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

Support non-single-pair types #11

Open
CAD97 opened this issue Nov 10, 2018 · 0 comments
Open

Support non-single-pair types #11

CAD97 opened this issue Nov 10, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@CAD97
Copy link
Collaborator

CAD97 commented Nov 10, 2018

Things like how Vec<impl FromPest> works today. FromPest is now set up such that implementations pull from the front of a cursor instead of only getting a single Pair; we should let pest-ast use this!

Basically, this is translating a silent rule from pest.

rule = _{ a ~ b ~ c }

becomes

#[derive(FromPest)]
#[pest_ast(inline(Rule))]
pub struct rule {
    pub a: a,
    pub b: b,
    pub c: c,
}

The struct attribute is temporary and bikeshedable. I don't want just the absence of a rule(..) attribute to mean that it's inline, though, as this is likely to lead to mistakenly leaving it out. The rule enum also still has to be provided somehow, as I don't think it can be inferred from children.

@CAD97 CAD97 added the enhancement New feature or request label Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant