@classmethod<EOL><INDENT>def parse(cls, text):<DEDENT>
OUTSIDE, IN_DOUBLE, IN_SINGLE = <NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:2><EOL>iterator = enumerate(text)<EOL>state = OUTSIDE<EOL>parts = []<EOL>current_part = '<STR_LIT>'<EOL>part_start_pos = <NUM_LIT:0><EOL>for i, c in iterator:  <EOL><INDENT>if state == OUTSIDE:<EOL><INDENT>if c.isspace():<EOL><INDENT>if current_part:<EOL><INDENT>parts.append(current_part)<EOL><DEDENT>part_start_pos = i + <NUM_LIT:1><EOL>current_part = '<STR_LIT>'<EOL><DEDENT>elif c == '<STR_LIT:">':<EOL><INDENT>state = IN_DOUBLE<EOL><DEDENT>elif c == "<STR_LIT:'>":<EOL><INDENT>state = IN_SINGLE<EOL><DEDENT>else:<EOL><INDENT>current_part += c<EOL><DEDENT><DEDENT>elif state == IN_SINGLE:<EOL><INDENT>if c == "<STR_LIT:'>":<EOL><INDENT>state = OUTSIDE<EOL><DEDENT>elif c == "<STR_LIT:\\>":<EOL><INDENT>next(iterator)<EOL>current_part += c<EOL><DEDENT>else:<EOL><INDENT>current_part += c<EOL><DEDENT><DEDENT>elif state == IN_DOUBLE:<EOL><INDENT>if c == '<STR_LIT:">':<EOL><INDENT>state = OUTSIDE<EOL><DEDENT>elif c == "<STR_LIT:\\>":<EOL><INDENT>next(iterator)<EOL>current_part += c<EOL><DEDENT>else:<EOL><INDENT>current_part += c<EOL><DEDENT><DEDENT><DEDENT>parts.append(current_part)<EOL>return parts, part_start_pos<EOL>
Parse the given text. Returns a tuple:
(list_of_parts, start_pos_of_the_last_part).