Function List problem with special script language

Function List problem with special script language

2
NewbieNewbie
2

    Jul 27, 2006#1

    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?

    6,678585
    Grand MasterGrand Master
    6,678585

      Jul 27, 2006#2

      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.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Jul 27, 2006#3

        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 ;)