def _linearized_rep_to_tree_rep()

in utils/trees.py [0:0]


    def _linearized_rep_to_tree_rep(self, flat_string):
        '''
        Get the tree representation for flat input string `flat_string`
        Example input string:
        "(ORDER (PIZZAORDER (NUMBER 1) (TOPPING HAM) (COMPLEX_TOPPING (TOPPING ONIONS) (QUANTITY EXTRA))))"

        :param flat_string: (str) EXR-format input flat string to construct a tree, if possible.
        :return: (AnyNode) returns a pointer to a tree.
        '''
        flat_string = f'({ExpressSemanticTree.ROOT_SYMBOL} {flat_string})'
        # Split the flat string using a regular expression and filter the special characters.
        toks = ExpressSemanticTree.tokenize(flat_string)
        parent_group_mapping = build_parent_group_mapping(toks)
        return parse_sexp(toks, 0, len(toks), parent_group_mapping)