Function list support for C#

Function list support for C#

2
NewbieNewbie
2

    Aug 31, 2006#1

    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,

    6,682583
    Grand MasterGrand Master
    6,682583

      Aug 31, 2006#2

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

      2
      NewbieNewbie
      2

        Aug 31, 2006#3

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

        344
        MasterMaster
        344

          Sep 01, 2006#4

          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
          Normally using all newest english version incl. each hotfix. Win 10 64 bit

          5
          NewbieNewbie
          5

            Sep 09, 2006#5

            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

            6,682583
            Grand MasterGrand Master
            6,682583

              Sep 09, 2006#6

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

              323
              Basic UserBasic User
              323

                Re: Function list support for PHP

                Sep 21, 2006#7

                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.

                  Re: Function list support for PHP

                  Sep 22, 2006#8

                  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^}

                    Re: Function list support for PHP

                    Sep 22, 2006#9

                    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 ]++[(]*[)]^)"

                    2
                    NewbieNewbie
                    2

                      Dec 05, 2006#10

                      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_]+^)"

                      4
                      NewbieNewbie
                      4

                        Jan 11, 2007#11

                        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_]+^)"

                        1
                        NewbieNewbie
                        1

                          May 22, 2007#12

                          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 ^).