From daef55f80da5895a9e49a57f1099a3b4ba3a1505 Mon Sep 17 00:00:00 2001 From: Valtteri Laitinen Date: Fri, 1 Jul 2016 02:23:23 +0300 Subject: [PATCH] JS: add exponentiation & spread/rest operator Add JavaScript `**` and `...` operators --- components/prism-javascript.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/prism-javascript.js b/components/prism-javascript.js index 082846a151..f78d994d34 100644 --- a/components/prism-javascript.js +++ b/components/prism-javascript.js @@ -2,7 +2,8 @@ Prism.languages.javascript = Prism.languages.extend('clike', { 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/, 'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/, // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) - 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i + 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i, + 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/ }); Prism.languages.insertBefore('javascript', 'keyword', {