File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -250,23 +250,18 @@ def parse(self, rawinput: str) -> Statement:
250250 tokens = self .tokenize (rawinput )
251251
252252 # of the valid terminators, find the first one to occur in the input
253- terminator_pos = len (tokens )+ 1
254- for test_terminator in self .terminators :
255- try :
256- pos = tokens .index (test_terminator )
257- if pos < terminator_pos :
253+ terminator_pos = len (tokens ) + 1
254+ for pos , cur_token in enumerate (tokens ):
255+ for test_terminator in self .terminators :
256+ if cur_token .startswith (test_terminator ):
258257 terminator_pos = pos
259258 terminator = test_terminator
260259 break
261- except ValueError :
262- # the terminator is not in the tokens
263- pass
264260
265261 if terminator :
266262 if terminator == LINE_FEED :
267263 terminator_pos = len (tokens )+ 1
268- else :
269- terminator_pos = tokens .index (terminator )
264+
270265 # everything before the first terminator is the command and the args
271266 argv = tokens [:terminator_pos ]
272267 (command , args ) = self ._command_and_args (argv )
You can’t perform that action at this time.
0 commit comments