Zeus IDE Forum Index Zeus IDE
Use this forum to ask for help, submit a bug report or make a suggestion.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adding a new Ctags Language Definition

 
Post new topic   Reply to topic    Zeus IDE Forum Index -> Tutorials, Tips and Tricks
View previous topic :: View next topic  
Author Message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2205

PostPosted: Wed Apr 07, 2010 3:26 am    Post subject: Adding a new Ctags Language Definition Reply with quote

Zeus integrates with Exuberant Ctags which supports about 40 programming languages.

But even if your language is not on the list of supported langauges, it is very easy to add new language using a ctags configuration file.

For example consider the following ctags configuration file:
Code:
--langdef=Clipper
--langmap=Clipper:.prg
--regex-clipper=/^FUNCTION[ \t]*([a-zA-Z0-9_]+)/\1/f,function/
--regex-clipper=/^PROCEDURE[ \t]*([a-zA-Z0-9_]+)/\1/p,procedure/

This file defines a new language definition for the Clipper language and maps the prg file extension to this map.

The two regular expressions define the function and procedure ctags items.

To make ctags use this configuration file just do the following:
  1. Save the configuration details above to the .ctags file.
  2. If the HOMEDRIVE and HOMEPATH environment variables defined copy the .ctags file to this location.
  3. Otherwise put the file in the Zeus install folder: c:\program files\zeus\.ctags
  4. Set the HOMEDRIVE environment variable to be c:
  5. Set the HOMEPATH environment variable to be \program files\zeus\
Now when you add prg files to a zeus workspace these files will get tagged and the tags found will get displayed in the Classes tab of the Navigator Panel.

Cheers Jussi


Last edited by jussij on Tue Sep 20, 2011 1:00 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
wolivo



Joined: 16 Feb 2005
Posts: 6

PostPosted: Mon May 03, 2010 7:35 pm    Post subject: Reply with quote

since i don't find a .ctags file anywhere on my hard drive, in this example would the .ctags file consist of only these 4 lines of code?
Back to top
View user's profile Send private message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2205

PostPosted: Tue May 04, 2010 12:53 am    Post subject: Reply with quote

Quote:
since i don't find a .ctags file anywhere on my hard drive, in this example would the .ctags file consist of only these 4 lines of code?

That is correct. I am no expert in .ctags but I think the way it works is the 'Clipper' word ties these four lines together to define a language.

This allows the file to contain multiple language definitions.

Below is a list of how the ctags words are mapped to the Zeus types:

Code:
class     Tag_Class
function  Tag_Function
method    Tag_Method
macro     Tag_Macro
procedure Tag_Procedure
variable  Tag_Variable

You can also change the names of the labels displayed in the Classes panel by using the Labels panel found in the Workspace, Options menu.

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2205

PostPosted: Sun Sep 23, 2012 1:33 am    Post subject: Reply with quote

Here is a VB.Net ctags configuration:
Code:
--langdef=vb
--langmap=vb:.vb
--regex-vb=/^[ \t]*(Public|Private)[ \t]+Sub[ \t]+([a-zA-Z0-9_]+)/\2/s,subroutine/i
--regex-vb=/^[ \t]*(Public|Private)[ \t]+Function[ \t]+([a-zA-Z0-9_]+)/\2/f,function/i
--regex-vb=/^[ \t]*(Public|Private)[ \t]+([a-zA-Z0-9_]+)[ \t]+As[ \t]+/\2/v,variable/i
--regex-vb=/^[ \t]*(Public|Private)[ \t]+Const[ \t]+([a-zA-Z0-9_]+)[ \t]+(As|=)[ \t]+/\2/c,const/i
--regex-vb=/^[ \t]*(Public|Private)[ \t]+Enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enum/i
--regex-vb=/^[ \t]*(Public)[ \t]+Property[ \t]+(Get|Let|Set)[ \t]+([a-zA-Z0-9_]+)/\3/n,name/i
--regex-vb=/^[ \t]*([a-zA-Z_]+):/\1/l,label/i

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Zeus IDE Forum Index -> Tutorials, Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group