summaryrefslogtreecommitdiff
path: root/pygments/lexers/javascript.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix various issues found by make check.Matthäus G. Chajdas2021-02-141-2/+4
|
* Run pyupgrade across codebase to modernize syntax and patterns (#1622)Jon Dufresne2021-01-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* fix escape in TypeScript templates literalsMestery2021-01-171-2/+1
|
* Fix escapes in JavaScript backtick stringsGeorg Brandl2021-01-171-2/+1
| | | | fixes #1679
* Merge branch 'master' of https://github.com/felixhao28/pygments into ↵Matthäus G. Chajdas2021-01-041-1/+1
|\ | | | | | | felixhao28-master
| * fix punctuation not labeled in function definition in TypeScriptYiyang Hao2020-08-161-1/+1
| |
* | Bump copyright year.Matthäus G. Chajdas2021-01-031-1/+1
| |
* | Update keywords for JS and its variants (#1651)Mestery2021-01-021-37/+35
| | | | | | | | | | | | | | Some of the keywords are missing for JavaScript and TypeScript. And some of reserved keywords have been moved to `keywords` and `declarations keywords`. There are also non-existent builtins that I removed. Added missing builtins.
* | add support for LiveScript and CoffeeScriptMestery2020-12-281-4/+4
| |
* | Fix regexs to support somes flagsMestery2020-12-281-4/+4
| | | | | | Resolves #1646
* | fix a lot more backtracking string regexesGeorg Brandl2020-12-251-28/+8
| |
* | Fix backtracking string regexes in JavascriptLexer und TypescriptLexer.Georg Brandl2020-12-171-5/+24
| | | | | | | | fixes #1637
* | JuttleLexer: Fix duplicate 'juttle' occurance in lexer aliases.Sumanth V Rao2020-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The output from pygments.lexers.get_all_lexers() contains 'juttle' twice in the aliases section for the Juttle lexer entry. This could be reproduced using: >>> from pygments.lexers import get_all_lexers >>> lexers = get_all_lexers() >>> {alias[0]: alias[1] for alias in lexers}.get('Juttle') ('juttle', 'juttle') This patch fixes the duplicate entry and generates the associated _mapping.py file. Fixes: #1604
* | Add Javascript 'async', 'await' keywords (#1605)Chris Nevers2020-11-171-1/+1
| |
* | all: remove "u" string prefix (#1536)Georg Brandl2020-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | * all: remove "u" string prefix * util: remove unirange Since Python 3.3, all builds are wide unicode compatible. * unistring: remove support for narrow-unicode builds which stopped being relevant with Python 3.3
* | Add comment.Matthäus G. Chajdas2020-09-061-0/+3
| | | | | | | | Add a quick reminder that Javascript doesn't need integers.
* | Overhaul Javascript numeric literals (#1534)Kurt McKee2020-09-061-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Rename the "Javascript" tests to reflect that they are for CoffeeScript This change also modifies the module docstring to reflect the file's purpose. * Overhaul the Javascript numeric literal parsing Fixes #307 This patch contains the following changes: * Adds 50+ unit tests for Javascript numeric literals * Forces ASCII numbers for float literals (so, now reject `.୪`) * Adds support for Javascript's BigInt notation (`100n`) * Adds support for leading-zero-only octal notation (`0777`) * Adds support for scientific notation with no significand (`1e10`) Numeric literal parsing is based on information at: * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures
* | all: fixup remaining regexlint warningsGeorg Brandl2020-09-061-3/+3
| |
* | Update copyright year (fixes #1514.)Matthäus G. Chajdas2020-08-221-1/+1
|/
* Add recent keywords for Dart syntax (#1449)Sam Rawlins2020-05-181-9/+10
|
* Remove Python 2 compatibility (#1348)Georg Brandl2020-02-291-3/+3
| | | | | | | | | | | * Remove Python 2 compatibility * remove 2/3 shims in pygments.util * update setup.py metadata * Remove unneeded object inheritance. * Remove unneeded future imports.
* Add support for *.mjs JavaScript modules extension (#1392)Alan Hamlett2020-02-121-1/+1
|
* all: fixup http->https for github, pypi, pocoo etc URLsGeorg Brandl2019-12-101-1/+1
|
* tests: remove special skip cases for random_input test caseGeorg Brandl2019-12-091-3/+3
|
* Juttle: style fixesGeorg Brandl2019-11-261-7/+14
|
* Dart: add support for annotations (bitbucket PR #733)Georg Brandl2019-11-241-0/+1
|
* Fixup all headers and some more minor problems.2.4.2Georg Brandl2019-05-281-1/+1
|
* Add 'of' to TypeScript grammar (fixes #1515.)Matth?us G. Chajdas2019-05-181-1/+1
|
* Fix #1498.Matth?us G. Chajdas2019-03-061-6/+0
| | | | | .typoscript is used for TypoScript files, removing the ambiguity with TypeScript.
* Make TypeScript the default for .ts files.Matth?us G. Chajdas2019-02-121-0/+4
|
* Merge heads.Georg Brandl2018-11-281-3/+3
|\
| * Fix remaining 'DeprecationWarning: invalid escape sequence' occurrences in ↵Andreas Kloeckner2018-06-191-3/+3
| | | | | | | | lexer files
* | Minimal fixup changes for the release, add release date.2.3.0Georg Brandl2018-11-251-2/+4
|/
* Merged in chipx86/pygments-main/typescript-vs-typoscript (pull request #693)Georg Brandl2017-01-221-1/+7
|\ | | | | | | Implement guessing and resolution between TypeScript and TypoScript.
| * Remove the fallback values from the new analyse_text changes.Christian Hammond2017-01-221-5/+1
| | | | | | | | | | | | | | | | | | | | These values would trigger problems when guessing content without a filename, and really aren't needed. They've been removed, allowing the standard behavior to take place. On top of this, the regex for TypeScript has been slightly altered to include a whitespace match after "export" to be within the group for the "export" text.
| * Implement guessing and resolution between TypeScript and TypoScript.Christian Hammond2017-01-221-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new TypoScript lexer was taking precedence over TypeScript, which share the same file extension. This meant that any previously-working TypeScript source files would be misidentified and highlighted incorrectly. This was due to the lack of a guesser for TypeScript, and TypoScript having a naturally higher priority. This change balances things a bit between the lexers. TypoScript now has an explicitly-higher priority than TypeScript, both for the file extension and defaults when guessing content, as it has less we can rely on in terms of content. TypeScript has a lower priority, but has an analyse_text() method that checks for common symbols in code, giving it a better chance of matching for actual TypeScript source files. TypeScript also gains an additional file extension, *.tsx. Ideally, this would have its own lexer that understood inline JSX syntax, but giving general TypeScript syntax highlighting for these files is a step in the right direction.
* | Merged in EricFromCanada/pygments-main (pull request #619)Georg Brandl2017-01-221-13/+31
|\ \ | | | | | | | | | update LassoLexer
| * \ Merged in chipx86/pygments-main/typescript-string-literals (pull request #692)Georg Brandl2017-01-221-1/+18
| |\ \ | | | | | | | | | | | | Add support for string literals to TypeScriptLexer.
| | * | Add support for string literals to TypeScriptLexer.Christian Hammond2017-01-201-1/+18
| | |/ | | | | | | | | | | | | | | | This introduces support for string literals to the TypeScript lexer. The rules are consistent with those in JavascriptLexer, helping to ensure the same behavior and capabilities between the two.
| | * Fix for floats with leading/trailing ., reclassify es2015 arrow notation as ↵Ash Searle2016-09-011-8/+8
| | | | | | | | | | | | punctuation and add new es2015 regex flags (sticky and unicode)
| * | Merged in ↵Georg Brandl2017-01-221-3/+4
| |\ \ | | | | | | | | | | | | | | | | | | | | devoncarew1/pygments-main/devoncarew1/javascriptpy-edited-online-with-bitbucke-1472355033252 (pull request #657) javascript.py edited online with Bitbucket
| | * | javascript.py edited online with Bitbucketdevoncarew12016-08-281-3/+4
| | |/
| * | Copyright update.Georg Brandl2017-01-221-1/+1
| | |
| * | Add support for partials and path segments for Handlebars.Christian Hammond2016-11-041-0/+1506
| / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | simplify Lasso's root state with lookaheadEricFromCanada2016-12-031-8/+3
| |
* | Lasso: update keywords for 9.3.2, require \b after parameter localEricFromCanada2016-07-131-16/+16
|/
* Rework CoffeeScript use of slashstartsregex.Tim Hatch2016-05-311-8/+14
| | | | Fixes #991
* add missing view procMichael Demmer2016-03-021-1/+1
|
* add missing reduce procMichael Demmer2016-03-021-1/+1
|
* add a lexer for the juttle languageMichael Demmer2016-03-021-1/+61
|