diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-20 07:58:40 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-20 08:05:00 +0300 |
commit | bcd5bcc390793791d293d386b2ebefbe683fb4e1 (patch) | |
tree | c93e3b8c847237e7e7626f4a07f1b657bb34f04d /contrib/python/Pygments/py3/pygments/lexers/sql.py | |
parent | 1a9f1508fe9c8c5927ffebf33197a6108e70501d (diff) | |
download | ydb-bcd5bcc390793791d293d386b2ebefbe683fb4e1.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/sql.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/sql.py | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/sql.py b/contrib/python/Pygments/py3/pygments/lexers/sql.py index 2880841c37..31b45fbb7d 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/sql.py +++ b/contrib/python/Pygments/py3/pygments/lexers/sql.py @@ -36,7 +36,7 @@ The ``tests/examplefiles`` contains a few test files with data to be parsed by these lexers. - :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -154,13 +154,13 @@ class PostgresBase: class PostgresLexer(PostgresBase, RegexLexer): """ Lexer for the PostgreSQL dialect of SQL. - - .. versionadded:: 1.5 """ name = 'PostgreSQL SQL dialect' aliases = ['postgresql', 'postgres'] mimetypes = ['text/x-postgresql'] + url = 'https://www.postgresql.org' + version_added = '1.5' flags = re.IGNORECASE tokens = { @@ -210,15 +210,16 @@ class PostgresLexer(PostgresBase, RegexLexer): class PlPgsqlLexer(PostgresBase, RegexLexer): """ Handle the extra syntax in Pl/pgSQL language. - - .. versionadded:: 1.5 """ name = 'PL/pgSQL' aliases = ['plpgsql'] mimetypes = ['text/x-plpgsql'] + url = 'https://www.postgresql.org/docs/current/plpgsql.html' + version_added = '1.5' flags = re.IGNORECASE - tokens = {k: l[:] for (k, l) in PostgresLexer.tokens.items()} + # FIXME: use inheritance + tokens = {name: state[:] for (name, state) in PostgresLexer.tokens.items()} # extend the keywords list for i, pattern in enumerate(tokens['root']): @@ -252,7 +253,7 @@ class PsqlRegexLexer(PostgresBase, RegexLexer): aliases = [] # not public flags = re.IGNORECASE - tokens = {k: l[:] for (k, l) in PostgresLexer.tokens.items()} + tokens = {name: state[:] for (name, state) in PostgresLexer.tokens.items()} tokens['root'].append( (r'\\[^\s]+', Keyword.Pseudo, 'psql-command')) @@ -302,13 +303,13 @@ class lookahead: class PostgresConsoleLexer(Lexer): """ Lexer for psql sessions. - - .. versionadded:: 1.5 """ name = 'PostgreSQL console (psql)' aliases = ['psql', 'postgresql-console', 'postgres-console'] mimetypes = ['text/x-postgresql-psql'] + url = 'https://www.postgresql.org' + version_added = '1.5' def get_tokens_unprocessed(self, data): sql = PsqlRegexLexer(**self.options) @@ -374,14 +375,14 @@ class PostgresConsoleLexer(Lexer): class PostgresExplainLexer(RegexLexer): """ Handle PostgreSQL EXPLAIN output - - .. versionadded:: 2.15 """ name = 'PostgreSQL EXPLAIN dialect' aliases = ['postgres-explain'] filenames = ['*.explain'] mimetypes = ['text/x-postgresql-explain'] + url = 'https://www.postgresql.org/docs/current/using-explain.html' + version_added = '2.15' tokens = { 'root': [ @@ -459,8 +460,8 @@ class PostgresExplainLexer(RegexLexer): # strings (r"'(''|[^'])*'", String.Single), # numbers - (r'\d+\.\d+', Number.Float), - (r'(\d+)', Number.Integer), + (r'-?\d+\.\d+', Number.Float), + (r'(-?\d+)', Number.Integer), # boolean (r'(true|false)', Name.Constant), @@ -567,6 +568,8 @@ class SqlLexer(RegexLexer): aliases = ['sql'] filenames = ['*.sql'] mimetypes = ['text/x-sql'] + url = 'https://en.wikipedia.org/wiki/SQL' + version_added = '' flags = re.IGNORECASE tokens = { @@ -701,6 +704,8 @@ class TransactSqlLexer(RegexLexer): aliases = ['tsql', 't-sql'] filenames = ['*.sql'] mimetypes = ['text/x-tsql'] + url = 'https://www.tsql.info' + version_added = '' flags = re.IGNORECASE @@ -785,6 +790,8 @@ class MySqlLexer(RegexLexer): name = 'MySQL' aliases = ['mysql'] mimetypes = ['text/x-mysql'] + url = 'https://www.mysql.com' + version_added = '' flags = re.IGNORECASE tokens = { @@ -959,14 +966,14 @@ class MySqlLexer(RegexLexer): class SqliteConsoleLexer(Lexer): """ Lexer for example sessions using sqlite3. - - .. versionadded:: 0.11 """ name = 'sqlite3con' aliases = ['sqlite3'] filenames = ['*.sqlite3-console'] mimetypes = ['text/x-sqlite3-console'] + url = 'https://www.sqlite.org' + version_added = '0.11' def get_tokens_unprocessed(self, data): sql = SqlLexer(**self.options) @@ -1000,14 +1007,13 @@ class SqliteConsoleLexer(Lexer): class RqlLexer(RegexLexer): """ Lexer for Relation Query Language. - - .. versionadded:: 2.0 """ name = 'RQL' url = 'http://www.logilab.org/project/rql' aliases = ['rql'] filenames = ['*.rql'] mimetypes = ['text/x-rql'] + version_added = '2.0' flags = re.IGNORECASE tokens = { |