Subgroups in function list using Perl regular expressions

Subgroups in function list using Perl regular expressions

119
Power UserPower User
119

    Mar 03, 2010#1

    Has anyone managed to get subgroups working in the function list? For example, I added the following to my C wordfile:

    Code: Select all

    /TGBegin "Functions"
    /TGFindStr = "^(?:\w+[ \t]+)+(\w+)[ \t]*\((?s:.+)\)[ \t\n]+\{"
    /TGBegin "Arguments"
    /TGFindStr = "[ \t]*([^,]+)"
    /TGFindBStart = "("
    /TGFindBEnd = ")"
    /TGEnd
    /TGEnd
    The arguments don't appear in my function list even though the pattern works (via the Find dialog).

    6,681583
    Grand MasterGrand Master
    6,681583

      Mar 04, 2010#2

      Without testing your expressions you are obviously using Perl regular expressions, but in default c_cplusplus.uew the expressions are for the UltraEdit regular expression engine. Does your wordfile also contain /Regexp Type = Perl
      Best regards from an UC/UE/UES for Windows user from Austria

      119
      Power UserPower User
      119

        Mar 04, 2010#3

        Mofi wrote:Does your wordfile also contain /Regexp Type = Perl
        Yes. The problem is nothing quite so obvious, I'm afraid. Groups work great, it's only subgroups that I'm having trouble with.

        6,681583
        Grand MasterGrand Master
        6,681583

          Mar 04, 2010#4

          The open and close tags are also regular expression strings. So it is needed to define the open and close tags with \( and \). I tried that with your expressions, but it completely failed on my C file.

          Well, your function regular expression string ^(?:\w+[ \t]+)+(\w+)[ \t]*\((?s:.+)\)[ \t\n]+\{ fails on my C file which is an ASCII DOS file. All my functions have a line comment after closing ) which shortly describes what the function is for, or a block comment starts on the same line as the function definition if the short description is a little bit longer or the function has more parameters. The first 4 characters of the comment are constant and exist only on the function definition lines which is the reason why I can use a very simple single UltraEdit regular expression string to find function names. I more or less just search for lines with those 4 characters. My C file (for C166 controller) starts with

          Code: Select all

          static BITS mb_Sendnow  _atbit(mg_Faultbits,0);  //MVD: TRUE wenn gerade eine Uebertragung laueft
          // and some other static bits and values.
          
          _inline void il_startaborttime (void)   //UPH: startet das Abbruchtimeout laut Parametrierung
          {
             mg_Faulttimer = mg_Aborttime;
             mb_Waitnow = TRUE;
          }
          Your Perl function string executed with the Find dialog selected everything from the static bit definition down to line 1461 (75 KB). That might be different for your C/C++ files, but this expression for the function strings is definitely not useful for my C file and therefore I can't really look deeper into the problem with the arguments.

          4
          NewbieNewbie
          4

            Mar 04, 2010#5

            Since I started playing with the new function list, I also encountered problems with the Perl regular expression engine and the subgroups. I have found that only the top level groups respect the /Regexp Type = Perl setting, whereas the subgroups require the use of the UltraEdit regular expression style, regardless of the /Regexp setting.

            So, if you want to have your subgroups working now, you need to rewrite those regexes into the UltraEdit style. Ben from IDM support replied to my e-mail telling that "Perl regular expressions are not yet supported for the hierarchical function list. Only top-level functions are supported with Perl. This will be available in a future release."

            8
            NewbieNewbie
            8

              Dec 10, 2010#6

              I tried to look in the change log to see if this has been corrected but did not find anything that seemed to indicate if it was or not. So, question: it is still the case that these must be in UltraEdit syntax? Or can they be specified in the format directed by "Regexp Type"?

              6,681583
              Grand MasterGrand Master
              6,681583

                Dec 11, 2010#7

                After a test I can only write here that it is still not possible to use Perl regular expressions for a grouped function list with UE v16.30.0.1001. I reported this issue last month and received the reply that IDM is aware of this issue. Perhaps more users should report this issue to increase the priority for fixing it.

                Update: Perl regular expressions can be used for all regular expression strings in a syntax highlighting wordfile for function string searches since UltraEdit v19.10 and UEStudio v13.10.
                Best regards from an UC/UE/UES for Windows user from Austria