Function list problems with C++ files

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

Function list problems with C++ files

Postby apostrophe » Tue Jun 05, 2007 6:23 pm

I'm evaluating UltraEdit for as a C++ editor. The function list window lists a lot of items that aren't functions - every "if"
User avatar
apostrophe
Newbie
 
Posts: 3
Joined: Mon Jun 04, 2007 11:00 pm

Re: Function list problems with C++ files

Postby jorrasdk » Tue Jun 05, 2007 8:44 pm

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 embed code in the bbcode tags: [code][/code]

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 are currently in beta test, will support Perl Regexp for function list definitions. And the C/C++ 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/\\]*$"
User avatar
jorrasdk
Master
Master
 
Posts: 275
Joined: Mon Mar 19, 2007 11:00 pm
Location: Denmark

Re: Function list problems with C++ files

Postby apostrophe » Wed Jun 06, 2007 12:46 pm

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
User avatar
apostrophe
Newbie
 
Posts: 3
Joined: Mon Jun 04, 2007 11:00 pm

Re: Function list problems with C++ files

Postby PaoloFCantoni » Wed Jun 06, 2007 1:56 pm

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
User avatar
PaoloFCantoni
Power User
Power User
 
Posts: 113
Joined: Sun May 01, 2005 11:00 pm
Location: Perth, Western Australia

Re: Function list problems with C++ files

Postby apostrophe » Wed Jun 06, 2007 4:30 pm

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
User avatar
apostrophe
Newbie
 
Posts: 3
Joined: Mon Jun 04, 2007 11:00 pm


Return to Syntax Highlighting