On 2006-09-24, at 15:58, Khubaib wrote:
> In my dept, ctags is already installed (I am not
> sure whether it is Exuberant ctags or not).
it isn't. use "--help" or "--version" to confirm, but the error you
give is not in the source to Exuberant ctags. your command-line was
correct, though, so once you have the right ctags installed, you
should be good to go.
--elliott

Hello,=0AI wanted to know how can I efficiently browse java source=0Acode=
=0Ain VIM using ctags? In my dept, ctags is already installed (I am not=0As=
ure whether it is Exuberant ctags or not). I tried using ctags, but=0Acould=
not use it to=0Aproduce tags for java source. The code is distributed acro=
ss multiple=0Asource=0Adirectories in a hierarchy. Can somebody please give=
me commands for=0Ausing ctags when java code is distributed across directo=
ries? I issued=0Acommand like this:=0Actags -f ~/.tags -R /home/user/src/=
=0Ait gives me error: "skipping /home/user/src/: it is not a regular file"=
=0A/src/ dir has no java source file in it, but has more directories in it,=
which contain java source files. any hints?=0A-Khubaib=0A=0A=0A=0A

On 2006-09-18, at 09:33, Elliott Hughes wrote:
> a related problem for Java is not having access to all the modifiers.
> so if you want to know all the "abstract" methods, say, you're out of
> luck.
actually, in the specific case of "abstract", ctags already lets you
use "--fields=+m" and then look for "implementation:abstract".
--elliott

On Mon, September 18, 2006 11:34, Jean-Luc Biord wrote:
> For the member integer2, "int" never appear on his corresponding line
> and it's impossible to know the type.
correct.
> Really no solution to this problem?
ectags could be extend to collect and record this information, but doesn't
at present.
--
Elliott Hughes, http://www.jessies.org/~enh/

On 2006-09-18, at 09:10, Jean-Luc Biord wrote:
>> warning: "A qide_2.h /^class A$/;" kind:c line:1 language:C++ "
>> warning: "another qide_2.h /^ \/ int another;$/;" kind:m line:5
>> language:C++ class:A access:private "
>> warning: "integer qide_2.h /^ int integer;$/;" kind:m line:4
>> language:C++ class:A access:private "
>
> If I want to retrieve the type of integer or another, the unique
> field with the type (int) is the field named ex_cmd by the ctags
> documentation. But it's not reliable because for the second int,
> "another", the field starts with "/*Another integer*\" and it's not
> the type.
>
> My question : I want a reliable method to retrieve the type in
> lines of tags.
as far as i know, there is none at the moment. in http://
software.jessies.org/Evergreen/ we'd like to show the type but
actually just offer the full text of the line of definition as the
tool tip. as you say, though, that's not reliable, and fails for
something like:
int
main(int, char* args[]) {
speaking of member functions/methods, the other side to this is the
difficulty of distinguishing overloads from the list of tags. again,
our work-around is okay, but falls flat in rare cases of overloading-
heavy code, like the large number of "print" and "println" methods in
java.io.PrintStream, which all look the same until you examine their
tool tips.
a related problem for Java is not having access to all the modifiers.
so if you want to know all the "abstract" methods, say, you're out of
luck.
--elliott

> -----Original Message-----
> From: ctags-users-bounces@...
> [mailto:ctags-users-bounces@...] On Behalf
> Of Jean-Luc Biord
> Sent: Friday, September 15, 2006 10:18 AM
> To: ctags-users@...
> Subject: [Ctags] Specific
>
> I use in my programs Qt. With Qt, certain classes are like this:
>
> class Foo
> {
> public slots:
> void mySlot1();
> private slots:
> protected slots:
> signals:
> void mySignal( int );
> };
>
> Who to have the tags lines with slots and signals in addition
> of private or protected ?
I gather there is no specific QT ctags component. Looking at the source
files I don't see one.
So you have some options.
1. You can create your own and submit it.
2. You can locally extend your ctags languages via the ctags.cnf file using
regex.
3. You can combine them both, create a very simple qt.c which creates it's
tags using regex (this is very, very simple).
Let's took at 2 and I will show you what I have done with some other
languages.
I run on windows, so I created the file c:\ctags.cnf (otherwise this would
be in your $HOME directory).
--langdef=ant
--langmap=ant:.xml
--regex-ant=/^[ \t]*<[ \t]*project.*name="([^"]+)".*>/\1/p,project/i
--regex-ant=/^[ \t]*<[ \t]*target.*name="([^"]+)".*>/\1/t,target/i
This defines a new language "ant".
Indicates these files end in .xml.
There are two tags, <project> and <target>.
--regex-ant=/^[ \t]*<[ \t]*project.*name="([^"]+)".*>/\1/p,project/I
^[ \t]*<[ \t]*project.*name="([^"]+)".*
Description:
^[ \t]*
- From the beginning of the line ignoring leading spaces or blanks.
<[ \t]*project.*
- Beginning with a < followed by optional whitespace find the work "project"
and ignore anything following it.
name="([^"]+)"
- Find "name=" followed by a double quote(").
- ( denotes the beginning of the tag (via back references)
[^"]+
- Grab everything that is NOT a double quote
)"
- ) denotes the end of the tag name
- Followed by an ending double quote
.*
- Ignore the rest until the end of the line.
/\1/p,project/I
\1
- Use the name found in between the ().
- Create a new tag under the project heading.
- I, ignore case.
So it is quite easy to extend ctags per languages and regular expressions.
When you create a new qt.c, you can use the jscript.c (5.6) as an example,
it has one line per regex:
addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[
\t]*\\(",
"\\1", "f,function,functions", NULL);
Besides escaping the \'s, it is essentially what you put in your ctags.cnf
file.
If you need to get fancier (in other words, cannot do this via regex) then
you must write a parser for your language. Writing a parser as a number of
advantages:
- Once pass through the file will produce ALL tags
- Can handle anything you need to do, many things cannot be done via simple
regular expressions
- Much faster than regex
Disadvantages
- More difficult to write
- Better understanding of the language is usually required
>From the writing standpoint, generally you will be simple copying an
modifying an existing module. Asking which one to start with will often get
you there much faster.
HTH,
Dave

I use in my programs Qt. With Qt, certain classes are like this:
class Foo
{
public slots:
void mySlot1();
private slots:
protected slots:
signals:
void mySignal( int );
};
Who to have the tags lines with slots and signals in addition of private
or protected ?
Thanks

> -----Original Message-----
> From: ctags-users-bounces@...
> [mailto:ctags-users-bounces@...] On Behalf
> Of Elliott Hughes
> Sent: Saturday, September 09, 2006 1:07 PM
> To: David Fishburn
> Cc: Ctags Users
> Subject: Re: [Ctags] I - inner
>
> On 2006-09-09, at 06:02, David Fishburn wrote:
> > I am trying to extend the javascript component but have run into
> > something I don't understand.
>
> anyway, isn't this the wrong list for this nowadays?
Yes, quite correct, but I had only seen 3 people post to the ctags-dev page
so far. Thought I would have a larger audience here.
Anyway, I can move the discussion to the dev list.
Dave

On 2006-09-09, at 06:02, David Fishburn wrote:
> I am trying to extend the javascript component but have run into
> something I
> don't understand.
anyway, isn't this the wrong list for this nowadays?
--elliott

On 2006-09-09, at 06:02, David Fishburn wrote:
> I am trying to extend the javascript component but have run into
> something I
> don't understand.
>
> ctags --list-kinds
>
> JavaScript
> f functions
> I inner
for 5.6:
JavaScript
f functions
> This must be some built-in piece of ctags.
there's no reference to "inner" in any of the files in my unpacked
tarball of 5.6.
what version of the source do you have? what changes have you made?
what does grep -i "inner" say?
--elliott

I am trying to extend the javascript component but have run into something I
don't understand.
ctags --list-kinds
JavaScript
f functions
I inner
Yet when I look at the jscript.c source code I do not see anywhere that will
actually create I, inner tags.
The jscript.c is a simple regex engine and has only 2 methods.
static void installJavaScriptRegex (const langType language)
{
addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(",
"\\1", "f,function,functions", NULL);
}
So where are these I-inner tags coming from?
I have turning this component into a parser instead of using regex to find
the tags. When I run my modified ctags I see:
validFunctionOne c:\OpenSrc\ctags\js\test.js /^validFunctionOne =
function(a,b) {}$/;" I line:3
validFunctionOne c:\OpenSrc\ctags\js\test.js /^validFunctionOne =
function(a,b) {}$/;" f line:3
validFunctionTwo c:\OpenSrc\ctags\js\test.js /^function
validFunctionTwo(a,b) {}$/;" f line:5
You can see here, somehow another I (inner) tag was found. Yet my code does
not make any of these.
This must be some built-in piece of ctags.
Does anyone know how I can turn this off?
Thanks,
Dave

> -----Original Message-----
> From: ctags-users-bounces@...
> [mailto:ctags-users-bounces@...] On Behalf
> Of Tim Stebbing
> Sent: Wednesday, September 06, 2006 9:55 PM
> To: ctags-users@...
> Subject: [Ctags] Javascript support for psudo modules, classes etc..
>
> G'day, I've recently started doing some js hacking again, and
> was disappointed that the javascript support in ctags does
> not seem to handle the more prevalent (these days) style of
> function definition.
>
> It is common in modern js libraries to see this form of pseudo-module:
>
> mylib = {}
> mylib.widgets = {}
>
> mylib.widgets.CoolThing = function() {}
> mylib.widgets.CoolThing.prototype = {
> 'doThing' : function() {},
> 'doSomethingDifferent' : function() {} }
>
>
> however it seems the javascript support in ctags currently
> only supports the older style of:
>
> function foo() {}
>
> Ideally the above example would result in ctags determining that:
>
> 1) my.lib.widgets.CoolThing was a class, because either a)
> references 'this' or b) has a prototype extension.
Where did 'this' come from in your example?
Can you provide a complete one, so we have examples of both a) and b).
>
> 2) foo.bar = function() {} is a function
>
> 3) 'foo' : function(){} is a method
>
> etc..
Are you saying 2) is also not supported, but it does mean a valid function
in JS?
What is the function called? Is it 'foo', or 'bar'? Is it 'foo' and 'bar'
is a method?
Where 3) is definitely not a function?
If you can clear some of these up maybe with a proper JS sample which
outlines all the various proper ways to define a function, that would
certainly help any developer looking into this.
Maybe even something with names, ValidFunction meaning ctags should have
found it, InvalidFunction means it was a red herring.
mylib.widgets.ValidFunction1 = function() {}
'InvalidFunction2' : function(){}
I just was updating sql.c and had a quick look at 5.5.4 jscript.c.
It is a simple regex, not a parser.
addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(",
"\\1", "f,function,functions", NULL);
This could be extended fairly easily (not tested):
// function foo() {}
addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(",
"\\1", "f,function,functions", NULL);
// foo = function() {}
addTagRegex (language, "([A-Za-z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(",
"\\1", "f,function,functions", NULL);
// mylib.widgets.CoolThing.prototype = {
addTagRegex (language, "([A-Za-z0-9_]+)\.prototype",
"\\1", "f,function,functions", NULL);
If these are adequate, they would be very easy for me to make.
If you create a simple JS file with a sample clearing indicating what should
be picked up, and what shouldn't be, I am sure this could be updated fairly
easily. If your sample if nice and complete, a person unfamiliar with the
language would be able to make the changes.
Dave

G'day, I've recently started doing some js hacking again, and was
disappointed that the javascript support in ctags does not seem to
handle the more prevalent (these days) style of function definition.
It is common in modern js libraries to see this form of pseudo-module:
mylib = {}
mylib.widgets = {}
mylib.widgets.CoolThing = function() {}
mylib.widgets.CoolThing.prototype = {
'doThing' : function() {},
'doSomethingDifferent' : function() {}
}
however it seems the javascript support in ctags currently only
supports the older style of:
function foo() {}
Ideally the above example would result in ctags determining that:
1) my.lib.widgets.CoolThing was a class, because either a) references
'this' or b) has a prototype extension.
2) foo.bar = function() {} is a function
3) 'foo' : function(){} is a method
etc..
I'm not sure who maintains the javascript parser but these additions
would greatly help myself and a whole swathe of developers.
Cheers,
-tjs
--
Timothy J Stebbing