Skip to content

Commit 01148ca

Browse files
committed
Merge branch 'rc/userdiff-r'
Userdiff patterns for the R language. * rc/userdiff-r: userdiff: add support for R programming language
2 parents 88134a8 + 1d9526d commit 01148ca

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

t/t4018/r-indent

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
RIGHT <- function(a, b) {
2+
c = mean(a, b)
3+
d = c + 2
4+
ChangeMe()
5+
return (d)
6+
}

t/t4018/r-indent-nested

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
LEFT = function(a, b) {
2+
c = mean(a, b)
3+
RIGHT = function(d, e) {
4+
f = var(d, e)
5+
g = f + 1
6+
ChangeMe()
7+
return (g)
8+
}
9+
return (RIGHT(2, 3))
10+
}

t/t4018/r-noindent

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
RIGHT <- function(a, b) {
2+
c = mean(a, b)
3+
d = c + 2
4+
ChangeMe()
5+
return (c)
6+
}

userdiff.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ PATTERNS("python",
327327
"|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
328328
"|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"),
329329
/* -- */
330+
PATTERNS("r",
331+
"^[ \t]*([a-zA-z][a-zA-Z0-9_.]*[ \t]*(<-|=)[ \t]*function.*)$",
332+
/* -- */
333+
"[^ \t]+"),
330334
PATTERNS("ruby",
331335
"^[ \t]*((class|module|def)[ \t].*)$",
332336
/* -- */

0 commit comments

Comments
 (0)