def _parse_list(self, text, i):
res = []<EOL>end_match = self.end_list_re.match(text, i)<EOL>old_current_type = self.current_type<EOL>while not end_match:<EOL><INDENT>list_item, i = self._parse(text, i)<EOL>res.append(list_item)<EOL>end_match = self.end_list_re.match(text, i)<EOL>if not end_match:<EOL><INDENT>m = self.list_delim_re.match(text, i)<EOL>if not m:<EOL><INDENT>self._fail("<STR_LIT>", text, i)<EOL><DEDENT>parsed = m.group(<NUM_LIT:0>)<EOL>i += len(parsed)<EOL><DEDENT>self.current_type = old_current_type<EOL><DEDENT>parsed = end_match.group(<NUM_LIT:0>)<EOL>i += len(parsed)<EOL>return res, i<EOL>
Parse a list from source text starting at i.