Some code examples that ctags does not understand:

1. Very simple example

LivingThing = { 
        beBorn : function(){ 
          alert("Hi");
        } 
} 
LivingThing.beBorn();

ctags output:

!_TAG_FILE_FORMAT       2       /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED       1       /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR    Darren Hiebert  /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME      Exuberant Ctags //
!_TAG_PROGRAM_URL       http://ctags.sourceforge.net    /official site/
!_TAG_PROGRAM_VERSION   5.7     //

2. Simple class definition

function Animal(name) {
nam=name;
};
Animal.prototype= {
nam : "",
eat : function() {},
say : function(message) {alert(nam);},
};
var Cat = new Animal("Hi");
Cat.say();

ctags output:

Animal  /home/zaspire/Desktop/untitled folder/simple/1.js       /^Animal.prototype= {$/;"       c
Animal  /home/zaspire/Desktop/untitled folder/simple/1.js       /^function Animal(name) {$/;"   f

3. Simple class inheritance

function my() {}
my.prototype={
wow : function(message) {alert("WoW");},
}

function Animal(name) {
nam=name;
};
Animal.prototype= {
__proto__: my.prototype,
nam : "",
eat : function() {},
say : function(message) {alert(nam);},
};
var Cat = new Animal("Hi");
Cat.say();
Cat.wow();

ctags output:

Animal  /home/zaspire/Desktop/untitled folder/simple/2.js       /^Animal.prototype= {$/;"       c
Animal  /home/zaspire/Desktop/untitled folder/simple/2.js       /^function Animal(name) {$/;"   f
my      /home/zaspire/Desktop/untitled folder/simple/2.js       /^function my() {}$/;"  f
my      /home/zaspire/Desktop/untitled folder/simple/2.js       /^my.prototype={$/;"    c

4. More complicated definition of member

Function.prototype.method = function (name, func) {
    this.prototype[name] = func;
    return this;
};

function Parenizor(value) {
    this.setValue(value);
}

Parenizor.method('setValue', function (value) {
    this.value = value;
    return this;
});

Parenizor.method('getValue', function () {
    return this.value;
});

Parenizor.method('toString', function () {
    return '(' + this.getValue() + ')';
});

m= new Parenizor(0);
alert(m.toString());

ctags output:

Parenizor       /home/zaspire/Desktop/untitled folder/simple/4.js       /^function Parenizor(value) {$/;"       c

5. JS part of GnomeShell

Apps/Anjuta/JavaScript (last edited 2018-02-20 08:01:17 by SvitozarCherepii)