def _parse_expr(self):
        """
        Generate sentence token trees from the current position to
        the next closing parentheses / end of the list and return it
        ['1', '(', '2', '|', '3, ')'] -> ['1', [['2'], ['3']]]
        ['2', '|', '3'] -> [['2'], ['3']]
        """
        # List of all generated sentences
        sentence_list = []
        # Currently active sentence
        cur_sentence = []
        sentence_list.append(Sentence(cur_sentence))
        # Determine which form the current expression has
        while self._current_position < len(self.tokens):
            cur = self.tokens[self._current_position]
            self._current_position += 1
            if cur == '(':
                # Parse the subexpression
                subexpr = self._parse_expr()
                # Check if the subexpression only has one branch
                # -> If so, append "(" and ")" and add it as is
                normal_brackets = False
                if len(subexpr.tree()) == 1:
                    normal_brackets = True
                    cur_sentence.append(Word('('))
                # add it to the sentence
                cur_sentence.append(subexpr)
                if normal_brackets:
                    cur_sentence.append(Word(')'))
            elif cur == '|':
                # Begin parsing a new sentence
                cur_sentence = []
                sentence_list.append(Sentence(cur_sentence))
            elif cur == ')':
                # End parsing the current subexpression
                break
            # TODO anything special about {sth}?
            else:
                cur_sentence.append(Word(cur))
        return Options(sentence_list)
def _parse_expr(self):
        """
        Generate sentence token trees from the current position to
        the next closing parentheses / end of the list and return it
        ['1', '(', '2', '|', '3, ')'] -> ['1', [['2'], ['3']]]
        ['2', '|', '3'] -> [['2'], ['3']]
        """
        # List of all generated sentences
        sentence_list = []
        # Currently active sentence
        cur_sentence = []
        sentence_list.append(Sentence(cur_sentence))
        # Determine which form the current expression has
        while self._current_position < len(self.tokens):
            cur = self.tokens[self._current_position]
            self._current_position += 1
            if cur == '(':
                # Parse the subexpression
                subexpr = self._parse_expr()
                # Check if the subexpression only has one branch
                # -> If so, append "(" and ")" and add it as is
                normal_brackets = False
                if len(subexpr.tree()) == 1:
                    normal_brackets = True
                    cur_sentence.append(Word('('))
                # add it to the sentence
                cur_sentence.append(subexpr)
                if normal_brackets:
                    cur_sentence.append(Word(')'))
            elif cur == '|':
                # Begin parsing a new sentence
                cur_sentence = []
                sentence_list.append(Sentence(cur_sentence))
            elif cur == ')':
                # End parsing the current subexpression
                break
            # TODO anything special about {sth}?
            else:
                cur_sentence.append(Word(cur))
        return Options(sentence_list)
def _parse_expr ( self ) : # List of all generated sentences
 sentence_list = [ ] # Currently active sentence
 cur_sentence = [ ] sentence_list . append ( Sentence ( cur_sentence ) ) # Determine which form the current expression has
 while self . _current_position < len ( self . tokens ) : cur = self . tokens [ self . _current_position ] self . _current_position += 1 if cur == '(' : # Parse the subexpression
 subexpr = self . _parse_expr ( ) # Check if the subexpression only has one branch
 # -> If so, append "(" and ")" and add it as is
 normal_brackets = False if len ( subexpr . tree ( ) ) == 1 : normal_brackets = True cur_sentence . append ( Word ( '(' ) ) # add it to the sentence
 cur_sentence . append ( subexpr ) if normal_brackets : cur_sentence . append ( Word ( ')' ) ) elif cur == '|' : # Begin parsing a new sentence
 cur_sentence = [ ] sentence_list . append ( Sentence ( cur_sentence ) ) elif cur == ')' : # End parsing the current subexpression
 break # TODO anything special about {sth}?
 else : cur_sentence . append ( Word ( cur ) ) return Options ( sentence_list )
Generate sentence token trees from the current position to
        the next closing parentheses / end of the list and return it
        ['1', '(', '2', '|', '3, ')'] -> ['1', [['2'], ['3']]]
        ['2', '|', '3'] -> [['2'], ['3']]
Generate sentence token trees from the current position to the next closing parentheses / end of the list and return it [ 1 ( 2 | 3 ) ] - > [ 1 [[ 2 ] [ 3 ]]] [ 2 | 3 ] - > [[ 2 ] [ 3 ]]