Function List problem with special script language

Syntax highlighting, code folding, brace matching, code indenting, and function list

Function List problem with special script language

Postby GeckoGore » Thu Jul 27, 2006 9:07 am

Hi, im trying to get function list working for a script language im working in.
The problem is that functions are not declared with "function" or "proc" or anything, so i cant differantiate them from for() if() and while() statements:

Code: Select all
get_hash_id() {
   if ( Global.go ) {
      return Network.blablabla;
   } else {
      return void;
   }
}

kill( reason, listx ) {
   for ( unit in listx ) {
          unit.hp := 0;
   }
}

Im now using:
/Function String = "%[ ^t]++^([a-zA-Z_]+^)([a-zA-Z0-9_, ]++)[ ^t]++{"

But IF, FOR and WHILE loops are also added with this. Is there someway I can get it to ignore those words?
User avatar
GeckoGore
Newbie
 
Posts: 2
Joined: Wed Jul 26, 2006 11:00 pm

Re: Function List problem with special script language

Postby Mofi » Thu Jul 27, 2006 9:40 am

Similar problem as at Function List for cobol paragraph. There is no possibility to search for a string which contains "..." but does not contain the strings "???, xxx, yyy".

Your workaround with a space between OF, FOR and WHILE and the following round bracket and no space between function name and the following round bracket is one solution.

Another one would be to allow function names only a start of a line with no preceding spaces.

Or use an identifier line comment at the line where the function starts.

Or you use only function names which start not with an i or f or w.

Well, all those workarounds are not very pretty. But I think, there is no better solution.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Function List problem with special script language

Postby GeckoGore » Thu Jul 27, 2006 10:15 am

Ok, thanks alot mofi!

I've actually thought of all of those ways you name... but the problem is that the code base in the project i'm working in is about 100k lines already. And it would be hard to alter...( not sure i wanna do that)
So i guess i'll go for one of the workarounds... better than nothing ;)
User avatar
GeckoGore
Newbie
 
Posts: 2
Joined: Wed Jul 26, 2006 11:00 pm


Return to Syntax Highlighting