(arg)
return(object_re, name_re, subname_re)
Internal utility to parse a pretty-printer command argv.

    Arguments:
        arg: The arguments to the command.  The format is:
             [object-regexp [name-regexp]].
             Individual printers in a collection are named as
             printer-name;subprinter-name.

    Returns:
        The result is a 3-tuple of compiled regular expressions, except that
        the resulting compiled subprinter regexp is None if not provided.

    Raises:
        SyntaxError: an error processing ARG
Internal utility to parse a pretty-printer command argv.
Internal utility to parse a pretty - printer command argv .
def parse_printer_regexps(arg):
    """Internal utility to parse a pretty-printer command argv.

    Arguments:
        arg: The arguments to the command.  The format is:
             [object-regexp [name-regexp]].
             Individual printers in a collection are named as
             printer-name;subprinter-name.

    Returns:
        The result is a 3-tuple of compiled regular expressions, except that
        the resulting compiled subprinter regexp is None if not provided.

    Raises:
        SyntaxError: an error processing ARG
    """

    argv = gdb.string_to_argv(arg);
    argc = len(argv)
    object_regexp = ""  # match everything
    name_regexp = ""  # match everything
    subname_regexp = None
    if argc > 3:
        raise SyntaxError("too many arguments")
    if argc >= 1:
        object_regexp = argv[0]
    if argc >= 2:
        name_subname = argv[1].split(";", 1)
        name_regexp = name_subname[0]
        if len(name_subname) == 2:
            subname_regexp = name_subname[1]
    # That re.compile raises SyntaxError was determined empirically.
    # We catch it and reraise it to provide a slightly more useful
    # error message for the user.
    try:
        object_re = re.compile(object_regexp)
    except SyntaxError:
        raise SyntaxError("invalid object regexp: %s" % object_regexp)
    try:
        name_re = re.compile (name_regexp)
    except SyntaxError:
        raise SyntaxError("invalid name regexp: %s" % name_regexp)
    if subname_regexp is not None:
        try:
            subname_re = re.compile(subname_regexp)
        except SyntaxError:
            raise SyntaxError("invalid subname regexp: %s" % subname_regexp)
    else:
        subname_re = None
    return(object_re, name_re, subname_re)
def parse_printer_regexps ( arg ) : argv = gdb . string_to_argv ( arg ) argc = len ( argv ) object_regexp = "" # match everything name_regexp = "" # match everything subname_regexp = None if argc > 3 : raise SyntaxError ( "too many arguments" ) if argc >= 1 : object_regexp = argv [ 0 ] if argc >= 2 : name_subname = argv [ 1 ] . split ( ";" , 1 ) name_regexp = name_subname [ 0 ] if len ( name_subname ) == 2 : subname_regexp = name_subname [ 1 ] # That re.compile raises SyntaxError was determined empirically. # We catch it and reraise it to provide a slightly more useful # error message for the user. try : object_re = re . compile ( object_regexp ) except SyntaxError : raise SyntaxError ( "invalid object regexp: %s" % object_regexp ) try : name_re = re . compile ( name_regexp ) except SyntaxError : raise SyntaxError ( "invalid name regexp: %s" % name_regexp ) if subname_regexp is not None : try : subname_re = re . compile ( subname_regexp ) except SyntaxError : raise SyntaxError ( "invalid subname regexp: %s" % subname_regexp ) else : subname_re = None return ( object_re , name_re , subname_re )