diff options
Diffstat (limited to 'ctags/docs/man/readtags.1.html')
-rw-r--r-- | ctags/docs/man/readtags.1.html | 449 |
1 files changed, 449 insertions, 0 deletions
diff --git a/ctags/docs/man/readtags.1.html b/ctags/docs/man/readtags.1.html new file mode 100644 index 0000000..0a8e867 --- /dev/null +++ b/ctags/docs/man/readtags.1.html @@ -0,0 +1,449 @@ + +<!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>readtags — 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="Parsers" href="../parsers.html" /> + <link rel="prev" title="ctags-incompatibilities" href="ctags-incompatibilities.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="../parsers.html" title="Parsers" + accesskey="N">next</a> |</li> + <li class="right" > + <a href="ctags-incompatibilities.7.html" title="ctags-incompatibilities" + accesskey="P">previous</a> |</li> + <li class="nav-item nav-item-0"><a href="../index.html">Universal Ctags 0.3.0 documentation</a> »</li> + <li class="nav-item nav-item-1"><a href="../man-pages.html" accesskey="U">Man pages</a> »</li> + <li class="nav-item nav-item-this"><a href="">readtags</a></li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + + <section id="readtags"> +<span id="readtags-1"></span><h1>readtags<a class="headerlink" href="#readtags" title="Permalink to this headline">¶</a></h1> +<p>Find tag file entries matching specified names</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>1</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>readtags</strong> -h | --help</div> +<div class="line"><strong>readtags</strong> (-H | --help-expression) (filter|sorter)</div> +<div class="line"><strong>readtags</strong> [OPTION]… ACTION</div> +</div> +</section> +<section id="description"> +<h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2> +<p>The <strong>readtags</strong> program filters, sorts and prints tag entries in a tags file. +The basic filtering is done using <strong>actions</strong>, by which you can list all +regular tags, pseudo tags or regular tags matching specific name. Then, further +filtering and sorting can be done using <strong>post processors</strong>, namely <strong>filter +expressions</strong> and <strong>sorter expressions</strong>.</p> +</section> +<section id="actions"> +<h2>ACTIONS<a class="headerlink" href="#actions" title="Permalink to this headline">¶</a></h2> +<dl class="simple"> +<dt><code class="docutils literal notranslate"><span class="pre">-l</span></code>, <code class="docutils literal notranslate"><span class="pre">--list</span></code></dt><dd><p>List regular tags.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">[-]</span> <span class="pre">NAME</span></code></dt><dd><p>List regular tags matching NAME. +“-” as NAME indicates arguments after this as NAME even if they start with -.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">-D</span></code>, <code class="docutils literal notranslate"><span class="pre">--list-pseudo-tags</span></code></dt><dd><p>Equivalent to <code class="docutils literal notranslate"><span class="pre">--list-pseudo-tags</span></code>.</p> +</dd> +</dl> +</section> +<section id="options"> +<h2>OPTIONS<a class="headerlink" href="#options" title="Permalink to this headline">¶</a></h2> +<section id="controlling-the-tags-reading-behavior"> +<h3>Controlling the Tags Reading Behavior<a class="headerlink" href="#controlling-the-tags-reading-behavior" title="Permalink to this headline">¶</a></h3> +<p>The behavior of reading tags can be controlled using these options:</p> +<dl class="simple"> +<dt><code class="docutils literal notranslate"><span class="pre">-t</span> <span class="pre">TAGFILE</span></code>, <code class="docutils literal notranslate"><span class="pre">--tag-file</span> <span class="pre">TAGFILE</span></code></dt><dd><p>Use specified tag file (default: “tags”).</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">-s[0|1|2]</span></code>, <code class="docutils literal notranslate"><span class="pre">--override-sort-detection</span> <span class="pre">METHOD</span></code></dt><dd><p>Override sort detection of tag file. +METHOD: unsorted|sorted|foldcase</p> +</dd> +</dl> +<p>The NAME action will perform binary search on sorted (including “foldcase”) +tags files, which is much faster then on unsorted tags files.</p> +</section> +<section id="controlling-the-name-action-behavior"> +<h3>Controlling the NAME Action Behavior<a class="headerlink" href="#controlling-the-name-action-behavior" title="Permalink to this headline">¶</a></h3> +<p>The behavior of the NAME action can be controlled using these options:</p> +<dl class="simple"> +<dt><code class="docutils literal notranslate"><span class="pre">-i</span></code>, <code class="docutils literal notranslate"><span class="pre">--icase-match</span></code></dt><dd><p>Perform case-insensitive matching in the NAME action.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">-p</span></code>, <code class="docutils literal notranslate"><span class="pre">--prefix-match</span></code></dt><dd><p>Perform prefix matching in the NAME action.</p> +</dd> +</dl> +</section> +<section id="controlling-the-output"> +<h3>Controlling the Output<a class="headerlink" href="#controlling-the-output" title="Permalink to this headline">¶</a></h3> +<p>By default, the output of readtags contains only the name, input and pattern +field. The Output can be tweaked using these options:</p> +<dl class="simple"> +<dt><code class="docutils literal notranslate"><span class="pre">-d</span></code>, <code class="docutils literal notranslate"><span class="pre">--debug</span></code></dt><dd><p>Turn on debugging output.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">-E</span></code>, <code class="docutils literal notranslate"><span class="pre">--escape-output</span></code></dt><dd><p>Escape characters like tabs in output as described in <a class="reference internal" href="tags.5.html#tags-5"><span class="std std-ref">tags(5)</span></a>.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">-e</span></code>, <code class="docutils literal notranslate"><span class="pre">--extension-fields</span></code></dt><dd><p>Include extension fields in output.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">-n</span></code>, <code class="docutils literal notranslate"><span class="pre">--line-number</span></code></dt><dd><p>Also include the line number field when <code class="docutils literal notranslate"><span class="pre">-e</span></code> option is give.</p> +</dd> +</dl> +<p>About the <code class="docutils literal notranslate"><span class="pre">-E</span></code> option: certain characters are escaped in a tags file, to make +it machine-readable. e.g., ensuring no tabs character appear in fields other +than the pattern field. By default, readtags translates them to make it +human-readable, but when utilizing readtags output in a script or a client +tool, <code class="docutils literal notranslate"><span class="pre">-E</span></code> option should be used. See <a class="reference internal" href="ctags-client-tools.7.html#ctags-client-tools-7"><span class="std std-ref">ctags-client-tools(7)</span></a> for more +discussion on this.</p> +</section> +<section id="filtering-and-sorting"> +<h3>Filtering and Sorting<a class="headerlink" href="#filtering-and-sorting" title="Permalink to this headline">¶</a></h3> +<p>Further filtering and sorting on the tags listed by actions are performed using:</p> +<dl class="simple"> +<dt><code class="docutils literal notranslate"><span class="pre">-Q</span> <span class="pre">EXP</span></code>, <code class="docutils literal notranslate"><span class="pre">--filter</span> <span class="pre">EXP</span></code></dt><dd><p>Filter the tags listed by ACTION with EXP before printing.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">-S</span> <span class="pre">EXP</span></code>, <code class="docutils literal notranslate"><span class="pre">--sorter</span> <span class="pre">EXP</span></code></dt><dd><p>Sort the tags listed by ACTION with EXP before printing.</p> +</dd> +</dl> +<p>These are discussed in the <a class="reference internal" href="#expression">EXPRESSION</a> section.</p> +</section> +<section id="examples"> +<h3>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h3> +<ul> +<li><p>List all tags in “/path/to/tags”:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -t /path/to/tags -l +</pre></div> +</div> +</li> +<li><p>List all tags in “tags” that start with “mymethod”:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -p - mymethod +</pre></div> +</div> +</li> +<li><p>List all tags matching “mymethod”, case insensitively:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -i - mymethod +</pre></div> +</div> +</li> +<li><p>List all tags start with “myvar”, and printing all fields (i.e., the whole line):</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -p -ne - myvar +</pre></div> +</div> +</li> +</ul> +</section> +</section> +<section id="expression"> +<h2>EXPRESSION<a class="headerlink" href="#expression" title="Permalink to this headline">¶</a></h2> +<p>Scheme-style expressions are used for the <code class="docutils literal notranslate"><span class="pre">-Q</span></code> and <code class="docutils literal notranslate"><span class="pre">-S</span></code> options. For those +who doesn’t know Scheme or Lisp, just remember:</p> +<ul class="simple"> +<li><p>A function call is wrapped in a pair of parenthesis. The first item in it is +the function/operator name, the others are arguments.</p></li> +<li><p>Function calls can be nested.</p></li> +<li><p>Missing values and boolean false are represented by <code class="docutils literal notranslate"><span class="pre">#f</span></code>. <code class="docutils literal notranslate"><span class="pre">#t</span></code> and all +other values are considered to be true.</p></li> +</ul> +<p>So, <code class="docutils literal notranslate"><span class="pre">(+</span> <span class="pre">1</span> <span class="pre">(+</span> <span class="pre">2</span> <span class="pre">3))</span></code> means add 2 and 3 first, then add the result with 1. +<code class="docutils literal notranslate"><span class="pre">(and</span> <span class="pre">"string"</span> <span class="pre">1</span> <span class="pre">#t)</span></code> means logical AND on <code class="docutils literal notranslate"><span class="pre">"string"</span></code>, <code class="docutils literal notranslate"><span class="pre">1</span></code> and <code class="docutils literal notranslate"><span class="pre">#t</span></code>, +and the result is true since there is no <code class="docutils literal notranslate"><span class="pre">#f</span></code>.</p> +<section id="filtering"> +<h3>Filtering<a class="headerlink" href="#filtering" title="Permalink to this headline">¶</a></h3> +<p>The tag entries that make the filter expression produces true value are printed +by readtags.</p> +<p>The basic operators for filtering are <code class="docutils literal notranslate"><span class="pre">eq?</span></code>, <code class="docutils literal notranslate"><span class="pre">prefix?</span></code>, <code class="docutils literal notranslate"><span class="pre">suffix?</span></code>, +<code class="docutils literal notranslate"><span class="pre">substr?</span></code>, and <code class="docutils literal notranslate"><span class="pre">#/PATTERN/</span></code>. Language common fields can be accessed using +variables starting with <code class="docutils literal notranslate"><span class="pre">$</span></code>, e.g., <code class="docutils literal notranslate"><span class="pre">$language</span></code> represents the language field. +For example:</p> +<ul> +<li><p>List all tags start with “myfunc” in Python code files:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -p -Q <span class="s1">'(eq? $language "Python")'</span> - myfunc +</pre></div> +</div> +</li> +</ul> +<p><code class="docutils literal notranslate"><span class="pre">downcase</span></code> or <code class="docutils literal notranslate"><span class="pre">upcase</span></code> operators can be used to perform case-insensitive +matching:</p> +<ul> +<li><p>List all tags containing “my”, case insensitively:</p> +<blockquote> +<div><div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -Q <span class="s1">'(substr? (downcase $name) "my")'</span> -l +</pre></div> +</div> +</div></blockquote> +</li> +</ul> +<p>We have logical operators like <code class="docutils literal notranslate"><span class="pre">and</span></code>, <code class="docutils literal notranslate"><span class="pre">or</span></code> and <code class="docutils literal notranslate"><span class="pre">not</span></code>. The value of a +missing field is #f, so we could deal with missing fields:</p> +<ul> +<li><p>List all tags containing “impl” in Python code files, but allow the +<code class="docutils literal notranslate"><span class="pre">language:</span></code> field to be missing:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span>$ readtags -Q '(and (substr? $name "impl")\ + (or (not $language)\ + (eq? $language "Python")))' -l +</pre></div> +</div> +</li> +</ul> +<p><code class="docutils literal notranslate"><span class="pre">#/PATTERN/</span></code> is for the case when string predicates (<code class="docutils literal notranslate"><span class="pre">prefix?</span></code>, <code class="docutils literal notranslate"><span class="pre">suffix?</span></code>, +and <code class="docutils literal notranslate"><span class="pre">substr?</span></code>) are not enough. You can use “Posix extended regular expression” +as PATTERN.</p> +<ul> +<li><p>List all tags inherits from the class “A”:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -Q <span class="s1">'(#/(^|,) ?A(,|$)/ $inherits)'</span> -l +</pre></div> +</div> +</li> +</ul> +<p>Here <code class="docutils literal notranslate"><span class="pre">$inherits</span></code> is a comma-separated class list like “A,B,C”, “P, A, Q”, or +just “A”. Notice that this filter works on both situations where there’s a +space after each comma or there’s not.</p> +<p>Case-insensitive matching can be performed by <code class="docutils literal notranslate"><span class="pre">#/PATTERN/i</span></code>:</p> +<ul> +<li><p>List all tags inherits from the class “A” or “a”:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -Q <span class="s1">'(#/(^|,) ?A(,|$)/i $inherits)'</span> -l +</pre></div> +</div> +</li> +</ul> +<p>To include “/” in a pattern, prefix <code class="docutils literal notranslate"><span class="pre">\</span></code> to the “/”.</p> +<p>NOTE: The above regular expression pattern for inspecting inheritances is just +an example to show how to use <code class="docutils literal notranslate"><span class="pre">#/PATTERN/</span></code> expression. Tags file generators +have no consensus about the format of <code class="docutils literal notranslate"><span class="pre">inherits:</span></code>, e.g., whether there should +be a space after a comma. Even parsers in ctags have no consensus. Noticing the +format of the <code class="docutils literal notranslate"><span class="pre">inherits:</span></code> field of specific languages is needed for such +queries.</p> +<p>The expressions <code class="docutils literal notranslate"><span class="pre">#/PATTERN/</span></code> and <code class="docutils literal notranslate"><span class="pre">#/PATTERN/i</span></code> are for interactive use. +Readtags also offers an alias <code class="docutils literal notranslate"><span class="pre">string->regexp</span></code>, so <code class="docutils literal notranslate"><span class="pre">#/PATTERN/</span></code> is equal to +<code class="docutils literal notranslate"><span class="pre">(string->regexp</span> <span class="pre">"PATTERN")</span></code>, and <code class="docutils literal notranslate"><span class="pre">#/PATTERN/i</span></code> is equal to +<code class="docutils literal notranslate"><span class="pre">(string->regexp</span> <span class="pre">"PATTERN"</span> <span class="pre">:case-fold</span> <span class="pre">#t)</span></code>. <code class="docutils literal notranslate"><span class="pre">string->regexp</span></code> doesn’t need +to prefix <code class="docutils literal notranslate"><span class="pre">\</span></code> for including “/” in a pattern. <code class="docutils literal notranslate"><span class="pre">string->regexp</span></code> may simplify +a client tool building an expression. See also <a class="reference internal" href="ctags-client-tools.7.html#ctags-client-tools-7"><span class="std std-ref">ctags-client-tools(7)</span></a> for +building expressions in your tool.</p> +<p>Let’s now consider missing fields. The tags file may have tag entries that has +no <code class="docutils literal notranslate"><span class="pre">inherits:</span></code> field. In that case <code class="docutils literal notranslate"><span class="pre">$inherits</span></code> is #f, and the regular +expression matching raises an error, since string operators only work for +strings. To avoid this problem:</p> +<ul> +<li><p>Safely list all tags inherits from the class “A”:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -Q <span class="s1">'(and $inherits (#/(^|,) ?A(,|$)/ $inherits))'</span> -l +</pre></div> +</div> +</li> +</ul> +<p>This makes sure <code class="docutils literal notranslate"><span class="pre">$inherits</span></code> is not missing first, then match it by regexp.</p> +<p>Sometimes you want to keep tags where the field <em>is</em> missing. For example, your +want to exclude reference tags, which is marked by the <code class="docutils literal notranslate"><span class="pre">extras:</span></code> field, then +you want to keep tags who doesn’t have <code class="docutils literal notranslate"><span class="pre">extras:</span></code> field since they are also +not reference tags. Here’s how to do it:</p> +<ul> +<li><p>List all tags but the reference tags:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -Q <span class="s1">'(or (not $extras) (#/(^|,) ?reference(,|$)/ $extras))'</span> -l +</pre></div> +</div> +</li> +</ul> +<p>Notice that <code class="docutils literal notranslate"><span class="pre">(not</span> <span class="pre">$extras)</span></code> produces <code class="docutils literal notranslate"><span class="pre">#t</span></code> when <code class="docutils literal notranslate"><span class="pre">$extras</span></code> is missing, so +the whole <code class="docutils literal notranslate"><span class="pre">or</span></code> expression produces <code class="docutils literal notranslate"><span class="pre">#t</span></code>.</p> +<p>Run “readtags -H filter” to know about all valid functions and variables.</p> +</section> +<section id="sorting"> +<h3>Sorting<a class="headerlink" href="#sorting" title="Permalink to this headline">¶</a></h3> +<p>When sorting, the sorter expression is evaluated on two tag entries to decide +which should sort before the other one, until the order of all tag entries is +decided.</p> +<p>In a sorter expression, <code class="docutils literal notranslate"><span class="pre">$</span></code> and <code class="docutils literal notranslate"><span class="pre">&</span></code> are used to access the fields in the +two tag entries, and let’s call them $-entry and &-entry. The sorter expression +should have a value of -1, 0 or 1. The value -1 means the $-entry should be put +above the &-entry, 1 means the contrary, and 0 makes their order in the output +uncertain.</p> +<p>The core operator of sorting is <code class="docutils literal notranslate"><span class="pre"><></span></code>. It’s used to compare two strings or two +numbers (numbers are for the <code class="docutils literal notranslate"><span class="pre">line:</span></code> or <code class="docutils literal notranslate"><span class="pre">end:</span></code> fields). In <code class="docutils literal notranslate"><span class="pre">(<></span> <span class="pre">a</span> <span class="pre">b)</span></code>, if +<code class="docutils literal notranslate"><span class="pre">a</span></code> < <code class="docutils literal notranslate"><span class="pre">b</span></code>, the result is -1; <code class="docutils literal notranslate"><span class="pre">a</span></code> > <code class="docutils literal notranslate"><span class="pre">b</span></code> produces 1, and <code class="docutils literal notranslate"><span class="pre">a</span></code> = <code class="docutils literal notranslate"><span class="pre">b</span></code> +produces 0. Strings are compared using the <code class="docutils literal notranslate"><span class="pre">strcmp</span></code> function, see strcmp(3).</p> +<p>For example, sort by names, and make those shorter or alphabetically smaller +ones appear before the others:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -S <span class="s1">'(<> $name &name)'</span> -l +</pre></div> +</div> +<p>This reads “If the tag name in the $-entry is smaller, it goes before the +&-entry”.</p> +<p>The <code class="docutils literal notranslate"><span class="pre"><or></span></code> operator is used to chain multiple expressions until one returns +-1 or 1. For example, sort by input file names, then line numbers if in the +same file:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -S <span class="s1">'(<or> (<> $input &input) (<> $line &line))'</span> -l +</pre></div> +</div> +<p>The <code class="docutils literal notranslate"><span class="pre">*-</span></code> operator is used to flip the compare result. i.e., <code class="docutils literal notranslate"><span class="pre">(*-</span> <span class="pre">(<></span> <span class="pre">a</span> <span class="pre">b))</span></code> +is the same as <code class="docutils literal notranslate"><span class="pre">(<></span> <span class="pre">b</span> <span class="pre">a)</span></code>.</p> +<p>Filter expressions can be used in sorter expressions. The technique is use +<code class="docutils literal notranslate"><span class="pre">if</span></code> to produce integers that can be compared based on the filter, like:</p> +<div class="highlight-lisp notranslate"><div class="highlight"><pre><span></span><span class="p">(</span><span class="nv"><></span> <span class="p">(</span><span class="k">if</span> <span class="nv">filter-expr-on-$-entry</span> <span class="mi">-1</span> <span class="mi">1</span><span class="p">)</span> + <span class="p">(</span><span class="k">if</span> <span class="nv">filter-expr-on-&-entry</span> <span class="mi">-1</span> <span class="mi">1</span><span class="p">))</span> +</pre></div> +</div> +<p>So if $-entry satisfies the filter, while &-entry doesn’t, it’s the same as +<code class="docutils literal notranslate"><span class="pre">(<></span> <span class="pre">-1</span> <span class="pre">1)</span></code>, which produces <code class="docutils literal notranslate"><span class="pre">-1</span></code>.</p> +<p>For example, we want to put tags with “file” kind below other tags, then the +sorter would look like:</p> +<div class="highlight-lisp notranslate"><div class="highlight"><pre><span></span><span class="p">(</span><span class="nv"><></span> <span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nv">eq?</span> <span class="nv">$kind</span> <span class="s">"file"</span><span class="p">)</span> <span class="mi">1</span> <span class="mi">-1</span><span class="p">)</span> + <span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nv">eq?</span> <span class="nv">&kind</span> <span class="s">"file"</span><span class="p">)</span> <span class="mi">1</span> <span class="mi">-1</span><span class="p">))</span> +</pre></div> +</div> +<p>A quick read tells us: If $-entry has “file” kind, and &-entry doesn’t, the +sorter becomes <code class="docutils literal notranslate"><span class="pre">(<></span> <span class="pre">1</span> <span class="pre">-1)</span></code>, which produces <code class="docutils literal notranslate"><span class="pre">1</span></code>, so the $-entry is put below +the &-entry, exactly what we want.</p> +</section> +<section id="inspecting-the-behavior-of-expressions"> +<h3>Inspecting the Behavior of Expressions<a class="headerlink" href="#inspecting-the-behavior-of-expressions" title="Permalink to this headline">¶</a></h3> +<p>The <cite>print</cite> operator can be used to print the value of an expression. For +example:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -Q <span class="s1">'(print $name)'</span> -l +</pre></div> +</div> +<p>prints the name of each tag entry before it. Since the return value of +<code class="docutils literal notranslate"><span class="pre">print</span></code> is not #f, all the tag entries are printed. We could control this +using the <code class="docutils literal notranslate"><span class="pre">begin</span></code> or <code class="docutils literal notranslate"><span class="pre">begin0</span></code> operator. <code class="docutils literal notranslate"><span class="pre">begin</span></code> returns the value of its +last argument, and <code class="docutils literal notranslate"><span class="pre">begin0</span></code> returns the value of its first argument. For +example:</p> +<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>readtags -Q <span class="s1">'(begin0 #f (print (prefix? "ctags" "ct")))'</span> -l +</pre></div> +</div> +<p>prints a bunch of “#t” (depending on how many lines are in the tags file), and +the actual tag entries are not printed.</p> +</section> +</section> +<section id="see-also"> +<h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2> +<p>See <a class="reference internal" href="tags.5.html#tags-5"><span class="std std-ref">tags(5)</span></a> for the details of tags file format.</p> +<p>See <a class="reference internal" href="ctags-client-tools.7.html#ctags-client-tools-7"><span class="std std-ref">ctags-client-tools(7)</span></a> for the tips writing a +tool utilizing tags file.</p> +<p>The official Universal Ctags web site at:</p> +<p><a class="reference external" href="https://ctags.io/">https://ctags.io/</a></p> +<p>The git repository for the library used in readtags command:</p> +<p><a class="reference external" href="https://github.com/universal-ctags/libreadtags">https://github.com/universal-ctags/libreadtags</a></p> +</section> +<section id="credits"> +<h2>CREDITS<a class="headerlink" href="#credits" title="Permalink to this headline">¶</a></h2> +<p>Universal Ctags project +<a class="reference external" href="https://ctags.io/">https://ctags.io/</a></p> +<p>Darren Hiebert <<a class="reference external" href="mailto:dhiebert%40users.sourceforge.net">dhiebert<span>@</span>users<span>.</span>sourceforge<span>.</span>net</a>> +<a class="reference external" href="http://DarrenHiebert.com/">http://DarrenHiebert.com/</a></p> +<p>The readtags command and libreadtags maintained at Universal Ctags +are derived from readtags.c and readtags.h developd at +<a class="reference external" href="http://ctags.sourceforge.net">http://ctags.sourceforge.net</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="#">readtags</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="#actions">ACTIONS</a></li> +<li><a class="reference internal" href="#options">OPTIONS</a><ul> +<li><a class="reference internal" href="#controlling-the-tags-reading-behavior">Controlling the Tags Reading Behavior</a></li> +<li><a class="reference internal" href="#controlling-the-name-action-behavior">Controlling the NAME Action Behavior</a></li> +<li><a class="reference internal" href="#controlling-the-output">Controlling the Output</a></li> +<li><a class="reference internal" href="#filtering-and-sorting">Filtering and Sorting</a></li> +<li><a class="reference internal" href="#examples">Examples</a></li> +</ul> +</li> +<li><a class="reference internal" href="#expression">EXPRESSION</a><ul> +<li><a class="reference internal" href="#filtering">Filtering</a></li> +<li><a class="reference internal" href="#sorting">Sorting</a></li> +<li><a class="reference internal" href="#inspecting-the-behavior-of-expressions">Inspecting the Behavior of Expressions</a></li> +</ul> +</li> +<li><a class="reference internal" href="#see-also">SEE ALSO</a></li> +<li><a class="reference internal" href="#credits">CREDITS</a></li> +</ul> +</li> +</ul> + + <h4>Previous topic</h4> + <p class="topless"><a href="ctags-incompatibilities.7.html" + title="previous chapter">ctags-incompatibilities</a></p> + <h4>Next topic</h4> + <p class="topless"><a href="../parsers.html" + title="next chapter">Parsers</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="../parsers.html" title="Parsers" + >next</a> |</li> + <li class="right" > + <a href="ctags-incompatibilities.7.html" title="ctags-incompatibilities" + >previous</a> |</li> + <li class="nav-item nav-item-0"><a href="../index.html">Universal Ctags 0.3.0 documentation</a> »</li> + <li class="nav-item nav-item-1"><a href="../man-pages.html" >Man pages</a> »</li> + <li class="nav-item nav-item-this"><a href="">readtags</a></li> + </ul> + </div> + <div class="footer" role="contentinfo"> + © 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>
\ No newline at end of file |