Skip to content

Commit 252483c

Browse files
committed
Separate hard to read punctuation regex
1 parent f508d48 commit 252483c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/languages/r.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ export default function(hljs) {
2727
/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/
2828
);
2929
const OPERATORS_RE = /[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/;
30-
const PUNCTUATION_RE = /\[\[|[(){}[\]\\,]/;
30+
const PUNCTUATION_RE = regex.either(
31+
/[()]/,
32+
/[{}]/,
33+
/\[\[/,
34+
/[[\]]/,
35+
/\\/,
36+
/,/
37+
);
3138

3239
return {
3340
name: 'R',

0 commit comments

Comments
 (0)