Merge branch 'rc/userdiff-r'

Userdiff patterns for the R language.

* rc/userdiff-r:
  userdiff: add support for R programming language
This commit is contained in:
Junio C Hamano
2025-06-17 10:44:38 -07:00
4 changed files with 26 additions and 0 deletions

6
t/t4018/r-indent Normal file
View File

@@ -0,0 +1,6 @@
RIGHT <- function(a, b) {
c = mean(a, b)
d = c + 2
ChangeMe()
return (d)
}

10
t/t4018/r-indent-nested Normal file
View File

@@ -0,0 +1,10 @@
LEFT = function(a, b) {
c = mean(a, b)
RIGHT = function(d, e) {
f = var(d, e)
g = f + 1
ChangeMe()
return (g)
}
return (RIGHT(2, 3))
}

6
t/t4018/r-noindent Normal file
View File

@@ -0,0 +1,6 @@
RIGHT <- function(a, b) {
c = mean(a, b)
d = c + 2
ChangeMe()
return (c)
}

View File

@@ -327,6 +327,10 @@ PATTERNS("python",
"|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
"|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"),
/* -- */
PATTERNS("r",
"^[ \t]*([a-zA-z][a-zA-Z0-9_.]*[ \t]*(<-|=)[ \t]*function.*)$",
/* -- */
"[^ \t]+"),
PATTERNS("ruby",
"^[ \t]*((class|module|def)[ \t].*)$",
/* -- */