def read_token(self): self.changed_state = [] self.__pos = 0 tok = shlex.read_token(self) if tok == None: return tok self.changed_state.append((self.state, self.token[self.__pos:])) tok = '' for s, t in self.changed_state: if s in ('"', "a"): tok += self.var_expand(t) else: tok += t return tok
def read_token(self): self.changed_state = [] self.__pos = 0 token = shlex.read_token(self) if token is None: return token if self.state is None: # eof reached. self.changed_state.append((self.state, token[self.__pos:])) else: self.changed_state.append((self.state, self.token[self.__pos:])) tok = '' for s, t in self.changed_state: if s in ('"', "a"): tok += self.var_expand(t).replace("\\\n", '') else: tok += t return tok