Function list problems with C++ files

Function list problems with C++ files

3
NewbieNewbie
3

    Jun 05, 2007#1

    I'm evaluating UltraEdit for as a C++ editor. The function list window lists a lot of items that aren't functions - every "if"

    262
    MasterMaster
    262

      Jun 06, 2007#2

      I'm not familiar with C++ but to help you getting an answer from the experts of this forum, please tell us:
      • Version of UE you are evaluating
      • Show us what's in the wordfile, in the C/C++ section. You'll probably find this in: C:\Program Files\IDM Computer Solutions\UltraEdit-32\wordfile.txt
      • And even: Show us an example of the code containing a few functions.
      Be sure to format the code lines as code block.

      In version 13.00a the function list definitions look like this:

      Code: Select all

      /L1"C/C++" C_LANG Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = "' File Extensions = C CPP CC CXX H HPP AWK
      /Delimiters = ~!@%^&*()-+=|\/{}[]:;"'<> , .?
      /Function String = "%^([a-zA-Z_0-9^[^]*]+^)[ ^t]+([^p*&:, ^t^[^]a-zA-Z_0-9.!]++)[~;]"
      /Function String 1 = "%[a-zA-Z_0-9*]*::^([a-zA-Z_0-9^~]+^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-zA-Z_0-9./(!]++)[~;]"
      /Function String 2 = "%[a-zA-Z_0-9][a-zA-Z_0-9^[^]]+[ ^t*]+^([a-zA-Z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./(!]++)[~;]"
      /Function String 3 = "%[a-zA-Z_0-9*&$^[^]*]+[ ^t]+[a-zA-Z_0-9*&$^[^]]+[ ^t*]+^([a-zA-Z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./(!]++)[~;]"
      /Function String 4 = "%[a-z_0-9^[^]*]++ [a-z_0-9*^[^]]+[ ^t]++[a-z_0-9*^[^]]+[ ^t]++^([*a-z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-z_0-9./(!]++)[~;]"
      /Function String 5 = "%^([a-zA-Z_0-9^[^]*]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./()!]++)[~;]"
      (Teaser to others reading this: UE 13.10, which is currently in beta test, will support Perl Regexp for function list definitions. And the C/C++ wordfile will have this "simple" ;-) definition:

      Code: Select all

      /L1"C/C++" C_LANG Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = "' File Extensions = C CPP CC CXX H HPP AWK
      /Delimiters = ~!@%^&*()-+=|\/{}[]:;"'<> , .?
      /Regexp Type = Perl
      /Function String = "^(?(?=[\w\[\]\:]+[ \t]+)([\w\[\]\*:]+)[ \t]+)(?(?=[\w\[\]\*:]+[ \t]+)([\w\[\]\*:]+)[ \t]+)(?(?=[\w\[\]\*:]+[ \t]+)([\w\[\]\*:]+)[ \t]+)(?(?=[\w\[\]\*:]+[ \t]+)([\w\[\]\*:]+)[ \t]+)([\w\[\]\*:]+)[ \t]*(\((?:[\s\*&:,\[\]\w/\\]|=(?!=))*\))[ \t\{\*&:,\[\]\w/\\]*$"

      3
      NewbieNewbie
      3

        Jun 06, 2007#3

        I'm using version 13.00a+2
        The word file is the same as posted above.

        Here's some sample code with comments as to what shows up in the function list:

        Code: Select all

        // UltraEdit function list test
        
        /**********************************************************************
        * main ()                                                             *
        ***********************************************************************/
        void main(void)
        
        {	
        	
        	if (option_values_2 [TEMP_FORCE_PR_EN] [Temp]==1) color = LIGHTGREY;
         else if (result_of_saf) color = YELLOW; //in function list as "f"
         else color=GREEN; 
        
        	
        }
        
         void function1 (void)  //in function list as "1"
        	{
        	int i;	
        		
        	}
        	
        
        void function2(void) //in function list as "function2"
         {
         int i;
         
        }
        
        /*
         void save_array(char * file_name)  //in function list as "y"
            {
            int i;
            }
        
         void read_array(char * file_name) //in function list as "y"
            {
            int i;
            }
        
          */
        The problem seems to have to do with spacing before function names and keywords. I'm trying to use it with a project that has about ten source files written by several people, so there's not a consistent style.

        John

        112
        Power UserPower User
        112

          Jun 06, 2007#4

          Yes John,

          One of your problems is exactly to do with the whitespace in your code. The default Function lists for C++ assume that everything starts in column 1.

          If you replace "% with "%[ ^t]++ at the start of the function strings - this should solve your main problem.

          HTH,
          Paolo
          There is no such thing as an inconsistently correct system...
          Therefore, aim for consistency; in the expectation of reaching correctness!

          3
          NewbieNewbie
          3

            Jun 06, 2007#5

            Got it. I copied a couple of the C/C++ wordfiles from the download section here and it's working much better. Still some comments showing up as functions, but I'll look into that some other time.

            Thanks.

            John