Function list support for C#

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

Function list support for C#

Postby sorens » Thu Aug 31, 2006 1:29 pm

Greetings,

Do you have to kick UE some how to tell it to parse a file so that functions show up in the Function list? I see some syntax highlighting but nothing in the Function list window. I am using C#.

Or perhaps is that feature disabled in the trial copy?

The wordfile for C# was created several years ago, is it perhaps out-of-date with current syntax?

I am using 12.10a. Also, I was able to make the java file i created work by right clicking in the Functions List window and disabling the "List for all Project Files" option. However, that did not fix C# files.

thanks,
User avatar
sorens
Newbie
 
Posts: 2
Joined: Wed Aug 30, 2006 11:00 pm

Re: Function list support for C#

Postby Mofi » Thu Aug 31, 2006 1:49 pm

V12.10a installs the default wordfile.txt in the program directory of UltraEdit and this wordfile already contains the syntax highlighting definitions for C#. This wordfile is used by default by UE.

So no need to download an out-of-date version created by an UltraEdit user in the past and add it to the wordfile. Remove the out-of-date version.

According to the line which starts with /L7"C#" CSHARP_LANG in default wordfile.txt this language definition is used for files with the extension .cs. Maybe your C# files do not have this extension. Change the extension associations in the wordfile accordingly or use View - View As (Highlighting File Type) - C# to use this language definition for the current file.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Function list support for C#

Postby sorens » Thu Aug 31, 2006 2:11 pm

All of the c# files are .cs extension and the 'view - view as' has C# correctly chosen and still no functions.

If I create 'test.cs' with the following, I see no function list:

Code: Select all
using System;

namespace test
{
   public class Test
   {
      public void Blah()
      {
      }

      public string Test()
      {
         return( "test" );
      }
   }
}
User avatar
sorens
Newbie
 
Posts: 2
Joined: Wed Aug 30, 2006 11:00 pm

Re: Function list support for C#

Postby Bego » Fri Sep 01, 2006 6:07 am

I can see both functions in the function list. UE12.10a. should be out of the box-config for C#.

Check your wordfile. Best, paste the WHOLE "L-section" with this definition and try again (I know, normally /Function String bla would be enough) :

Attention: In the delimiters list between , and . a tab character should be, not a sequence of spaces.

Code: Select all
/L6"C#" CSHARP_LANG Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = "' File Extensions = CS
/Delimiters = ~!@%^&*()-+=|\/(){}[]:;"'<> ,   .?
/Function String = "%[a-zA-Z_]*)[~;]"
/Indent Strings = "{"
/Unindent Strings = "}"
/C1"Keywords"
as auto
base break
case catch const continue
default do
else event explicit extern
false finally fixed for foreach
goto
if implicit in internal
lock
namespace null
operator out override
params private protected public
readonly ref return
sealed stackalloc static switch
this throw true try
unsafe using
virtual void
while
/C2"C# Data Types"
bool byte
char class
decimal delegate double
enum
float
int interface
long
object
sbyte short string struct
uint ulong ushort
/C3"C# Preprocessor Directives"
#elif #endif #endregion #else #error
#define
#if
#line
#region
#undef
#warning
/C4"Operators"
+
-
*
?
=
// /
%
&
>
<
^
!
|
:
checked
is
new
sizeof
typeof
unchecked


hih, Bego
User avatar
Bego
Master
Master
 
Posts: 357
Joined: Wed Nov 24, 2004 12:00 am
Location: Germany

Re: Function list support for C#

Postby xusooxusoo » Sat Sep 09, 2006 7:18 am

Guys,

As I've questioned several times, the following methods are not visible in the function list.

Code: Select all
    public String getName1(){
    }
    public byte[] getName2(){
    }
    String getName3(){
    }

I'm using the latest version trial software, but still looking forward to any comments on it.

XS
User avatar
xusooxusoo
Newbie
 
Posts: 5
Joined: Sat Oct 16, 2004 11:00 pm

Re: Function list support for C#

Postby Mofi » Sat Sep 09, 2006 11:04 am

xusooxusoo wrote:As I've questioned several times, the following methods are not visible in the function list.

Where? I merged your new thread to this thread because it looks very similar. But I can't help you. You don't have written for which language - C/C++, C#, Javascript, ...?

You also have not posted which function strings you currently use in your wordfile for that language. Which version of UltraEdit do you use and if other functions are displayed in the function list or not. If nothing is displayed, click with the right mouse button in the function list and unselect "List for all Project Files". Is the correct syntax highlighting language selected for your file - see View - View As (Highlighting File Type)?
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Function list support for PHP

Postby DigitalSorceress » Thu Sep 21, 2006 4:46 pm

I have a similar problem with PHP... from what I can tell, my functions that are declared without using an access descriptor (public, private, protected) seem to be seen just fine, but functions that start with one of those (inside classes of course) seem to not get picked up. I wouldn't have noticed it except I had one class file where I had been sloppy... one function was declared as public function foo() and another was declared as function bar() - bar() showed up but foo() did not.

I am sure that the key is to adjust the function list section of the php language definition, but so far I have not had much luck in fixing it.:

Code: Select all
/Function String = "%[^t ]++^{Public^}^{Private^} function[^t ]+^([a-z0-9_&]+[^t ]++[(][a-z0-9_$&,="^t ]++[)]^)[ ^t]++^{$^}^{{^}"
/Function String 1 = "%[^t ]++^{Public^}^{Private^} Static function[^t ]+^([a-z0-9_&]+[^t ]++[(][a-z0-9_$&,="^t ]++[)]^)[ ^t]++^{$^}^{{^}"
/Function String 2 = "%[^t ]++^{Protected^}^{Static^} function[^t ]+^([a-z0-9_&]+[^t ]++[(][a-z0-9_$&,="^t ]++[)]^)[ ^t]++^{$^}^{{^}"
/Function String 3 = "%[^t ]++^{Protected^}^{Static^} static function[^t ]+^([a-z0-9_&]+[^t ]++[(][a-z0-9_$&,="^t ]++[)]^)[ ^t]++^{$^}^{{^}"
/Function String 4 = "%[^t ]++function[^t ]+^([a-z0-9_&]+[^t ]++[(][a-z0-9_$&,="^t ]++[)]^)[ ^t]++^{$^}^{{^}"
/Function String 5 = "%[^t ]++function[^t ]+^([a-z0-9_&]+^)[^t ]++$"
/Function String 6 = "%[^t ]++function[^t ]+^([a-z0-9_&]+[^t ]++[(][a-z0-9_$&,="^t ]++^)$"

I tried such things as
Code: Select all
^{[Pp]rotected^}^{[Ss]tatic^} ....

thinking that it was because the regex was uppercase and I had declared with lower case, but this didn't work.
User avatar
DigitalSorceress
Basic User
Basic User
 
Posts: 21
Joined: Tue Sep 19, 2006 11:00 pm

Re: Function list support for PHP

Postby DigitalSorceress » Thu Sep 21, 2006 7:25 pm

I think I found a solution that works for me

I replaced all of those lines with:

Code: Select all
/Function String = "%[a-z^t ]++function[^t ]+^([a-z0-9_&]+[^t ]++[(][a-z0-9_$&,="'^t ]++[)]^)[ ^t]++^{$^}^{{^}"

This works for any combination of keywords (even ones that do not exist) or none at all in front of "function" but any non-alpha character will blow it up. If I want to comment out a function declaration, I just have to remember to put a // in front of the line or use the

Code: Select all
/*
 *
 *
 *
 */

method so it doesn't get sucked into the function list

it's a little ugly, but I discovered that UE regex syntax doesn't seem to like when you try and put

Code: Select all
[stuff]++

inside an

Code: Select all
^{this^}^{that^}
User avatar
DigitalSorceress
Basic User
Basic User
 
Posts: 21
Joined: Tue Sep 19, 2006 11:00 pm

Re: Function list support for PHP

Postby DigitalSorceress » Fri Sep 22, 2006 12:06 pm

I've refined my php5 function string definitions a bit. They now seem to work fine for all of the code in my projects.

So, feel free to use these function definitions for your PHP5 wordlist.

Code: Select all
/Function String 1 = "%[^t ]++function[^t ]+^([a-z0-9_&]+[^t ]++[(]*[)]^)"
/Function String 2 = "%[a-z]+[^t ]++function[^t ]+^([a-z0-9_&]+[^t ]++[(]*[)]^)"
User avatar
DigitalSorceress
Basic User
Basic User
 
Posts: 21
Joined: Tue Sep 19, 2006 11:00 pm

Re: Function list support for C#

Postby hardija » Mon Dec 04, 2006 10:51 pm

The standard C# Function definitions won't work because with proper indenting C# functions have white space before them.

This set of definitions is a good starting point. I am by no means a regular expression guru so I'm sure there's room for improvement!

/Function String = "%[ ^t]++^([publicrvatenod]+[ ^t]+[voidntlgushr]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 1 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[unsigedtac]+[ ^t]+[voidntlgushr]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 2 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 3 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[overid]+[ ^t]+[unsigedtac]+[ ^t]+[voidntlgushr]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 4 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[overid]+[ ^t]+[voidntlgushr]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 5 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[clasenumrt]+[ ^t]+[a-zA-Z0-9_]+^)"
User avatar
hardija
Newbie
 
Posts: 2
Joined: Mon Dec 04, 2006 12:00 am

Re: Function list support for C#

Postby fpdave » Thu Jan 11, 2007 6:16 pm

I think these work a little better:

/Function String = "%[ ^t]++^([publicrvatenod]+[ ^t]+[voidntlgushr]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 1 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[unsigedtac]+[ ^t]+[voidntlgushr]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 2 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[a-zA-Z0-9_]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 3 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[overid]+[ ^t]+[unsigedtac]+[ ^t]+[voidntlgushr]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 4 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[overid]+[ ^t]+[voidntlgushr]+[ ^t]+[a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 5 = "%[ ^t]++^([publicrvatenod]+[ ^t]+[clasenumrt]+[ ^t]+[a-zA-Z0-9_]+^)"
User avatar
fpdave
Newbie
 
Posts: 4
Joined: Sun Aug 21, 2005 11:00 pm

Re: Function list support for C#

Postby Arakrys » Tue May 22, 2007 1:18 pm

great, last list works for me, love you!

edit:
if you like the previous list but need a small list with function names but not the 'private' words in the list:

/Function String = "%[ ^t]++[publicrvatenod]+[ ^t]+[voidntlgushr]+[ ^t]+^([a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 1 = "%[ ^t]++[publicrvatenod]+[ ^t]+[unsigedtac]+[ ^t]+[voidntlgushr]+[ ^t]+^([a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 2 = "%[ ^t]++[publicrvatenod]+[ ^t]+[a-zA-Z0-9_]+[ ^t]+^([a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 3 = "%[ ^t]++[publicrvatenod]+[ ^t]+[overid]+[ ^t]+[unsigedtac]+[ ^t]+[voidntlgushr]+[ ^t]+^([a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 4 = "%[ ^t]++[publicrvatenod]+[ ^t]+[overid]+[ ^t]+[voidntlgushr]+[ ^t]+^([a-zA-Z0-9_]+(*)[~;~.]^)"
/Function String 5 = "%[ ^t]++[publicrvatenod]+[ ^t]+[clasenumrt]+[ ^t]+^([a-zA-Z0-9_]+^)"

I just moved the start of the selected part which is between ^( and ^).
User avatar
Arakrys
Newbie
 
Posts: 1
Joined: Sun Sep 12, 2004 11:00 pm


Return to Syntax Highlighting