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

children to rule #258

Open
Aphexus opened this issue Oct 24, 2018 · 3 comments
Open

children to rule #258

Aphexus opened this issue Oct 24, 2018 · 3 comments

Comments

@Aphexus
Copy link

Aphexus commented Oct 24, 2018

Accessing rules after a parse is convoluted.

p.children[x].children[y].children[z]...

It would be much nicer to be able to use the rule names.

p.Rule1[x].Rule2[y].Rule[3]

This should be quite easy to do using D's dispatching and alias this?

@Aphexus
Copy link
Author

Aphexus commented Oct 24, 2018

Also, maybe override opIndex and allow accessing without having to do .children[]

@Aphexus
Copy link
Author

Aphexus commented Oct 24, 2018

Add to ParseTree

ref ParseTree opIndex(int i) { return children[i]; }
void* state;

@veelo
Copy link
Collaborator

veelo commented Oct 25, 2018

You seem to have some interesting ideas. Let me note that for several years now, Pegged development is driven by its users rather than its original creator. Philippe is usually quick to react to PRs though, and if you really want something from Pegged that it doesn't do yet, the quickest and surest way to get it is to implement it yourself and make a PR.

Worth noting is that Pegged is used to build Pegged itself, namely to generate parser.d, the parser for PEGs. See https://github.com/PhilippeSigaud/Pegged/blob/master/pegged/dev/README.md. Don't hesitate to ask me for help if you want to go this route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants