aboutsummaryrefslogtreecommitdiff
path: root/ctags/docs/man/ctags-lang-r.7.html
blob: f7f93e784480c8d11bce9cb2be6696db875b3ef1 (plain)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>ctags-lang-r &#8212; Universal Ctags 0.3.0 documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/classic.css" />
    
    <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
    <script src="../_static/jquery.js"></script>
    <script src="../_static/underscore.js"></script>
    <script src="../_static/doctools.js"></script>
    
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="ctags-lang-sql" href="ctags-lang-sql.7.html" />
    <link rel="prev" title="ctags-lang-inko" href="ctags-lang-inko.7.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="ctags-lang-sql.7.html" title="ctags-lang-sql"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="ctags-lang-inko.7.html" title="ctags-lang-inko"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">Universal Ctags 0.3.0 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../man-pages.html" accesskey="U">Man pages</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">ctags-lang-r</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="ctags-lang-r">
<span id="ctags-lang-r-7"></span><h1>ctags-lang-r<a class="headerlink" href="#ctags-lang-r" title="Permalink to this headline"></a></h1>
<p>Random notes about tagging R source code with Universal Ctags</p>
<dl class="field-list simple">
<dt class="field-odd">Version</dt>
<dd class="field-odd"><p>5.9.0</p>
</dd>
<dt class="field-even">Manual group</dt>
<dd class="field-even"><p>Universal Ctags</p>
</dd>
<dt class="field-odd">Manual section</dt>
<dd class="field-odd"><p>7</p>
</dd>
</dl>
<section id="synopsis">
<h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><strong>ctags</strong> … --languages=+R …</div>
<div class="line"><strong>ctags</strong> … --language-force=R …</div>
<div class="line"><strong>ctags</strong> … --map-Python=+.r …</div>
</div>
</section>
<section id="description">
<h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>This man page gathers random notes about tagging R source code
with Universal Ctags.</p>
</section>
<section id="kinds">
<h2>Kinds<a class="headerlink" href="#kinds" title="Permalink to this headline"></a></h2>
<p>If a variable gets a value returned from a <em>well-known constructor</em>
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.</p>
<p>Well-known constructor and kind mapping</p>
<blockquote>
<div><table class="docutils align-default">
<colgroup>
<col style="width: 40%" />
<col style="width: 60%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Constructor</p></th>
<th class="head"><p>kind</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>function()</p></td>
<td><p>function</p></td>
</tr>
<tr class="row-odd"><td><p>c()</p></td>
<td><p>vector</p></td>
</tr>
<tr class="row-even"><td><p>list()</p></td>
<td><p>list</p></td>
</tr>
<tr class="row-odd"><td><p>data.frame()</p></td>
<td><p>dataframe</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>If a variable doesn’t get a value returned from one of well-known
constructors, the R parser attaches <code class="docutils literal notranslate"><span class="pre">globalVar</span></code> or <code class="docutils literal notranslate"><span class="pre">functionVar</span></code> kind
to the tag for the variable depending on the context.</p>
<p>Here is an example demonstrating the usage of the kinds:</p>
<p>“input.r”</p>
<div class="highlight-R notranslate"><div class="highlight"><pre><span></span><span class="n">G</span> <span class="o">&lt;-</span> <span class="m">1</span>
<span class="n">v</span> <span class="o">&lt;-</span> <span class="nf">c</span><span class="p">(</span><span class="m">1</span><span class="p">,</span> <span class="m">2</span><span class="p">)</span>
<span class="n">l</span> <span class="o">&lt;-</span> <span class="nf">list</span><span class="p">(</span><span class="m">3</span><span class="p">,</span> <span class="m">4</span><span class="p">)</span>
<span class="n">d</span> <span class="o">&lt;-</span> <span class="nf">data.frame</span><span class="p">(</span><span class="n">n</span> <span class="o">=</span> <span class="n">v</span><span class="p">)</span>
<span class="n">f</span> <span class="o">&lt;-</span> <span class="nf">function</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="p">{</span>
        <span class="n">g</span> <span class="o">&lt;-</span> <span class="nf">function </span><span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
        <span class="n">w</span> <span class="o">&lt;-</span> <span class="nf">c</span><span class="p">(</span><span class="m">1</span><span class="p">,</span> <span class="m">2</span><span class="p">)</span>
        <span class="n">m</span> <span class="o">&lt;-</span> <span class="nf">list </span><span class="p">(</span><span class="m">3</span><span class="p">,</span> <span class="m">4</span><span class="p">)</span>
        <span class="n">e</span> <span class="o">&lt;-</span> <span class="nf">data.frame</span><span class="p">(</span><span class="n">n</span> <span class="o">=</span> <span class="n">w</span><span class="p">)</span>
        <span class="n">L</span> <span class="o">&lt;-</span> <span class="m">2</span>
<span class="p">}</span>
</pre></div>
</div>
<p>“output.tags”
with “--options=NONE --sort=no --fields=+KZ -o - input.r”</p>
<div class="highlight-tags notranslate"><div class="highlight"><pre><span></span>G       input.r /^G &lt;- 1$/;&quot;    globalVar
v       input.r /^v &lt;- c(1, 2)$/;&quot;      vector
l       input.r /^l &lt;- list(3, 4)$/;&quot;   list
d       input.r /^d &lt;- data.frame(n = v)$/;&quot;    dataframe
n       input.r /^d &lt;- data.frame(n = v)$/;&quot;    nameattr        scope:dataframe:d
f       input.r /^f &lt;- function(a) {$/;&quot;        function
g       input.r /^      g &lt;- function (b) a + b$/;&quot;     function        scope:function:f
w       input.r /^      w &lt;- c(1, 2)$/;&quot;        vector  scope:function:f
m       input.r /^      m &lt;- list (3, 4)$/;&quot;    list    scope:function:f
e       input.r /^      e &lt;- data.frame(n = w)$/;&quot;      dataframe       scope:function:f
n       input.r /^      e &lt;- data.frame(n = w)$/;&quot;      nameattr        scope:dataframe:f.e
L       input.r /^      L &lt;- 2$/;&quot;      functionVar     scope:function:f
</pre></div>
</div>
</section>
<section id="see-also">
<h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="ctags.1.html#ctags-1"><span class="std std-ref">ctags(1)</span></a></p>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">ctags-lang-r</a><ul>
<li><a class="reference internal" href="#synopsis">SYNOPSIS</a></li>
<li><a class="reference internal" href="#description">DESCRIPTION</a></li>
<li><a class="reference internal" href="#kinds">Kinds</a></li>
<li><a class="reference internal" href="#see-also">SEE ALSO</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="ctags-lang-inko.7.html"
                        title="previous chapter">ctags-lang-inko</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="ctags-lang-sql.7.html"
                        title="next chapter">ctags-lang-sql</a></p>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="ctags-lang-sql.7.html" title="ctags-lang-sql"
             >next</a> |</li>
        <li class="right" >
          <a href="ctags-lang-inko.7.html" title="ctags-lang-inko"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">Universal Ctags 0.3.0 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../man-pages.html" >Man pages</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">ctags-lang-r</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2015, Universal Ctags Team.
      Last updated on 11 Jun 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.0.2.
    </div>
  </body>
</html>