public_html/Tags/Tags.pm
Tags.pm - A basic perl class for creating tag files for various languages.
$Id: Tags.pm,v 1.2 1996/06/27 17:52:55 nthiery Exp nthiery $
use Tags;
$tagparser=new Tags ('perl',
{pattern=>q{^\s*sub\s+(?:\w+(?:\'|::))*(\w+)\s+},
help=>'subroutines'},
{pattern=>q{^[\$\@\%]{1}(\w+).*=},
option=>'variables',
help=>'global variables'});
$tagparser->parse(files=>["Tags.pm", "ptags"],vi=>'undef', emacs=>'TAGS');
$tagparser->parse_command_line(@ARGV);
This packages defines a class for tag parsers that will be able to
create tag files for various language. A tag parser is defined by a
set of patterns that will match interesting tags in a partiular
language. Some of these patterns can be optionnal.
-
new
-
($language:string, $pat1, $pat2,...)->Tags
Returns a tag parser for a particular language. $language is the name
of the language. $pati can be either a string containing a pattern, or
a reference to an hash. The hash can contain the following values:
-
'pattern'
-
The pattern used to find the tag. The name part of the tag must
be matched by the first parenthesis group. ($1).
-
'help'
-
A short message indicating what sort of tag is match by this pattern
-
'option'
-
If present, the pattern is optional, and will be used only if
the optionname is asked for.
-
'first'
-
If present, only the first match of a particular tag will be kept, and
the next one will be fully ignored (no warnings).
All the following are method defined for tag parsers..
-
parse
-
(files=>["file1","file2"],
vi=>'vi_tag_file', emacs=>undef,
include=>["tagfile1", "tagfile2"],
update=>undef,
add=>['variables']
)->()
Create tag file(s) for the indicated files.
-
'add'
-
(ref to an array of strings).
If present tels the parsers to also use the optionnal pattern named
by 'variables'
-
'vi'
-
(string)
If present, will create a tag file vi_tag_file for vi. If undefined,
defaults to tags.
-
'emacs'
-
(string)
Idem. defaults to TAGS.
-
'update'
-
If present, and only for vi-style file it will update the tagfile
instead of recreating it, ie will preserve tags that are not found.
-
'pat_limit'
-
(string)
what pattern delimiter will be used for patterns in vi-style tag
files.
-
'include'
-
(ref to an array of strings)
if present, and only for emacs-style file, it will include the
tag files tagfile1 and Tagfile2
-
'warn'
-
if present, some warnings will be issued if for example a tag is
duplicated.
.
-
parse_command_line
-
(@ARGV)->()
For a simple usage, a Tag parser can handle himself the parsing of the
command line (@ARGV). It will then also handles help, usage and
version messages. For the syntax of the command line, see the help
given by ... --help
-
help_patterns
-
()->string
Returns a pretty print of the tags the tag parser will search for.
.
None
the ptags manpage
and ptags --help
http://www.eleves.ens.fr:8080/home/nthiery/Tags/
the perl manpage
Copyright (c) 1996 Nicolas Thiery. All rights reserved. This
program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Nicolas Thiery
Nicolas.Thiery@ens.fr
http://www.eleves.ens.fr:8080/home/nthiery/