Skip to content

Commit e58e756

Browse files
committed
fix for loop lexing
1 parent 36cc268 commit e58e756

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/robot/parsing/lexer/lexers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,19 @@ def handles(cls, statement):
314314

315315
def lex(self, ctc):
316316
separator_seen = False
317+
arguments_seen = False
317318
self.statement[0].type = Token.FOR
318319
for token in self.statement[1:]:
319-
if self._is_separator(token.value) and not separator_seen:
320+
if self._is_separator(token.value, arguments_seen, separator_seen):
320321
token.type = Token.FOR_SEPARATOR
321322
separator_seen = True
322323
else:
323324
token.type = Token.ARGUMENT
325+
arguments_seen = True
324326

325-
def _is_separator(self, value):
327+
def _is_separator(self, value, arguments_seen, separator_seen):
328+
if separator_seen or not arguments_seen:
329+
return False
326330
return value in ('IN', 'IN RANGE', 'IN ENUMERATE', 'IN ZIP')
327331

328332

0 commit comments

Comments
 (0)