(opener="(", closer=")", content=None, ignoreExpr=quotedString)
return ret
Helper method for defining nested lists enclosed in opening and closing
       delimiters ("(" and ")" are the default).

       Parameters:
        - opener - opening character for a nested list (default="("); can also be a pyparsing expression
        - closer - closing character for a nested list (default=")"); can also be a pyparsing expression
        - content - expression for items within the nested lists (default=None)
        - ignoreExpr - expression for ignoring opening and closing delimiters (default=quotedString)

       If an expression is not provided for the content argument, the nested
       expression will capture all whitespace-delimited content between delimiters
       as a list of separate values.

       Use the ignoreExpr argument to define expressions that may contain
       opening or closing characters that should not be treated as opening
       or closing characters for nesting, such as quotedString or a comment
       expression.  Specify multiple expressions using an Or or MatchFirst.
       The default is quotedString, but if no expressions are to be ignored,
       then pass None for this argument.
Helper method for defining nested lists enclosed in opening and closing
       delimiters ("(" and ")" are the default).
Helper method for defining nested lists enclosed in opening and closing delimiters ( ( and ) are the default ) .
def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString):
    """Helper method for defining nested lists enclosed in opening and closing
       delimiters ("(" and ")" are the default).

       Parameters:
        - opener - opening character for a nested list (default="("); can also be a pyparsing expression
        - closer - closing character for a nested list (default=")"); can also be a pyparsing expression
        - content - expression for items within the nested lists (default=None)
        - ignoreExpr - expression for ignoring opening and closing delimiters (default=quotedString)

       If an expression is not provided for the content argument, the nested
       expression will capture all whitespace-delimited content between delimiters
       as a list of separate values.

       Use the ignoreExpr argument to define expressions that may contain
       opening or closing characters that should not be treated as opening
       or closing characters for nesting, such as quotedString or a comment
       expression.  Specify multiple expressions using an Or or MatchFirst.
       The default is quotedString, but if no expressions are to be ignored,
       then pass None for this argument.
    """
    if opener == closer:
        raise ValueError("opening and closing strings cannot be the same")
    if content is None:
        if isinstance(opener,basestring) and isinstance(closer,basestring):
            if len(opener) == 1 and len(closer)==1:
                if ignoreExpr is not None:
                    content = (Combine(OneOrMore(~ignoreExpr +
                                    CharsNotIn(opener+closer+ParserElement.DEFAULT_WHITE_CHARS,exact=1))
                                ).setParseAction(lambda t:t[0].strip()))
                else:
                    content = (empty+CharsNotIn(opener+closer+ParserElement.DEFAULT_WHITE_CHARS
                                ).setParseAction(lambda t:t[0].strip()))
            else:
                if ignoreExpr is not None:
                    content = (Combine(OneOrMore(~ignoreExpr + 
                                    ~Literal(opener) + ~Literal(closer) +
                                    CharsNotIn(ParserElement.DEFAULT_WHITE_CHARS,exact=1))
                                ).setParseAction(lambda t:t[0].strip()))
                else:
                    content = (Combine(OneOrMore(~Literal(opener) + ~Literal(closer) +
                                    CharsNotIn(ParserElement.DEFAULT_WHITE_CHARS,exact=1))
                                ).setParseAction(lambda t:t[0].strip()))
        else:
            raise ValueError("opening and closing arguments must be strings if no content expression is given")
    ret = Forward()
    if ignoreExpr is not None:
        ret << Group( Suppress(opener) + ZeroOrMore( ignoreExpr | ret | content ) + Suppress(closer) )
    else:
        ret << Group( Suppress(opener) + ZeroOrMore( ret | content )  + Suppress(closer) )
    return ret
def nestedExpr ( opener = "(" , closer = ")" , content = None , ignoreExpr = quotedString ) : if opener == closer : raise ValueError ( "opening and closing strings cannot be the same" ) if content is None : if isinstance ( opener , basestring ) and isinstance ( closer , basestring ) : if len ( opener ) == 1 and len ( closer ) == 1 : if ignoreExpr is not None : content = ( Combine ( OneOrMore ( ~ ignoreExpr + CharsNotIn ( opener + closer + ParserElement . DEFAULT_WHITE_CHARS , exact = 1 ) ) ) . setParseAction ( lambda t : t [ 0 ] . strip ( ) ) ) else : content = ( empty + CharsNotIn ( opener + closer + ParserElement . DEFAULT_WHITE_CHARS ) . setParseAction ( lambda t : t [ 0 ] . strip ( ) ) ) else : if ignoreExpr is not None : content = ( Combine ( OneOrMore ( ~ ignoreExpr + ~ Literal ( opener ) + ~ Literal ( closer ) + CharsNotIn ( ParserElement . DEFAULT_WHITE_CHARS , exact = 1 ) ) ) . setParseAction ( lambda t : t [ 0 ] . strip ( ) ) ) else : content = ( Combine ( OneOrMore ( ~ Literal ( opener ) + ~ Literal ( closer ) + CharsNotIn ( ParserElement . DEFAULT_WHITE_CHARS , exact = 1 ) ) ) . setParseAction ( lambda t : t [ 0 ] . strip ( ) ) ) else : raise ValueError ( "opening and closing arguments must be strings if no content expression is given" ) ret = Forward ( ) if ignoreExpr is not None : ret << Group ( Suppress ( opener ) + ZeroOrMore ( ignoreExpr | ret | content ) + Suppress ( closer ) ) else : ret << Group ( Suppress ( opener ) + ZeroOrMore ( ret | content ) + Suppress ( closer ) ) return ret