File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ Website: https://www.r-project.org
7
7
Category: scientific
8
8
*/
9
9
10
+ import * as regex from '../lib/regex.js' ;
11
+
10
12
export default function ( hljs ) {
11
13
// Identifiers in R cannot start with `_`, but they can start with `.` if it
12
14
// is not immediately followed by a digit.
@@ -15,10 +17,13 @@ export default function(hljs) {
15
17
// handled in a separate mode. See `test/markup/r/names.txt` for examples.
16
18
// FIXME: Support Unicode identifiers.
17
19
const IDENT_RE = / (?: (?: [ a - z A - Z ] | \. [ . _ a - z A - Z ] ) [ . _ a - z A - Z 0 - 9 ] * ) | \. (? ! \d ) / ;
20
+ const SIMPLE_IDENT = / [ a - z A - Z ] [ a - z A - Z _ 0 - 9 ] * / ;
18
21
19
22
return {
20
23
name : 'R' ,
21
24
25
+ // only in Haskell, not R
26
+ illegal : / - > / ,
22
27
keywords : {
23
28
$pattern : IDENT_RE ,
24
29
keyword :
@@ -168,7 +173,10 @@ export default function(hljs) {
168
173
begin : '%' ,
169
174
end : '%'
170
175
} ,
171
-
176
+ // relevance boost for assignment
177
+ {
178
+ begin : regex . concat ( SIMPLE_IDENT , "\\s+<-\\s+" )
179
+ } ,
172
180
{
173
181
// escaped identifier
174
182
begin : '`' ,
You can’t perform that action at this time.
0 commit comments