Re: [Pyparsing] Getting "maximum recursion depth exceeded" when using Forward
Brought to you by:
ptmcg
From: Paul M. <pt...@au...> - 2015-09-02 07:58:44
|
Sorry, I'm always getting these backwards if I don't look them up! AND takes precedence over OR. I had this backwards. The bool_expr part of the program should be: boolExpr = Forward() operand = boolcomparison | LPAR + boolExpr + RPAR and_term = Group(operand + ZeroOrMore(AND + operand)) or_term = Group(and_term + ZeroOrMore(OR + and_term)) boolExpr << or_term I'll add in NOT processing for you (NOT is highest precedence): NOT,AND,OR = map(CaselessKeyword, "NOT AND OR".split()) And change: operand = boolcomparison | LPAR + boolExpr + RPAR to: operand = Optional(NOT) + (boolcomparison | LPAR + boolExpr + RPAR) Sorry for the confusion! -- Paul -----Original Message----- From: mayamatakeshi [mailto:may...@gm...] Sent: Tuesday, September 01, 2015 11:48 PM To: Paul McGuire <pt...@au...> Cc: pyp...@li... Subject: Re: [Pyparsing] Getting "maximum recursion depth exceeded" when using Forward Paul, it was exactly what I wanted to achieve! Thanks a lot. R, Takeshi --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus |