def split(self, maxsplit=None, dequote=True):
class Word(object):<EOL><INDENT>"""<STR_LIT>"""<EOL>def __init__(self):<EOL><INDENT>self.value = None<EOL><DEDENT>@property<EOL>def valid(self):<EOL><INDENT>return self.value is not None<EOL><DEDENT>def append(self, s):<EOL><INDENT>if self.value is None:<EOL><INDENT>self.value = s<EOL><DEDENT>else:<EOL><INDENT>self.value += s<EOL><DEDENT><DEDENT><DEDENT>num_splits = <NUM_LIT:0><EOL>word = Word()<EOL>while True:<EOL><INDENT>ch = self.stream.read(<NUM_LIT:1>)<EOL>if not ch:<EOL><INDENT>if word.valid:<EOL><INDENT>yield word.value<EOL><DEDENT>return<EOL><DEDENT>if (not self.escaped and<EOL>self.envs is not None and<EOL>ch == '<STR_LIT:$>' and<EOL>self.quotes != self.SQUOTE):<EOL><INDENT>while True:<EOL><INDENT>braced = False<EOL>varname = '<STR_LIT>'<EOL>while True:<EOL><INDENT>ch = self.stream.read(<NUM_LIT:1>)<EOL>if varname == '<STR_LIT>' and ch == '<STR_LIT:{>':<EOL><INDENT>braced = True<EOL>continue<EOL><DEDENT>if not ch:<EOL><INDENT>break<EOL><DEDENT>if braced and ch == '<STR_LIT:}>':<EOL><INDENT>break<EOL><DEDENT>if not ch.isalnum() and ch != '<STR_LIT:_>':<EOL><INDENT>break<EOL><DEDENT>varname += ch<EOL><DEDENT>try:<EOL><INDENT>word.append(self.envs[varname])<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT>if ch != '<STR_LIT:$>':<EOL><INDENT>break<EOL><DEDENT><DEDENT>if braced and ch == '<STR_LIT:}>':<EOL><INDENT>continue<EOL><DEDENT><DEDENT>is_escaped = self.escaped<EOL>ch_unless_consumed = self._update_quoting_state(ch)<EOL>if dequote:<EOL><INDENT>ch = ch_unless_consumed<EOL><DEDENT>may_split = maxsplit != <NUM_LIT:0> and (maxsplit is None or<EOL>num_splits < maxsplit)<EOL>at_split = may_split and (self.quotes is None and<EOL>not is_escaped and<EOL>ch.isspace())<EOL>if at_split:<EOL><INDENT>if word.valid:<EOL><INDENT>num_splits += <NUM_LIT:1><EOL>yield word.value<EOL><DEDENT>word = Word()<EOL><DEDENT>else:<EOL><INDENT>word.append(ch)<EOL><DEDENT><DEDENT>
Generator for the words of the string

:param maxsplit: perform at most maxsplit splits;
    if None, do not limit the number of splits
:param dequote: remove quotes and escape characters once consumed