Re: [Pyparsing] Indefinitely recursive grammar because of unaryoperation in operatorPrecedence()
Brought to you by:
ptmcg
From: Paul M. <pt...@au...> - 2009-07-06 21:40:33
|
Gustavo - Once again, your attachments are not coming through the list server, so I suggest you post to the pyparsing pastebin at pyparsing.pastebin.com. But I'll take a wild guess here. I think "not" may be being interpreted by your grammar as a valid identifier. Make sure your definition of operand includes something like: # be sure to define these as Keywords, and not Literals # if defined as Literals, an identifier like "notMyFathersOldsmobile" # would process the leading "not" as the "not" keyword true_ = Keyword("true") false_ = Keyword("false") and_ = Keyword("and") or_ = Keyword("or") not_ = Keyword("not") allKeywords = true_ | false_ | and_ | or_ | not_ identifier = ~allKeywords + Word(alphas, alphanums+"_") operand = identifier | numeric_constant | quotedString To double-check my theory, try using: operand.setDebug() And rerun your grammar to see if "not" is matching what you think it is matching. -- Paul |