Debian Codegraph @

README

raw
1 NAME
2 Parse::ExuberantCTags - Efficiently parse exuberant ctags files
3
4 SYNOPSIS
5 use Parse::ExuberantCTags;
6 my $parser = Parse::ExuberantCTags->new( 'tags_filename' );
7
8 # find a given tag that starts with 'foo' and do not ignore case
9 my $tag = $parser->findTag("foo", ignore_case => 0, partial => 1);
10 if (defined $tag) {
11 print $tag->{name}, "\n";
12 }
13 $tag = $parser->findNextTag();
14 # ...
15
16 # iterator interface (use findTag instead, it does a binary search)
17 $tag = $parser->firstTag;
18 while (defined($tag = $parser->nextTag)) {
19 # use the tag structure
20 }
21
22 DESCRIPTION
23 This Perl module parses *ctags* files and handles both traditional ctags
24 as well as extended ctags files such as produced with *Exuberant ctags*.
25 To the best of my knowledge, it does not handle emacs-style "*etags*"
26 files.
27
28 The module is implemented as a wrapper around the readtags library that
29 normally ships with *Exuberant ctags*. If you do not know what that is,
30 you are encouraged to have a look at <http://ctags.sourceforge.net/>. In
31 order to use this module, you do not need *Exuberant ctags* on your
32 system. The module ships a copy of readtags. Quoting the readtags
33 documentation:
34
35 The functions defined in this interface are intended to provide tag file
36 support to a software tool. The tag lookups provided are sufficiently fast
37 enough to permit opening a sorted tag file, searching for a matching tag,
38 then closing the tag file each time a tag is looked up (search times are
39 on the order of hundreths of a second, even for huge tag files). This is
40 the recommended use of this library for most tool applications. Adhering
41 to this approach permits a user to regenerate a tag file at will without
42 the tool needing to detect and resynchronize with changes to the tag file.
43 Even for an unsorted 24MB tag file, tag searches take about one second.
44
45 Take away from this that tag files should be sorted by the generating
46 program.
47
48 TAG FORMAT
49 The methods that return a tag entry all return tags in the same format.
50 Examples count for a billion words:
51
52 {
53 name => 'IO::File',
54 file => '/usr/lib/perl/5.10/IO/File.pm',
55 fileScope => 0,
56 kind => 'p',
57 addressPattern => '/package IO::File;/',
58 addressLineNumber => 3,
59 extension => {
60 class => 'IO::File',
61 },
62 }
63
64 The structure has the name of the tag ("name"), the file it was found in
65 ("file"), a flag indicating whether the tag is scoped to the file only,
66 the type of the tag entry ("kind"), the "ex" search pattern for locating
67 the definition ("addressPattern"), the line number
68 ("addressLineNumber"), and then key/value pairs from the extension
69 section of the tag.
70
71 Not all of the fields are guaranteed to be available. Particularly the
72 "extension" section will be empty if the tags file doesn't make use of
73 the extended format. Refer to the ctags reference for details.
74
75 METHODS
76 new
77 Given the name of a file to read the tags from, opens that file and
78 returns a "Parse::ExuberantCTags" object on success, false otherwise.
79
80 findTag
81 Takes the name of the tag to be sought as first argument.
82
83 Following the tag name, two optional arguments (key/value pairs) are
84 supported:
85
86 Setting "<partial =" 1>> makes the tag name match if it's the start of a
87 tag. Setting "<ignore_case =" 1>> makes the search ignore the case of
88 the tag. Note that setting "<ignore_case"> to true results in a slower
89 linear instead of a binary search!
90
91 Returns a tag structure or undef if none matched.
92
93 findNextTag
94 Returns the next tag that matches the previous search (see "findTag").
95
96 Returns undef if no more tags match.
97
98 firstTag
99 Returns the first tag in the file. Returns undef if the file is emtpy.
100
101 nextTag
102 Returns the next tag or undef if the end of the file is reached.
103
104 CAVEATS
105 The SetSortType call is currently not supported. Let me know if you need
106 it and I'll add a wrapper.
107
108 SEE ALSO
109 Exuberant ctags homepage: <http://ctags.sourceforge.net/>
110
111 Wikipedia on ctags: <http://en.wikipedia.org/wiki/Ctags>
112
113 Module that can produce ctags files from Perl code: Perl::Tags
114
115 File::PackageIndexer
116
117 AUTHOR
118 Steffen Mueller, <[email protected]>
119
120 COPYRIGHT AND LICENSE
121 This Perl module is a wrapper around the readtags library that is
122 shipped as part of the exuberant ctags program. A copy of readtags is
123 included with this module. readtags was put in the public domain by its
124 author. The full copyright/license information from the code is:
125
126 Copyright (c) 1996-2003, Darren Hiebert
127 This source code is released into the public domain.
128
129 The XS wrapper and this document are:
130
131 Copyright (C) 2009 by Steffen Mueller
132
133 This library is free software; you can redistribute it and/or modify it
134 under the same terms as Perl itself, either Perl version 5.6 or, at your
135 option, any later version of Perl 5 you may have available.
136