summaryrefslogtreecommitdiff
path: root/pygments/lexers/sql.py
Commit message (Collapse)AuthorAgeFilesLines
* Add Pre-sorted Group keyword (#2417)Adrien nayrat2023-04-201-1/+1
|
* Prepare for release.Matthäus G. Chajdas2023-04-101-0/+1
| | | | | | * Update CHANGES. * Fix missing `versionadded` declarations. * Fix a few linter issues.
* Add PostgreSQL Explain lexer (#2398)Adrien nayrat2023-04-041-3/+191
| | | | | | | | | | This lexer add support for PostgreSQL Explain plan : https://www.postgresql.org/docs/current/sql-explain.html This was heavily inspired by Maxence Ahlouche work, thanks to him : https://github.com/maahl/pg_explain_lexer Co-authored-by: Jean Abou Samra <jean@abou-samra.fr>
* Update copyright year to 2023.Matthäus G. Chajdas2023-03-291-1/+1
|
* Rework URL information in lexers.Matthäus G. Chajdas2022-03-201-2/+1
| | | | | | | | This commit adds a new url field to a lexer, which can be used to link to the language website, instead of relying on having the link in either languages.rst or the docstring of the lexer. Additionally, it changes the languages.rst file to auto-generate the list of lexers from the actual source code, using the provided URL.
* Remove now redundant re.UNICODE and (?u) (#2058)Jean Abou-Samra2022-01-311-2/+2
|
* Happy new year.Georg Brandl2022-01-251-1/+1
|
* lexer SQL to use whitespace token - regarding #1905 (#1908)Sebastian Engel2021-10-061-9/+13
| | | | | | | | | * SQL whitespaces - regarding #1905 * Sqlite prompt ungrouped from trailing space * sqlite prompt with Explicit trailing whitespace token * Fix insertion of sqlite trail space token
* Improve checks. (#1884)Matthäus G. Chajdas2021-08-171-0/+3
| | | | | | | | | Improve checks. * Fix lots of small errors. * Remove the line length check. * Add an option to skip lexers with no alias * Run checks in make check * Add a new CI target.
* Run pyupgrade across codebase to modernize syntax and patterns (#1622)Jon Dufresne2021-01-171-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | pyupgrade is a tool to automatically upgrade syntax for newer versions of the Python language. The project has been Python 3 only since 35544e2fc6eed0ce4a27ec7285aac71ff0ddc473, allowing for several cleanups: - Remove unnecessary "-*- coding: utf-8 -*-" cookie. Python 3 reads all source files as utf-8 by default. - Replace IOError/EnvironmentError with OSError. Python 3 unified these exceptions. The old names are aliases only. - Use the Python 3 shorter super() syntax. - Remove "utf8" argument form encode/decode. In Python 3, this value is the default. - Remove "r" from open() calls. In Python 3, this value is the default. - Remove u prefix from Unicode strings. In Python 3, all strings are Unicode. - Replace io.open() with builtin open(). In Python 3, these functions are functionally equivalent. Co-authored-by: Matthäus G. Chajdas <Anteru@users.noreply.github.com>
* Do not guess MIME or SQL without reasonGeorg Brandl2021-01-171-3/+0
| | | | constant returns from analyse_text are not useful.
* (sql.py): fix errors in keywords (#1668)0xflotus2021-01-101-6/+6
|
* Bump copyright year.Matthäus G. Chajdas2021-01-031-1/+1
|
* MySQL: Tokenize quoted schema object names, and escape characters, uniquely ↵Kurt McKee2020-10-271-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#1555) * MySQL: Tokenize quoted schema object names, and escape characters, uniquely Changes in this patch: * Name.Quoted and Name.Quoted.Escape are introduced as non-standard tokens * HTML and LaTeX formatters were confirmed to provide default formatting if they encounter these two non-standard tokens. They also add style classes based on the token name, like "n-Quoted" (HTML) or "nQuoted" (LaTeX) so that users can add custom styles for these. * Removed "\`" and "\\" as schema object name escapes. These are relics of the previous regular expression for backtick-quoted names and are not treated as escape sequences. The behavior was confirmed in the MySQL documentation as well as by running queries in MySQL Workbench. * Prevent "123abc" from being treated as an integer followed by a schema object name. MySQL allows leading numbers in schema object names as long as 0-9 are not the only characters in the schema object name. * Add ~10 more unit tests to validate behavior. Closes #1551 * Remove an end-of-line regex match that triggered a lint warning Also, add tests that confirm correct behavior. No tests failed before or after removing the '$' match in the regex, but now regexlint isn't complaining. Removing the '$' matching probably depends on the fact that Pygments adds a newline at the end of the input text, so there is always something after a bare integer literal.
* all: revert changes of [a-zA-Z0-9_] to \wGeorg Brandl2020-09-071-3/+5
| | | | ... which is not equivalent in Unicode mode
* all: use argumentless super()Georg Brandl2020-09-061-1/+1
|
* Simplify regex.Matthäus G. Chajdas2020-09-061-1/+1
|
* Overhaul the MySQL lexer (#1527)Kurt McKee2020-09-061-56/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Overhaul the MySQL lexer Fixes #975, #1063, #1453 Changes include: Documentation ------------- * Note in the lexer docstring that Oracle MySQL is the target syntax. MariaDB syntax is not a target (though there is significant overlap). Unit tests ---------- * Add 140 unit tests for MySQL. Literals -------- * Hexadecimal/binary/date/time/timestamp literals are supported. * Integer mantissas are supported for scientific notation. * In-string escapes are now tokenized properly. * Support the "unknown" constant. Comments -------- * Optimizer hints are now supported, and keywords are recognized and tokenized as preprocessor instructions. * Remove nested multi-line comment support, which is no longer supported in MySQL. Variables --------- * Support the '@' prefix for variable names. * Lift restrictions on characters in unquoted variable names. (MySQL does not impose a restriction on lead characters.) * Support single/double/backtick-quoted variable names, including escapes. * Support the '@@' prefix for system variable names. * Support '?' as a variable so people can demonstrate prepared statements. Keywords -------- * Keyword / data type / function are now in a separate, auto-updating file. * Support 25 additional data types (including spatial and JSON types). * Support 460 additional MySQL keywords. * Support 372 MySQL functions. Explicit function support resolves a bug that causes non-function items to be treated as functions simply because they have a trailing opening parenthesis. * Support exceptions for the 'SET' keyword, which is both a datatype and a keyword depending on context. Schema object names ------------------- * Support Unicode in MySQL schema object names. * Support parsing of backtick-quoted schema object name escapes. (Escapes do not produce a distinct token type at this time.) Operators --------- * Remove non-operator characters from the list of operators. * Remove non-punctuation characters from the list of punctuation. * Cleanup items based on feedback * Remove an unnecessary optional newline lookahead for single-line comments
* all: use yield from (#1537)Georg Brandl2020-09-061-14/+8
|
* all: fixup remaining regexlint warningsGeorg Brandl2020-09-061-1/+1
|
* Update copyright year (fixes #1514.)Matthäus G. Chajdas2020-08-221-1/+1
|
* sql lexer: Add temporal support keywordslonetwin2020-02-291-6/+7
| | | | | | | | | | | | | | | SQL:2011 introduced support for temporal databases[1] via new keywords to create and manage temporal tables. This patchset adds these new keywords to the sql lexer. One concrete example of these feature is the temporal tables support in MariaDB[2]. As evident from the code listing on that page, the syntax highlighting for these keywords is not as widespread as expected (I wouldn't be surprised if code listing on that page ultimately use pygments for syntax highlighting !) [1] https://en.wikipedia.org/wiki/SQL:2011 [2] https://mariadb.com/kb/en/temporal-data-tables/
* Remove Python 2 compatibility (#1348)Georg Brandl2020-02-291-5/+4
| | | | | | | | | | | * Remove Python 2 compatibility * remove 2/3 shims in pygments.util * update setup.py metadata * Remove unneeded object inheritance. * Remove unneeded future imports.
* sql: style fixesGeorg Brandl2019-11-271-89/+104
|
* Update project to use modern Python features and idiomsJon Dufresne2019-11-251-4/+4
| | | | | | | | | | Run the pyupgrade tool across the project to use modern language features. - Use set literals - Use dict comprehension - Remove unnecessary numeric indexes in format string - Remove unnecessary extra parentheses
* Fixup all headers and some more minor problems.2.4.2Georg Brandl2019-05-281-1/+1
|
* Fix a small bug in the SQL analysis.Matth?us G. Chajdas2019-01-041-2/+8
| | | | Updated CHANGES as well, and moved the LLVM PR to the right list.
* Merged in roskakori/pygments-analyze-sql (pull request #672)Anteru2019-01-041-2/+50
|\ | | | | | | Added analyse_text() for SQL
| * Added analyse_text() that attempts to detect MySQL and Transact-SQL.Thomas Aglassinger2016-10-011-2/+50
| |
| * Merged in roskakori/pygments-tsql (pull request #577)Tim Hatch2016-05-311-3/+3
| |\ | | | | | | | | | Add lexer for Transact-SQL
| | * Fixed single line SQL comments on end of file without a trailing newline.Thomas Aglassinger2016-03-241-3/+3
| | |
| * | Improved detection of single line SQL comments as suggested in pull request ↵Thomas Aglassinger2016-03-291-1/+1
| | | | | | | | | | | | #578. Now it even works in combination with re.DOTALL.
| * | Fixed detection of Number.Float in Transact-SQL for corner cases like "1." ↵Thomas Aglassinger2016-03-241-2/+6
| | | | | | | | | | | | and "1.e2."
| * | Fixed detection of Transact-SQL comments in the last line of a source code ↵Thomas Aglassinger2016-03-231-1/+1
| | | | | | | | | | | | without a newline at the end.
| * | Fixed that regex to detect Number.Float shadowed regex for Number.Integer ↵Thomas Aglassinger2016-03-231-1/+2
| | | | | | | | | | | | for Transact-SQL.
| * | Fixed minus operator for Transact-SQL.Thomas Aglassinger2016-03-221-3/+3
| | |
| * | Added lexer for Transact-SQL as used by Microsoft SQL Server and Sybase.Thomas Aglassinger2016-03-211-2/+55
| |/
| * merge with stableGeorg Brandl2016-02-141-10/+25
| |\
| | * String prefixes and dollar-quoted string delimiters lexing in Postgresql. ↵Miikka Salminen2016-02-081-10/+25
| | | | | | | | | | | | Also closes issue #886.
| * | Make postgres strings use their own state.Georg Brandl2016-02-081-2/+12
| |/
| * Closes #1206: add IF and ELSIF to SQL keywords.Georg Brandl2016-02-031-3/+3
| |
| * merge default into stableGeorg Brandl2016-01-171-0/+598
|
* Merge heads.Georg Brandl2018-11-281-2/+2
|\
| * Fix invalid escapes due to missing raw string prefix.Georg Brandl2018-11-281-2/+2
| |
* | Be more Pythonic, use a for instead of while 1: try: nextMiro Hron?ok2018-07-041-13/+4
| |
* | PEP 479: Raising StopIteration from a generator is now an errorMiro Hron?ok2018-07-041-1/+4
|/ | | | | | So we return instead. Fix needed for Python 3.7. Fixes https://bitbucket.org/birkenfeld/pygments-main/issues/1457
* Copyright update.Georg Brandl2017-01-221-1/+1
|
* Add support for partials and path segments for Handlebars.Christian Hammond2016-11-041-0/+681
This introduces support for some missing features to the Handlebars lexer: Partials and path segments. Partials mostly appeared to work before, but the `>` in `{{> ... }}` would appear as a syntax error, as could other components of the partial. This change introduces support for: * Standard partials: `{{> partialName}}` * Partials with parameters: `{{> partialName varname="value"}}` * Ddynamic partials: `{{> (partialFunc)}}` * Ddynamic partials with lookups: `{{> (lookup ../path "partialName")}}` * Partial blocks: `{{> @partial-block}}` * Inline partials: `{{#*inline}}..{{/inline}}` It also introduces support for path segments, which can reference content in the current context or in a parent context. For instance, `this.name`, `this/name`, `./name`, `../name`, `this/name`, etc. These are all now tracked as variables.