示例#1
0
 def ParseIsBlock(self):
     """Returns a CharClass corresponding to one of the Unicode blocks."""
     block = []
     while self.IsBlockClass.test(self.the_char):
         block.append(self.the_char)
         self.next_char()
     block = string.join(block, '')
     if block.startswith("Is"):
         try:
             return CharClass.ucd_block(block[2:])
         except KeyError:
             raise RegularExpressionError(
                 "Invalid IsBlock name: %s" % block[2:])
     else:
         raise RegularExpressionError("Expected IsBlock [%i]" % self.pos)