new PHP Parser
Jakob Petsovits
jpetso at gmx.at
Sun Jun 8 20:39:37 UTC 2008
On Sunday, 8. June 2008, Niko Sams wrote:
> On Saturday, 7. June 2008, Jakob Petsovits wrote:
> > On Saturday, 7. June 2008, New PHP Parser wrote:
> > > parameter=functionCallParameterListElement @ COMMA | 0
> > > -> functionCallParameterList ;;
> >
> > (and similar rules)
> >
> > I found it a good idea to not have any rules that may be empty (except
> > for pseudo data processing rules), as that makes stuff more predictable
> > and slightly easier to debug. Most importantly, it prevents you from
> > having the optional zero both in the caller rule and in the called rule.
>
> you mean I should remove the "| 0" from the rule, for example:
> #parameters=functionCallParameterListElement @ COMMA ->
> functionCallParameterList ;;
> LPAREN (parameterList=functionCallParameterList | 0) RPAREN -> foo;
> instead of:
> #parameters=functionCallParameterListElement @ COMMA | 0 ->
> functionCallParameterList ;;
> LPAREN parameterList=functionCallParameterList RPAREN -> foo;
That's what I meant, yes. I didn't say you should do it that way,
I just said that I found it a good idea to put it that way.
Whether you agree with that is up to you :P
Oh, and I forgot another point for moving up the "| 0": one AST node less
in the tree for each parameter list (or for other rules working the same way).
Have fun,
Jakob
More information about the KDevelop-devel
mailing list