components/prism-javascript.js


Log

Author Commit Date CI Message
Golmote 12c0b20a 2018-03-08T22:19:01 Decouple minus sign from number pattern in most languages. Close #1110
Golmote 7dc1e453 2017-12-05T08:58:11 CSS and JS: Make CSS and JS inclusions in Markup greedy. Fix #1240
Valtteri Laitinen de6de454 2017-11-21T09:20:11 Optimize more Unicode regexes (#1229) In previous commit, #1227, a “function” regex JavaScript definition was updated. The same regex is used in few more points, and this PR optimizes them too. Tests are ran and passed.
Valtteri Laitinen f234ea40 2017-11-20T23:34:38 Unicode characters in CSS properties (#1227) * Unicode characters in CSS properties Highlight Unicode characters in CSS properties correctly, for example “.foo { --bär: 3 }”. Optimized the “function” regex in the JavaScript definition: replaced “_a-zA-Z0-9” with “\w”, removed uppercase “A-Z” because the “i” flag is set. Used that regex for CSS but removed “$” and added “-”. * Add a test * Add minified versions * Update prism.js * Revert "Update prism.js" This reverts commit 241464ba1ba5e350b8483d926e73364f9e9d99c4. * Update prism.js too
Golmote 93d4002c 2017-10-22T14:46:33 JavaScript: Regexp optimisation + don't use captures if not needed
Golmote 8ee2cd38 2017-10-10T08:35:13 JavaScript: Better highlighting of functions (#1190)
Golmote ac09e975 2017-07-11T08:13:50 JavaScript: Reduced backtracking in regex pattern. Fix #1159
Marius Schulz d4ee904e 2017-07-02T05:27:11 Allows uppercase prefixes in JS number literals (#1151) JavaScript allows both lowercase and uppercase prefixes in number literals. With this commit, `0X`, `0B`, and `0O` are now supported as well.
Valtteri Laitinen 8aa2cc4a 2017-05-08T13:56:50 Replace [\w\W] with [\s\S] and [0-9] with \d in regexes (#1107) * Replace [\w\W] with [^] and [0-9] with \d in regexes * Replace [\s\S] with [^] * Replace [^] with [\s\S]
Golmote 9f649fbe 2017-05-08T12:05:35 JavaScript: Properly match every operator as a whole token. Fix #1133
Valtteri Laitinen daef55f8 2016-07-01T02:23:23 JS: add exponentiation & spread/rest operator Add JavaScript `**` and `...` operators
Andreas Rohner 1158e460 2016-06-03T11:34:01 Rearrange the `string` and `template-string` token in JavaScript It is more likely that single and double quotes appear in a template string, than backticks in a normal string. Fixes issue #963.
Andreas Rohner 49cf8991 2016-03-08T15:03:59 Fix minor bug with new greedy-feature This fixes a minor bug that causes invalid highlighting in some edge cases, where two greedy patterns overlap each other.
Andreas Rohner 2705c509 2015-09-24T19:36:10 Partial solution for the "Comment-like substrings"-problem This patch introduces a new attribute called `greedy`. The attribute is a simple boolean flag. If there is no match for a greedy pattern it can concatenate the next two tokens into a single string and try to match on this string again. If a match is found on the second attempt, then the old tokens are deleted and replaced by the new match. This solves the "Comment-like substrings"-problem for exactly one comment at very little cost. With this patch the following code is highlighted correctly: "foo /* bar */ baz"; "foo // bar"; /lala"test"sdf/; This approach fails if there are more than one comments inside the string: "foo /* bar */ baz /* bar */ baz"; Signed-off-by: Andreas Rohner <andreas.rohner@gmx.net>
Andreas Rohner ab65be27 2016-02-12T21:32:19 Fix catastrophic backtracking regex issues
Chaos Shen ad316a36 2015-10-10T17:51:31 Improve highlight: - add highlight for directives in C/C++ macros and C#/F# preprocessor lines; - add some predefined constants in C; - remove 'true' and 'false' from keyword list in JavaScript, they should be considered as boolean constant.
Golmote 29643f4e 2015-10-06T08:48:21 Simplify patterns for <style> and <script> tags
Golmote 2f9fe1ef 2015-09-03T23:39:16 Added some language aliases.
Golmote 29e26dc3 2015-09-03T23:14:19 JavaScript: Allow for all non-ASCII characters in function names. Fix #400
Timothy Gu a58bf9ae 2015-05-07T21:01:26 javascript: Add async/await
Golmote a7064dd4 2015-06-20T20:07:37 Moved up JS strings before template strings as they are far more common
Golmote 476cbf42 2015-06-20T20:06:39 Improved regex performance of C-like strings and JS regexps
Jannik Zschiesche a8aa0588 2015-06-14T18:18:37 Implemented support for octal and binary numbers in javascript They are supported from ES6+
Golmote 04f72b14 2015-06-14T18:26:16 ES6: Template strings + interpolation
Logan Franken ca68b876 2015-06-14T00:53:20 Added support for missing ES6 keywords in JavaScript
Logan Franken 5d99957a 2015-06-14T00:48:06 Added support for 'y' and 'u' ES6 JavaScript regex flags
Golmote b1fd5bdc 2015-03-10T08:27:53 Removed unused global flag in all grammars
Golmote 3b052132 2014-12-20T19:35:18 JS function can contain $
Golmote 22ec5cb2 2014-12-20T19:33:43 Exponent may be signed with +
Andreas Rohner 3154f9b9 2014-11-15T19:09:40 Move invalid alias declarations, which cause HTML highlighting to fail The alias declarations in prism-javascript.js and prism-css.js are in the wrong place and must be moved inside of the pattern object. Otherwise they get injected into the markup grammar. The execution fails, because the alias is a string and not a RegExp.
Lea Verou 23edcc8c 2014-11-14T20:10:05 Added language-xxx aliases in nested language refs to ease styling
Jannik Zschiesche d27b693f 2014-06-01T17:18:03 Updated keywords in JavaScript definition * Sort keywords alphabetically (to ease maintenance) * Added all missing keywords * Added ECMAScript 5 keywords * Added true/false/null as explicit keywords Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words Fixes #270
Lea Verou d44312b6 2014-05-24T14:25:49 Converted the CSS, SCSS and JS grammars according to #258
Adam Zapletal 1f6b1295 2014-04-02T01:20:23 Add `this` as a keyword in JavaScript
Lea Verou 6e3e5bab 2014-02-27T20:25:09 Added get/set to JS keywords
Bart Veneman 3c9155e6 2013-08-04T10:52:21 Added throw keyword to c-like and javascript
mseeboeck edb0f128 2012-12-17T09:03:32 Also changed the 2 corresponding files in /components.
Lea Verou 1cdfcb84 2012-11-11T04:25:56 Fixed #37
Lea Verou 1b40db97 2012-11-10T00:23:33 Made Java & JavaScript inherit from a generic C-style language definition; Added methods for language definition inheritance; Added simple dependency management in downloader
Lea Verou e95a85c0 2012-07-31T16:17:53 Merged the comment and line-comment tokens
Lea Verou c8795ed1 2012-07-31T12:25:32 Improved regex matching, docs updates
Lea Verou 9eeeb7c6 2012-07-29T01:03:05 Moved inline CSS & JS to their language definitions
Lea Verou 27ffa5b0 2012-07-27T03:24:09 Fixed serious highlighting bug, reduced known failures from 3 to 1
Lea Verou bd4e8d15 2012-07-23T18:54:30 ALL THE THINGS! Most notably: Simple templating, API changes, show invisibles plugin, download (build) page
Lea Verou 2c473547 2012-07-15T16:35:06 Fixed regexes further, documented lookbehind feature
Lea Verou 6f1dc184 2012-07-15T14:04:25 Fixed regex & single line comment conflicts
Lea Verou 2d530f0a 2012-07-13T15:18:28 Experimental highlighting of tab characters in JS code.
Lea Verou 4039200f 2012-07-11T14:19:45 Added * and / operators
Lea Verou 4552f5c7 2012-07-10T22:48:14 First commit