summaryrefslogtreecommitdiff
path: root/pygments/lexers/sql.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2020-09-06 14:35:14 +0200
committerGitHub <noreply@github.com>2020-09-06 14:35:14 +0200
commit40baa94a6bf0c62be8c8b03a942116869ce80128 (patch)
tree50eca3f33e60a4bbadd29bf566b294052e509259 /pygments/lexers/sql.py
parented93a2758bdfbeaafc43ac59a611bf2cff92b55c (diff)
downloadpygments-git-40baa94a6bf0c62be8c8b03a942116869ce80128.tar.gz
all: use yield from (#1537)
Diffstat (limited to 'pygments/lexers/sql.py')
-rw-r--r--pygments/lexers/sql.py22
1 files changed, 8 insertions, 14 deletions
diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py
index b3f6e678..d58abe2a 100644
--- a/pygments/lexers/sql.py
+++ b/pygments/lexers/sql.py
@@ -117,9 +117,7 @@ class PostgresBase:
def get_tokens_unprocessed(self, text, *args):
# Have a copy of the entire text to be used by `language_callback`.
self.text = text
- for x in super(PostgresBase, self).get_tokens_unprocessed(
- text, *args):
- yield x
+ yield from super(PostgresBase, self).get_tokens_unprocessed(text, *args)
def _get_lexer(self, lang):
if lang.lower() == 'sql':
@@ -319,8 +317,7 @@ class PostgresConsoleLexer(Lexer):
# Identify a shell prompt in case of psql commandline example
if line.startswith('$') and not curcode:
lexer = get_lexer_by_name('console', **self.options)
- for x in lexer.get_tokens_unprocessed(line):
- yield x
+ yield from lexer.get_tokens_unprocessed(line)
break
# Identify a psql prompt
@@ -340,9 +337,8 @@ class PostgresConsoleLexer(Lexer):
break
# Emit the combined stream of command and prompt(s)
- for item in do_insertions(insertions,
- sql.get_tokens_unprocessed(curcode)):
- yield item
+ yield from do_insertions(insertions,
+ sql.get_tokens_unprocessed(curcode))
# Emit the output lines
out_token = Generic.Output
@@ -698,9 +694,8 @@ class SqliteConsoleLexer(Lexer):
curcode += line[8:]
else:
if curcode:
- for item in do_insertions(insertions,
- sql.get_tokens_unprocessed(curcode)):
- yield item
+ yield from do_insertions(insertions,
+ sql.get_tokens_unprocessed(curcode))
curcode = ''
insertions = []
if line.startswith('SQL error: '):
@@ -708,9 +703,8 @@ class SqliteConsoleLexer(Lexer):
else:
yield (match.start(), Generic.Output, line)
if curcode:
- for item in do_insertions(insertions,
- sql.get_tokens_unprocessed(curcode)):
- yield item
+ yield from do_insertions(insertions,
+ sql.get_tokens_unprocessed(curcode))
class RqlLexer(RegexLexer):