forked from universal-ctags/ctags
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ctags-lang-r.7.rst.in
93 lines (76 loc) · 2.66 KB
/
ctags-lang-r.7.rst.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
.. _ctags-lang-r(7):
==============================================================
ctags-lang-r
==============================================================
-------------------------------------------------------------------
Random notes about tagging R source code with Universal Ctags
-------------------------------------------------------------------
:Version: @VERSION@
:Manual group: Universal Ctags
:Manual section: 7
SYNOPSIS
--------
| **@CTAGS_NAME_EXECUTABLE@** ... --languages=+R ...
| **@CTAGS_NAME_EXECUTABLE@** ... --language-force=R ...
| **@CTAGS_NAME_EXECUTABLE@** ... --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
============ ==================
Constructor kind
============ ==================
function() function
c() vector
list() list
data.frame() dataframe
============ ==================
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"
.. code-block:: 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"
.. code-block:: tags
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
.. TODO:
- other kinds
- operators for assignment, <-, <<-, ->>, ->, =
- illuminating duplicated tags
- fields (constructor, assignmentop)
- sub parsers
SEE ALSO
--------
ctags(1)