[Pyparsing] Using both Forward and operatorPrecedence()
Brought to you by:
ptmcg
From: ThanhVu (V. N. <ngu...@gm...> - 2010-03-24 21:58:01
|
Hi, I tried to generate this simple recursive rule that involves both Forward and operatorPrecedence() and get errors about maximum recursion depth exceeded . Thanks, def getRule_test(): #rule exp = name | num | name[exp] | exp + exp | exp * exp | name = Word(alphas) num = Word(nums) exp = Forward() idx=name + '[' + exp + ']' arith = operatorPrecedence( exp,[('*',2,opAssoc.LEFT), ('+',2,opAssoc.RIGHT)],) exp << (arith|idx|name|num) #works ok if take out arith return exp VN - |