Open Aphexus opened 6 years ago
Also, maybe override opIndex and allow accessing without having to do .children[]
Add to ParseTree
ref ParseTree opIndex(int i) { return children[i]; }
void* state;
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.
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?