How do I implement this in ply, given how pyparsing works
问题 I'm trying to implement something in ply, which I'm very new to, based on what I have done in pyparsing, which I'm also quite new to. How can I write a simple nesting search such as this: thecontent = pyparsing.Word(pyparsing.alphanums) | '&' | '|' parens = pyparsing.nestedExpr( '(', ')', content=thecontent) By using PLY? 回答1: What you have written in pyparsing does not translate well to PLY because, well, it's barely even a parser. nestedExpr is a helper for quickly defining an expression of