From 50078bd57e65809d0f33c1522a4458cef41c14e0 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Sun, 19 May 2019 13:36:15 -0300 Subject: [PATCH] Add syntax highlighting support for numeric separators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This applies @RunDevelopmentā€™s patch from https://github.com/PrismJS/prism/pull/1895. It can be removed once a new prism-js release is published to npm. Closes #182. --- prism-languages.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prism-languages.js b/prism-languages.js index ad3574597..1595bc787 100644 --- a/prism-languages.js +++ b/prism-languages.js @@ -13,6 +13,11 @@ const installPrismLanguages = (Prism) => { + // Add support for numeric separators. + // TODO: Remove this once a `prism-js` version containing + // https://github.com/PrismJS/prism/pull/1895 is released. + Prism.languages.javascript.number = /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/; + // Based on the grammar defined at the bottom of: // https://cs.chromium.org/chromium/src/v8/src/torque/torque-parser.cc Prism.languages.torque = {