Get a character set with individual members or ranges.

        Current index is on '[', the start of the character set.

def getCharacterSet(self):
        '''Get a character set with individual members or ranges.

        Current index is on '[', the start of the character set.

        '''
        
        chars = u''
        c = None
        cnt = 1
        start = 0

        while True:
            escaped_slash = False
            c = self.next()
            # print "pattern   : ", self.pattern
            # print "C         : ", c
            # print "Slash     : ", c == u'\\'
            # print 'chars     : ', chars
            # print 'index     : ', self.index
            # print 'last      : ', self.last()
            # print 'lookahead : ', self.lookahead()
            if self.lookahead() == u'-' and not c == u'\\':
                f = c
                self.next()  # skip hyphen
                c = self.next()  # get far range
                if not c or (c in self.meta_chars):
                    raise StringGenerator.SyntaxError(u"unexpected end of class range")
                chars += self.getCharacterRange(f, c)
            elif c == u'\\':
                if self.lookahead() in self.meta_chars:
                    c = self.next()
                    chars += c
                    continue
                elif self.lookahead() in self.string_code:
                    c = self.next()
                    chars += self.string_code[c]
            elif c and c not in self.meta_chars:
                chars += c
            if c == u']': 
                if self.lookahead() == u'{':
                    [start, cnt] = self.getQuantifier()
                else:
                    start = -1
                    cnt = 1
                break
            if c and c in self.meta_chars and not self.last() == u"\\":
                raise StringGenerator.SyntaxError(u"Un-escaped character in class definition: %s" % c)
            if not c:
                break

        return StringGenerator.CharacterSet(chars, start, cnt)