ctags-lang-r - Random notes about tagging R source code with Universal Ctags

NAME  SYNOPSIS  DESCRIPTION  KINDS  SEE ALSO 

NAME

ctags-lang-r − Random notes about tagging R source code with Universal Ctags

SYNOPSIS

ctags ... −−languages=+R ...
ctags
... −−language−force=R ...
ctags
... −−map−R=+.r ...

DESCRIPTION

This man page gathers random notes about tagging R source code with Universal Ctags.

KINDS

If a variable gets a value returned from a well−known constructor and the variable appears for the first time in the current input file, the R parser makes a tag for the variable and attaches a kind associated with the constructor to the tag regardless of whether the variable appears in the top−level context or a function.

Well−known constructor and kind mapping

If a variable doesn't get a value returned from one of well−known constructors, the R parser attaches globalVar or functionVar kind to the tag for the variable depending on the context.

Here is an example demonstrating the usage of the kinds:

"input.r"

G <− 1
v <− c(1, 2)
l <− list(3, 4)
d <− data.frame(n = v)
f <− function(a) {
        g <− function (b) a + b
        w <− c(1, 2)
        m <− list (3, 4)
        e <− data.frame(n = w)
        L <− 2
}

"output.tags" with "−−options=NONE −−sort=no −−fields=+KZ −o − input.r"

G       input.r /ˆG <− 1$/;"    globalVar
v       input.r /ˆv <− c(1, 2)$/;"      vector
l       input.r /ˆl <− list(3, 4)$/;"   list
d       input.r /ˆd <− data.frame(n = v)$/;"    dataframe
n       input.r /ˆd <− data.frame(n = v)$/;"    nameattr        scope:dataframe:d
f       input.r /ˆf <− function(a) {$/;"        function
g       input.r /ˆ      g <− function (b) a + b$/;"     function        scope:function:f
w       input.r /ˆ      w <− c(1, 2)$/;"        vector  scope:function:f
m       input.r /ˆ      m <− list (3, 4)$/;"    list    scope:function:f
e       input.r /ˆ      e <− data.frame(n = w)$/;"      dataframe       scope:function:f
n       input.r /ˆ      e <− data.frame(n = w)$/;"      nameattr        scope:dataframe:f.e
L       input.r /ˆ      L <− 2$/;"      functionVar     scope:function:f

SEE ALSO

ctags(1)


Updated 2024-01-29 - jenkler.se | uex.se