コード例 #1
0
 def match(self, text_iterator: TextIterator):
     for df in self._objList:
         text_iterator.skip_whitespace()
         if df.match(text_iterator):
             self._chosen = df
             return True
     return False
コード例 #2
0
 def match(self, text_iterator: TextIterator):
     try:
         text_iterator.skip_whitespace()
         self._start_pos = text_iterator.current_pos().copy()
         self._text = ''
         while not text_iterator.is_after_end():
             if text_iterator.is_valid_pos():
                 self._text += next(text_iterator)
             if text_iterator.current_pos().r > self._start_pos.r:
                 break
             self._last_pos = text_iterator.current_pos().copy()
     except StopIteration:
         log.debug("GAny - StopIteration")
     return len(self._text) > 0