def parse_array(array_string):
<EOL>if len(array_string) < <NUM_LIT:2> or array_string[<NUM_LIT:0>] != '<STR_LIT:[>' or array_string[-<NUM_LIT:1>] != '<STR_LIT:]>':<EOL><INDENT>raise ValueError('<STR_LIT>' % array_string)<EOL><DEDENT>array_string = array_string[<NUM_LIT:1>:]<EOL>values = []<EOL>while True:<EOL><INDENT>if array_string == '<STR_LIT:]>':<EOL><INDENT>return values<EOL><DEDENT>elif array_string[<NUM_LIT:0>] in '<STR_LIT:U+002CU+0020>':<EOL><INDENT>array_string = array_string[<NUM_LIT:1>:]<EOL><DEDENT>elif array_string[<NUM_LIT:0>] == "<STR_LIT:'>":<EOL><INDENT>match = re.search(r"<STR_LIT>", array_string)<EOL>if match is None:<EOL><INDENT>raise ValueError('<STR_LIT>' % array_string)<EOL><DEDENT>values.append(array_string[<NUM_LIT:1> : match.start() + <NUM_LIT:1>])<EOL>array_string = array_string[match.end():]<EOL><DEDENT>else:<EOL><INDENT>match = re.search(r"<STR_LIT>", array_string)<EOL>values.append(array_string[<NUM_LIT:0> : match.start()])<EOL>array_string = array_string[match.end() - <NUM_LIT:1>:]<EOL><DEDENT><DEDENT>
Parse an array string as returned by clickhouse. For example:
    "['hello', 'world']" ==> ["hello", "world"]
    "[1,2,3]"            ==> [1, 2, 3]