Yes. My example is with type_qualifier because it's what I happend to have in my code. Replace it by "argument" or whatever you want - it's a generic way to collect lists of arbitrary length in PLY.
On Aug 22, 12:37 pm, Davy <[EMAIL PROTECTED]> wrote: > Hi Eli, > > Thank you! > Let us make it more clear, do you mean type_qualifier is a token list > like type_qualifier = ['MOD0','MOD1',...,'MODn'] > > Best regards, > Davy > > On Aug 22, 12:53 pm, eliben <[EMAIL PROTECTED]> wrote: > > > def p_type_qualifier_list(self, p): > > """ type_qualifier_list : type_qualifier > > | type_qualifier_list type_qualifier > > """ > > > This will capture a list of any length of 'type_qualifier'. When it's > > captured, analyze it, make sure it's the right length, or whatever. > > > Eli > > > On Aug 22, 3:33 am, Davy <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > > > When unpacking the optional token like the form in EBNF: > > > INSTR[MOD0][MOD1]...[MODn] ARGS > > > MOD0 to MODn must be in this order. > > > > Shall I use the recursive rule like: > > > INSTR_MOD0 = INSTR MOD0 | INSTR > > > INSTR_MOD0_MOD1 = INSTR_MOD0 MOD1 | INSTR_MOD0 > > > ... ... > > > > It's really too hard for human being to write when n is very large. Is > > > there any better rule writing style? > > > > Best regards, > > > Davy- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ply-hack" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/ply-hack?hl=en -~----------~----~----~----~------~----~------~--~---
