Skip to content

Commit

Permalink
Separate hard to read punctuation regex
Browse files Browse the repository at this point in the history
  • Loading branch information
klmr committed May 18, 2021
1 parent f508d48 commit 252483c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/languages/r.js
Expand Up @@ -27,7 +27,14 @@ export default function(hljs) {
/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/
);
const OPERATORS_RE = /[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/;
const PUNCTUATION_RE = /\[\[|[(){}[\]\\,]/;
const PUNCTUATION_RE = regex.either(
/[()]/,
/[{}]/,
/\[\[/,

This comment has been minimized.

Copy link
@klmr

klmr May 18, 2021

Author Contributor

It occurs to me that this case is probably not worth including. The R parser treats [[…]] differently from [ […]], but we don’t have to do the same, right?

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel May 18, 2021

Member

I'm not even sure what you're asking LOL. Looks the same to me.

/[[\]]/,
/\\/,
/,/
);

return {
name: 'R',
Expand Down

0 comments on commit 252483c

Please sign in to comment.