示例#1
0
文件: ranger.py 项目: qinguoan/rambo
 def range(self):
     x = y = ''
     if self.token(''):
         BreakHere('I got a symbol')
     x = self.token()
     if not self.incr().end() and self.token('range'):
         if self.incr().token(''):
             BreakHere('I got a symbol')
         y = self.token()
         self.incr()
     if not y: y = x
     charset = CharSet()
     return charset.save(x, y)
示例#2
0
文件: ranger.py 项目: qinguoan/rambo
 def cluster(self):
     result = CharSet()
     data = list()
     query_key, intersect_key = self.query()
     q_keys = self.range_r.keys(query_key.lower())
     if q_keys:
         q_set = self.range_r.sunion(q_keys)
         if query_key == intersect_key:
             data = [[ x for x in q_set ]]
         else:
             i_keys = self.range_r.keys(intersect_key.lower())
             if i_keys:
                 i_set = self.range_r.sunion(i_keys)
                 data = [[x for x in q_set if x not in i_set]]
             else:
                 data = [[x for x in q_set]]
     if data:
         return result.save(*data)
     else:
         return CharSet()