nice, this works great. thank you very much!!

On 11/30/05, Charilaos Skiadas <cskiadas@uchicago.edu> wrote:
On Nov 30, 2005, at 3:54 PM, Jamal Johnson wrote:


> i've taken a look and to be honest i'm terrible with regexp's and
> could use some help. i'm trying to define a way to see objects in a
> certain format in my JS files:
>
> var CustomObject = Class.create();
> CustomObject.prototype = Object.extend( (new ViewObject()), {
>     member1 : true,
>     member2 : "someString",
>     member3 : "anotherString",
>
>     someFunction : function(){
>         //doSomething
>     },
>
>    someOtherFunction : function(){
>
>    }
> };
>
> so then in the tmCodeBrowser i'd see something like:
>    Objects
>       - CustomObject
>          - member1
>          - member2
>          - member3
>          - someFunction
>          - someOtherFunction etc....
>
> something along those lines anyway. can one of you point me in a
> starting direction for howto setup the .ctags.tmcodebrowser file to
> do this for javascript files?
>

Try adding this to .ctags.tmcodebrowser

--langdef=javascript
--langmap=javascript:.js
--regex-javascript=/^(.*).prototype *= *(.*)/-\1/o,object/
--regex-javascript=/^[ \t]*(.*) *: (([^f]*)|(f[^u]*)|(fu[^n]*))[\t]*
$/---var: \1/o,object/
--regex-javascript=/^[ \t]*(.*) *: *function/---fun: \1/o,object/

This might do something close to what you want. Just make sure to not
ask TmCodeBrowser to sort things. With the simple regexp additions,
you cannot recognize things in multiple lines, so there is no way of
grouping the variable and function definitions with a particular
object, this way at least visually they will be close to what you want.

I believe that if one really wants to, one can write a parser and add
it to the ctags source code and recompile, that is provided that Gerd
Knops provides you the source code, or is willing to add the parser
ofr you. I am guessing someone out there has already written a parser
for javascript that maybe does what you want it to better, but I
wouldn't know anything about it.

I was under the impression that tmcodebrowser supported actionscript,
which might be close to what you want, but I couldn't find it in
the .ctags.tmcodebrowser format.

Haris