コード例 #1
0
 def _setup_precedence_when_not_trivial(self):
     self._set_end_first_group_in_components()
     if self._end_current_group == len(self._components):
         self._current_node = None
     else:
         self._current_node = to_node(
             self._components[self._end_current_group])
コード例 #2
0
 def _set_next_end_group_and_node(self):
     if isinstance(self._current_node, Operator):
         self._end_current_group += 1
     self._set_end_first_group_in_components(self._end_current_group)
     if self._end_current_group < len(self._components):
         self._current_node = to_node(
             self._components[self._end_current_group])
コード例 #3
0
 def _setup_non_trivial_regex(self):
     self._set_end_first_group_in_components()
     next_node = to_node(self._components[self._end_current_group])
     if isinstance(next_node, KleeneStar):
         self.head = next_node
         self.sons.append(
             self._process_sub_regex(0, self._end_current_group))
     else:
         begin_second_group = self._end_current_group
         if isinstance(next_node, Symbol):
             self.head = Concatenation()
         else:
             self.head = next_node
             begin_second_group += 1
         self.sons.append(
             self._process_sub_regex(0, self._end_current_group))
         self.sons.append(self._process_sub_regex(begin_second_group,
                                                  len(self._components)))
コード例 #4
0
 def _setup_one_symbol_regex(self):
     first_symbol = to_node(self._components[0])
     self._check_is_valid_single_first_symbol(first_symbol)
     self.head = first_symbol
コード例 #5
0
 def _setup_empty_regex(self):
     self.head = to_node("")