Skip to content

Commit b2de65a

Browse files
authored
Merge pull request #991 from valtlait/js-operators
Add JS exponentiation & spread/rest operator
2 parents 62e258c + daef55f commit b2de65a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/prism-javascript.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ Prism.languages.javascript = Prism.languages.extend('clike', {
22
'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/,
33
'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
44
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
5-
'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i
5+
'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,
6+
'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/
67
});
78

89
Prism.languages.insertBefore('javascript', 'keyword', {

0 commit comments

Comments
 (0)