Hi, this part is probably your issue:
TypeName: Identifier /TypeName . Identifier
If your TypeDeclSpecifier starts out with something that isn't an Identifier, then the TypeName: will fail the first choice (Identifier), then try the second choice - which immediately calls TypeName again, which will fail the first choice (Identifier) and call itself again - and so on until it crashes or you break the processing.
In general, any time that a parser can start out by calling itself directly (without some other action occurring before), it will probably go into a loop. (This might be something that would be nice to have PetitParser catch - infinite loops. Not easy, probably not cheap, but doable.)
Also, you generally want to make the most specific option first in your parsers - if TypeName could be 'Identifier' or 'Identifier . Identifier', then you would want to check for 'Identifier . Identifier' first.
-cbc
On Tue, Dec 17, 2013 at 2:22 PM, Benjamin AREZKI benjamin.arezki@gmail.comwrote:
Hi,
To explain my problem I will take this sample , my parser is a PPCompositeParser.
ClassOrInterfaceType: ClassType / InterfaceType
ClassType:TypeDeclSpecifier, TypeArgumentsopt
InterfaceType: TypeDeclSpecifier, TypeArgumentsopt
TypeDeclSpecifier: TypeName / ClassOrInterfaceType . Identifier
TypeName: Identifier /TypeName . Identifier
Ok, so Identifier works well, no problem but when I tested typeDeclSpecifier, I lost the contral of Pharo but I don't know why because I use a PPCompositeParser. For the moment I use some tricks but I would like it works normally.
Thanks for your help.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev