1CTAGS-LANG-R(7) Universal Ctags CTAGS-LANG-R(7)
2
3
4
6 ctags-lang-r - Random notes about tagging R source code with Universal
7 Ctags
8
10 ctags ... --languages=+R ...
11 ctags ... --language-force=R ...
12 ctags ... --map-Python=+.r ...
13
14
16 This man page gathers random notes about tagging R source code with
17 Universal Ctags.
18
20 If a variable gets a value returned from a well-known constructor and
21 the variable appears for the first time in the current input file, the
22 R parser makes a tag for the variable and attaches a kind associated
23 with the constructor to the tag regardless of whether the variable ap‐
24 pears in the top-level context or a function.
25
26 Well-known constructor and kind mapping
27
28 ┌─────────────┬───────────┐
29 │Constructor │ kind │
30 ├─────────────┼───────────┤
31 │function() │ function │
32 ├─────────────┼───────────┤
33 │c() │ vector │
34 ├─────────────┼───────────┤
35 │list() │ list │
36 ├─────────────┼───────────┤
37 │data.frame() │ dataframe │
38 └─────────────┴───────────┘
39
40 If a variable doesn't get a value returned from one of well-known con‐
41 structors, the R parser attaches globalVar or functionVar kind to the
42 tag for the variable depending on the context.
43
44 Here is an example demonstrating the usage of the kinds:
45
46 "input.r"
47
48 G <- 1
49 v <- c(1, 2)
50 l <- list(3, 4)
51 d <- data.frame(n = v)
52 f <- function(a) {
53 g <- function (b) a + b
54 w <- c(1, 2)
55 m <- list (3, 4)
56 e <- data.frame(n = w)
57 L <- 2
58 }
59
60 "output.tags" with "--options=NONE --sort=no --fields=+KZ -o - input.r"
61
62 G input.r /^G <- 1$/;" globalVar
63 v input.r /^v <- c(1, 2)$/;" vector
64 l input.r /^l <- list(3, 4)$/;" list
65 d input.r /^d <- data.frame(n = v)$/;" dataframe
66 n input.r /^d <- data.frame(n = v)$/;" nameattr scope:dataframe:d
67 f input.r /^f <- function(a) {$/;" function
68 g input.r /^ g <- function (b) a + b$/;" function scope:function:f
69 w input.r /^ w <- c(1, 2)$/;" vector scope:function:f
70 m input.r /^ m <- list (3, 4)$/;" list scope:function:f
71 e input.r /^ e <- data.frame(n = w)$/;" dataframe scope:function:f
72 n input.r /^ e <- data.frame(n = w)$/;" nameattr scope:dataframe:f.e
73 L input.r /^ L <- 2$/;" functionVar scope:function:f
74
76 ctags(1)
77
78
79
80
815.9.0 CTAGS-LANG-R(7)