summaryrefslogtreecommitdiff
path: root/pygments/lexers/data.py
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year to 2023.Matthäus G. Chajdas2023-03-291-1/+1
|
* Accept colon(s) in YAML key namesGreg Dubicki2022-11-141-1/+1
| | | | | as it's ok according to the YAML specs and is widely used in the real world, f.e. in Puppet's Hiera (https://puppet.com/docs/puppet/7/hiera_quick.html#values_common_data)
* Rework URL information in lexers.Matthäus G. Chajdas2022-03-201-2/+5
| | | | | | | | 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.
* Support comments in JSON (#2049)Kurt McKee2022-01-281-12/+75
| | | | | | | | | | | | | * Support comments in JSON This deviates from the JSON specification but doesn't affect valid JSON. * Update the JSON parser and tests to reach 100% code and branch coverage * Note work on JSON lexer * Fix a roundtrip error identified by a random test input in CI * Note that comments are supported, and that no validation is performed
* Happy new year.Georg Brandl2022-01-251-1/+1
|
* Improve fix for #2010.Matthäus G. Chajdas2021-12-311-1/+7
|
* Fix #2010.Matthäus G. Chajdas2021-12-301-1/+1
|
* Modernize Whitespace token: data lexer(json,yaml)Sebastian Engel2021-10-231-36/+36
|
* Clean-up unused imports (#1887)Mickaël Schoentgen2021-08-231-4/+2
|
* Run pyupgrade across codebase to modernize syntax and patterns (#1622)Jon Dufresne2021-01-171-2/+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>
* Bump copyright year.Matthäus G. Chajdas2021-01-031-1/+1
|
* json: deprecate BareJsonObjectLexerGeorg Brandl2020-11-111-4/+8
| | | | fixes #1600
* Speed up JSON and reduce HTML formatter consumption (#1569)Kurt McKee2020-10-261-85/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update the JSON-LD keyword list to match JSON-LD 1.1 Changes in this patch: * Update the JSON-LD URL to HTTPS * Update the list of JSON-LD keywords * Make the JSON-LD parser less dependent on the JSON lexer implementation * Add unit tests for the JSON-LD lexer * Add unit tests for the JSON parser This includes: * Testing valid literals * Testing valid string escapes * Testing that object keys are tokenized differently from string values * Rewrite the JSON lexer Related to #1425 Included in this change: * The JSON parser is rewritten * The JSON bare object parser no longer requires additional code * `get_tokens_unprocessed()` returns as much as it can to reduce yields (for example, side-by-side punctuation is not returned separately) * The unit tests were updated * Add unit tests based on Hypothesis test results * Reduce HTML formatter memory consumption by ~33% and speed it up Related to #1425 Tested on a 118MB JSON file. Memory consumption tops out at ~3GB before this patch and drops to only ~2GB with this patch. These were the command lines used: python -m pygments -l json -f html -o .\new-code-classes.html .\jc-output.txt python -m pygments -l json -f html -O "noclasses" -o .\new-code-styles.html .\jc-output.txt * Add an LRU cache to the HTML formatter's HTML-escaping and line-splitting For a 118MB JSON input file, this reduces memory consumption by ~500MB and reduces formatting time by ~15 seconds. * JSON: Add a catastrophic backtracking test back to the test suite * JSON: Update the comment that documents the internal queue * JSON: Document in comments that ints/floats/constants are not validated
* fix regression in JSON lexer, bump to 2.7.12.7.1Georg Brandl2020-09-171-2/+2
| | | | Fixes #1544
* all: use argumentless super()Georg Brandl2020-09-061-2/+2
|
* more explicitly define escape sequencies in JsonLexer (fix #1065) (#1528)Nick Gerner2020-08-311-2/+2
| | | | | * more explicitly define escape sequencies in JsonLexer (fix #1065) * adding test coverage for #1065
* Update copyright year (fixes #1514.)Matthäus G. Chajdas2020-08-221-1/+1
|
* add filename for pipenv & poetrytzing2020-02-011-1/+1
|
* Fix #1528 -- Yaml gets confused when a comment contains a key:value pair.Matth?us G. Chajdas2019-07-201-1/+1
|
* Fixup all headers and some more minor problems.2.4.2Georg Brandl2019-05-281-1/+1
|
* Improve YAML mapping lexing: fix problems with quoted colons.Felix Fontein2019-01-121-2/+2
|
* Merged in sanssecours/pygments-main (pull request #724)Anteru2018-12-131-0/+6
|\ | | | | | | YAML: Fix recognition of Non-Specific Tag
| * Improving lexing of YAML mappings.Felix Fontein2018-05-191-0/+6
| |
* | YAML: Recognize non-specific tag `!`Rene? Schwaiger2017-06-161-1/+1
| | | | | | | | | | Before this change Pygments would incorrectly mark the non-specific tag as error token.
* | YAML: Fix minor spelling mistakesRene? Schwaiger2017-06-161-2/+2
|/
* Copyright update.Georg Brandl2017-01-221-1/+1
|
* Add support for partials and path segments for Handlebars.Christian Hammond2016-11-041-0/+555
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.