diff options
author | Georg Brandl <georg@python.org> | 2020-09-06 14:35:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-06 14:35:14 +0200 |
commit | 40baa94a6bf0c62be8c8b03a942116869ce80128 (patch) | |
tree | 50eca3f33e60a4bbadd29bf566b294052e509259 /pygments/lexers/robotframework.py | |
parent | ed93a2758bdfbeaafc43ac59a611bf2cff92b55c (diff) | |
download | pygments-git-40baa94a6bf0c62be8c8b03a942116869ce80128.tar.gz |
all: use yield from (#1537)
Diffstat (limited to 'pygments/lexers/robotframework.py')
-rw-r--r-- | pygments/lexers/robotframework.py | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/pygments/lexers/robotframework.py b/pygments/lexers/robotframework.py index eab5b0f2..cd808292 100644 --- a/pygments/lexers/robotframework.py +++ b/pygments/lexers/robotframework.py @@ -98,16 +98,13 @@ class VariableTokenizer: before = string[:var.start] yield before, orig_token yield var.identifier + '{', SYNTAX - for value, token in self.tokenize(var.base, VARIABLE): - yield value, token + yield from self.tokenize(var.base, VARIABLE) yield '}', SYNTAX if var.index: yield '[', SYNTAX - for value, token in self.tokenize(var.index, VARIABLE): - yield value, token + yield from self.tokenize(var.index, VARIABLE) yield ']', SYNTAX - for value, token in self.tokenize(string[var.end:], orig_token): - yield value, token + yield from self.tokenize(string[var.end:], orig_token) class RowTokenizer: @@ -138,9 +135,8 @@ class RowTokenizer: elif index == 0 and value.startswith('*'): self._table = self._start_table(value) heading = True - for value, token in self._tokenize(value, index, commented, - separator, heading): - yield value, token + yield from self._tokenize(value, index, commented, + separator, heading) self._table.end_row() def _start_table(self, header): @@ -155,8 +151,7 @@ class RowTokenizer: elif heading: yield value, HEADING else: - for value, token in self._table.tokenize(value, index): - yield value, token + yield from self._table.tokenize(value, index) class RowSplitter: @@ -166,14 +161,12 @@ class RowSplitter: def split(self, row): splitter = (row.startswith('| ') and self._split_from_pipes or self._split_from_spaces) - for value in splitter(row): - yield value + yield from splitter(row) yield '\n' def _split_from_spaces(self, row): yield '' # Start with (pseudo)separator similarly as with pipes - for value in self._space_splitter.split(row): - yield value + yield from self._space_splitter.split(row) def _split_from_pipes(self, row): _, separator, rest = self._pipe_splitter.split(row, 1) @@ -333,8 +326,7 @@ class _Table: self._tokenizer = self._prev_tokenizer yield value, SYNTAX else: - for value_and_token in self._tokenize(value, index): - yield value_and_token + yield from self._tokenize(value, index) self._prev_values_on_row.append(value) def _continues(self, value, index): |