# File lib/Getopt/DelimScanner.rb, line 251
    def scanBracketed( delimiters="{([<", prefix='\s*' )
        delimiters  ||= "{([<"
        prefix      ||= '\s*'

        prefix = prefix.to_re unless prefix.kind_of?( Regexp )

        debugMsg( 1, "Scanning for bracketed text: delimiters = (%s), prefix = (%s)",
                  delimiters, prefix )

        self.matchError = nil

        # Split the left-delimiters (brackets) from the quote delimiters.

        ldel = delimiters.dup
        qdel = ldel.squeeze.split(//).find_all {|char| char =~ /["'`]/ }.join('|')
        qdel = nil if qdel.empty?
        quotelike = true if ldel =~ /q/

        # Change all instances of delimiters to the left-hand versions, and

        # strip away anything but bracketing delimiters

        ldel = ldel.tr( '[](){}<>', '[[(({{<<' ).gsub(/[^#{Regexp.quote('[\\](){}<>')}]+/, '').squeeze

        ### Now build the right-delim equivalent of the left delim string

        rdel = ldel.dup
        unless rdel.tr!( '[({<', '])}>' )
            raise DelimiterError, "Did not find a suitable bracket in delimiter: '#{delimiters}'"
        end

        # Build regexps from both bracketing delimiter strings

        ldel = ldel.split(//).collect {|ch| Regexp.quote(ch)}.join('|')
        rdel = rdel.split(//).collect {|ch| Regexp.quote(ch)}.join('|')

        depth = self.scanDepth
        result = nil
        startPos = self.pointer

        begin
            result = matchBracketed( prefix, ldel, qdel, quotelike, rdel )
        rescue MatchFailure => e
            debugMsg( depth + 1, "Match error: %s" % e.message )
            self.matchError = e.message
            self.pointer = startPos
            result = nil
        rescue => e
            self.pointer = startPos
            Kernel::raise
        end

        return result
    end