Tapatalk

Parameters of a Clipper Function/Procedure in Subgroup in Function List

Parameters of a Clipper Function/Procedure in Subgroup in Function List

4
NewbieNewbie
4

    Mar 11, 2010#1

    Hi to all. Probably the problem I writing next is because I don't know enough about Regular Expressions but I guess these are basics proofs and didn't work either.

    I want the Function List show me the list of parameters of a Procedure in Clipper...
    Then the wordfile by default shows the functions:

    Code: Select all

    /TGBegin "Functions"
    /TGFindStr = "%[STATIC ]++^{FUNCTION^}^{PROCEDURE^}"
    /TGEnd
    I try list the parameters this way:

    Code: Select all

    /TGBegin "Functions"
    /TGFindStr = "%[STATIC ]++^{FUNCTION^}^{PROCEDURE^}"
    /TGBegin "Parameters"
    /TGFindStr = "PARAMETERS*"
    /TGEnd
    /TGEnd
    And it didn't show any subgroup... then I try it in a Group and it works but it obviously show the parameters of all functions together:

    Code: Select all

    /TGBegin "Functions"
    /TGFindStr = "%[STATIC ]++^{FUNCTION^}^{PROCEDURE^}"
    /TGEnd
    /TGBegin "Parameters"
    /TGFindStr = "PARAMETERS*"
    /TGEnd
    What I'm doing wrong?

    P.S.: Sorry for my ugly english

    6,685587
    Grand MasterGrand Master
    6,685587

      Mar 11, 2010#2

      Your English is okay. I first explain what %[STATIC ]++^{FUNCTION^}^{PROCEDURE^} means.

      % start of line, good.

      [STATIC ]++ should be for optional word STATIC, but the expression means 0 or more occurrences of the characters S, T, A, T (once again, not needed), I, C and space. That is not really wrong, but just [ AICST]++ or propably just a * would work too.

      ^{FUNCTION^}^{PROCEDURE^} is clear. After optional word STATIC the word FUNCTION or PROCEDURE must follow.

      Without any further expression and without ^(^) the entire line is always displayed in the function list. If this is what you want, it is okay.

      UltraEdit now knows on which lines a function starts and everything below the next function belongs to this function. This block is analyzed next by the regular expressions of the subgroups. Normally subgroups contains also a start and end expression like

      /TGFindBStart = "("
      /TGFindBEnd = ")"


      or something similar to separate the function block further for example into a function parameter block and local parameters of the function.

      You don't have defined any start and end expression. That could be right for Clipper because everything to next function start must be analyzed, but I can't evalute that because I know nothing about language Clipper. Some examples posted within the BBCode tags for a code would be very helpful for me and any other good in finding regular expressions.

      Further I don't know if it is possible to define a subgroup without a start and end expression. All subgroups in the standard wordfiles have a start and end expression and the documentation in help is not clear enough on this point.

      However, PARAMETERS* is definitely not a good expression because * means 0 or more occurrences of any character except new line characters. Without a following character/expression it is always interpreted as NO character. So just PARAMETERS without * is the same as PARAMETERS*.

      I suggest to use PARAMETERS[ ^t]+^(*^)$ which means find word PARAMETERS followed by 1 or more occurrences of spaces/tabs followed by any number of any character except newline characters to end of line. Those characters are tagged by ^(*^) and therefore only those characters should be displayed in the function list view.

      If line comments are possible, instead of ^(*^) something different should be used which excludes the line comments, for example ^([0-9a-z_^-]+^) if only the characters respectively character ranges in the square bracket are allowed for parameter names.

      Sorry for the long reply, but without some code examples I can't post here a working function string set.
      Best regards from an UC/UE/UES for Windows user from Austria

      4
      NewbieNewbie
      4

        Mar 12, 2010#3

        First thank you so much for spend your time explain it to me! Here we go:
        Mofi wrote:[STATIC ]++ should be for optional word STATIC, but the expression means 0 or more occurrences of the characters S, T, A, T (once again, not needed), I, C and space. That is not really wrong, but just [ AICST]++ or propably just a * would work too.
        Nice to know it, thanks for the tip. Just I want you to know that I didn't do it, I download the Clipper wordfile from the site and I barely understand how the sentence works (by the way THANK YOU for you patience!!)
        Mofi wrote:Without any further expression and without ^(^) the entire line is always displayed in the function list. If this is what you want, it is okay.
        It's fine by now. Because all the code is not formatted same way (much people work on it) not always shows only the name of the FUNCTION/PROCEDURE but other useful data too, but like I said it doesn't bother until now :-)
        Mofi wrote:UltraEdit now knows on which lines a function starts and everything below the next function belongs to this function. This block is analyzed next by the regular expressions of the subgroups. Normally subgroups contains also a start and end expression like

        /TGFindBStart = "("
        /TGFindBEnd = ")"

        or something similar to separate the function block further for example into a function parameter block and local parameters of the function.
        I tried to know more about subgroups before post here, by searching in google things like "/TGBegin", "/TGEnd", "ultraedit subgroups function list", etc. and the only I can found was this Topic in this forum. I didn't know about examples, and in help didn't found about /TGFindBStart... I will be searching better now.
        Mofi wrote:You don't have defined any start and end expression. That could be right for Clipper because everything to next function start must be analyzed, but I can't evalute that because I know nothing about language Clipper. Some examples posted within the BBCode tags for a code would be very helpful for me and any other good in finding regular expressions.
        Here is a example code (I hope this is what you needed):

        Code: Select all

        //Program
        Some program data...
        
        DO procedure1 WITH Parameter1, Parameter2, Parameter3 //Call a procedure
        
        IF AllRight
          do something...
        ELSE
          DO procedure2 WITH Parameter4, Parameter5 //Call the other procedure
        ENDIF
        
        more program data...
        
        RETURN //End of the program
        
        //List of Procedures
        PROCEDURE procedure1
          PARAMETERS Parameter1, Parameter2, Parameter3
          IF Parameter1 = Parameter2
            do something...
          ELSE
            IF Parameter2 < Parameter3
              do something...
            ELSE
              do something else...
            ENDIF
          ENDIF
        RETURN //End of Procedure1
        
        STATIC PROCEDURE procedure2
          PARAMETERS Parameter4, Parameter5
          DO CASE
            CASE Parameter4 = "Something"
              do something...
            CASE Parameter5 = "Something else"
              do something else...
          ENDCASE
        RETURN //End of Procedure2
        
        All in UPPERCASE are Reserved Words, words starting with uppercase letter is a Variable, some other text is pseudo-code. I hope you can understand it because I don't know if the forum can colour it like php with code tag, search for it and didn't found it.
        Mofi wrote:However, PARAMETERS* is definitely not a good expression because * means 0 or more occurrences of any character except new line characters. Without a following character/expression it is always interpreted as NO character. So just PARAMETERS without * is the same as PARAMETERS*.

        I suggest to use PARAMETERS[ ^t]+^(*^)$ which means find word PARAMETERS followed by 1 or more occurrences of spaces/tabs followed by any number of any character except newline characters to end of line. Those characters are tagged by ^(*^) and therefore only those characters should be displayed in the function list view.
        I try it but it didn't work, here is wordfile, maybe I did some wrong or you was right supossing that without start and end expressions it didn't work:

        Code: Select all

        /TGBegin "Funciones"
        /TGFindStr = "%[STATIC ]++^{FUNCTION^}^{PROCEDURE^}"
        /TGBegin "Parametros"
        /TGFindStr = "PARAMETERS[ ^t]+^(*^)$"
        /TGEnd
        /TGEnd
        
        Mofi wrote:If line comments are possible, instead of ^(*^) something different should be used which excludes the line comments, for example ^([0-9a-z_^-]+^) if only the characters respectively character ranges in the square bracket are allowed for parameter names.
        Thanks again for the tip, I work on the details about the comments when it works :-)
        Clipper is not case sensitive.
        Mofi wrote:Sorry for the long reply, but without some code examples I can't post here a working function string set.
        Do not sorry, I thank you and appreciate your effort explain it to me. I hope you understand all I try to put here, if not I try someone that really knows some English help me to write you.

        P.S.: I admire your dedication (posting with colors and the simplicity of your answers). Thank you again.

        6,685587
        Grand MasterGrand Master
        6,685587

          Mar 14, 2010#4

          A function list with groups is brand new in UltraEdit. This feature is introduced with UE v16.00 released on 2010-03-03. Therefore there are not many experiences and documentations available yet and so you can't find more at the moment than you have already found.

          However, I played with your example file and the clipper wordfile modified with the your function strings and found a working set.

          /TGBegin "Funciones"
          /TGFindStr = "%[ ^tAICST]++^{FUNCTION^}^{PROCEDURE^}[ ^t]+^([^-0-9_a-z]+^)"
          /TGBegin "Parametros"
          /TGFindStr = "[ ^t,]++^([~^p,]+^)"
          /TGFindBStart = "PARAMETERS[ ^t]+"
          /TGFindBEnd = "?[/^p]"
          /TGEnd
          /TGEnd


          Now I know that /TGFindBStart and /TGFindBEnd must be defined for a subgroup. Further the open and close tags are interpreted also as regular expressions which I supposed, but did not know.

          The function string itself is modified now and shows only the function name in the function list. If you remove ^( and ^) you get the entire line in the function list like before. Just * instead of [ ^tAICST]++ as I suggested is not working because of the following OR expression. You could also use

          /TGFindStr = "%^([ ^tAICST]++^{FUNCTION^}^{PROCEDURE^}[ ^t]+[^-0-9_a-z]+^)"

          to get optional word STATIC, keyword FUNCTION or PROCEDURE and the name of the function/procedure displayed in the function list, but nothing else on that line like a line comment.

          /TGFindBStart = "PARAMETERS[ ^t]+" simply means find word PARAMETERS followed by 1 or more spaces/tabs.

          /TGFindBEnd = "?[/^p]" means find a single character followed by a slash character or a line termination character. The slash is needed to end the group starting with PARAMETERS on begin of a line comment starting with //. ^p is needed when no line comment is on the parameters line. I can't explain why additional ? is required to get the listing of parameters working. I just found out that without it, it is not working.

          /TGFindStr = "[ ^t,]++^([~^p,]+^)" is the regular expression working on PARAMETERS Parameter1, Parameter2, Parameter3 and PARAMETERS Parameter4, Parameter5 with representing here the line termination character(s).

          [ ^t,]++ means find a space or tab or comma zero or more times.
          ^([~^p,]+^) means find any character one or more times which is not a line termination character or a comma. This expression is tagged and therefore only the strings found by this expression are displayed in the function list.

          Note: UltraEdit searches only for first occurrence of PARAMETERS[ ^t]+ and ?[/^p] inside a function. So if there would be multiple lines with PARAMETERS in a function/procedure, parameter line 2 and all others would be ignored with the expressions I found.
          Best regards from an UC/UE/UES for Windows user from Austria

          4
          NewbieNewbie
          4

            Mar 18, 2010#5

            Hi again! Sorry for the delay. I been very busy but I been testing and trying all you teach me. I understood many things but all the things I test don't give me absolute solution. Expressions you give me in the past answer work fine with some issues I describe to you next:

            First I give you a better example, is a portion of code of the real program without some un-useful code for the example.

            Code: Select all

            ***************************************
            * PROGRAMA
            ***************************************
            
            PARAMETERS cTipoPes   // N=Normal D=Despacho
            
            * Configuracion Inicial del Sistema
            
            lFechVal   = .F.
            
            G_LinNumG  =  7
            G_ColNumG  = 17
            
            * CALL TO PROCEDURES HERE...
            
            SETCOLOR(G_Color40)
            DO UT_MELI
            @ 23,0 SAY '<F5>-Datos <F6>-Imprimir <F7>-ElimUlt ';
                       '<F8>-Comandos <F9>-Man/Auto <F10>-Balanza'
            SETCOLOR(G_Color41)
            @ 23,1 SAY 'F5'
            @ 23,12 SAY 'F6'
            @ 23,26 SAY 'F7'
            @ 23,39 SAY 'F8'
            @ 23,53 SAY 'F9'
            @ 23,67 SAY 'F10'
            SETCOLOR(G_Color20)
            
            RETURN
            ***************************************
            
            * DECLARACION DE PROCEDIMIENTOS
            
            * Procedimiento de Inicialización por Defecto de Variables Auxiliares
            PROCEDURE pIniDefVar
              SELECT 4
              SEEK xPE_CODGRU
              IF FOUND()
                cNomGru = LEFT(GD_NOM,23)
              ELSE
                cNomGru = SPACE(23)
              ENDIF
              @21, 25 SAY xPE_CODUSU
              @21, 37 SAY cNomUsu
              SETCOLOR(G_Color20)
            RETURN
            
            * Procedimiento de Visualización de Variables Auxiliares
            PROCEDURE pVisualVar
              SELECT 10
              SEEK xPE_CODUSU
              IF FOUND()
                cNomUsu = US_NOM
              ELSE
                cNomUsu = SPACE(35)
              ENDIF
              @10,62 SAY xPE_FECFAE
              @21, 25 SAY xPE_CODUSU
              @21, 37 SAY cNomUsu
              SETCOLOR(G_Color20)
            RETURN
            
            * Procedimiento de Asignación de Campos del Archivo a Variables Auxiliares
            PROCEDURE pAsignaVar
              xPE_NUMPES = PE_NUMPES
              xPE_PESO   = PE_PESO + PE_TARBOL + PE_TARCAJ
            
              xPE_TARBOL = PE_TARBOL
            
              xPE_TARCAJ = PE_TARCAJ
              xPE_CODUSU = PE_CODUSU
            RETURN
            
            * Procedimiento de Ventana de Selección
            PROCEDURE pVentB3PE
            PARAMETERS cAreaBusq,cDatIng,nFilVen,nColVen,nLonVen,nFilDat,nColDat, ;
                       cCamMues,nFilMue,nColMue,nLonMue,cMuesErr,cColorDat,nUltTec, ;
                       cExitoBusq,cFiltVen
            
              SELECT &cAreaBusq
              IF '?' $ cDatIng
                cInfSel = "DTOC(PE_FECHA) +' │ '+PE_NUMPES+' │ '+PE_CODART  +' │ '+STR(PE_PIEZAS,4) +' │ '+PE_CODCLI "
                cTitArt = '   FECHA   │  NUMERO  │ CODART │ CANT │ CODCLI'
                nAnchoVen = LEN(cTitArt)
                nUltTec   = 0
                nNumRe = RECNO()
                SET ORDER TO 1
                GOTO nNumRe
                IF nUltTec = 27
                  cExitoBusq = 'N'
                ELSE
                  cDatIng = PE_NUMPES
                  cExitoBusq = 'S'
                ENDIF
              ENDIF
            
              IF cExitoBusq = 'S'
              ENDIF
            
            RETURN
            
            ********* Procedimiento SALIR *********
            PROCEDURE Salir
              CLEAR GETS
            RETURN
            ***************************************
            
            ***************************************
            * PROCEDIMIENTO: ContarVaca
            * DESCRIPCION: Descripción
            ***************************************
            STATIC PROCEDURE ContarVaca
              PARAMETERS nCatVaca, nOtraCat
            
              SELECT 17
              SET INDEX TO PF_NUM, PF_FECLI, PF_TROPA
              * SELECT 22
              * IF UR_UsAr('PESFAE',.F.)
              *   SET INDEX TO PF_NUM
              * ELSE
              *   DO UT_MEER WITH 'ERROR DE RED > Abriendo archivo PESFAE.DBF'
              *   RETURN .F.
              * ENDIF
            
              nCatVaca = 0
              nOtraCat = 0
              SELECT 1
              nRegistro = RECNO()  //Guardo el registro actual para dejar todo como estaba
              nOrden = INDEXORD()  //Tambien guardo el indice que se esta usando
              SET ORDER TO 5
              SEEK DTOS(CTOD('  /  /  '))+xPE_CODCLI+DTOS(xPE_FECHA)
              DO WHILE .NOT. EOF() .AND. PE_CODCLI = xPE_CODCLI .AND. PE_FECHA = xPE_FECHA
                IF PE_TKTFAE = SPACE(8)
                  SKIP
                  LOOP
                ENDIF
                cTicket = PE_TKTFAE
                * SELECT 22
                SELECT 1
                SKIP
              ENDDO
              * SELECT 22
              * USE
              SELECT 17
              SET INDEX TO PF_TROPA, PF_NUM, PF_FECLI
              SELECT 1
              SET ORDER TO nOrden
              GOTO nRegistro
            
            RETURN
            ***************************************
            
            ***************************************
            * PROCEDIMIENTO: pAsignarTropa
            * DESCRIPCION: Descripción
            ***************************************
            STATIC PROCEDURE pAsignarTropa
              PARAMETERS cCodArt, cCodCli, dFechProd, nCantPiezas, cReproc, cTropaAsig
            
              IF cReproc = 'N'
            
                DO WHILE .NOT. EOF() .AND. PE_FECHA = dFechProd
                  IF PE_CODCLI <> cCodCli // SI NO ESTA ASIGNADO AL CLIENTE NO LO CONSIDERO
                    SKIP
                    LOOP
                  ENDIF
                  IF PE_CODART = cCodArt
                    nCuentaCorte = nCuentaCorte + PE_PIEZAS
                  ENDIF
                  SKIP
                ENDDO
            
              ELSE
            
                DO WHILE .NOT. EOF() .AND. PE_FECDES = dFechProd
                  IF PE_CODCLD = cCodCli // SI ESTA DESPACHADO AL CLIENTE LO CONSIDERO
                    SELECT 28
                    SEEK PESDES->PE_TROPA
                    SELECT 1
                  ENDIF
                  SKIP
                ENDDO
            
              ENDIF
            
            RETURN
            ***************************************
            
            ***************************************
            FUNCTION pValTropa
            PARAMETERS cTropaP, dFechFae, cExitoVal
            
            dFechFae = CTOD('  /  /  ')
            cExitoVal = 'S'
            
            IF cTropaP <> SPACE(6)
            
            ENDIF
            
            RETURN (cTropaP)
            ***************************************
            
            ***************************************
            PROCEDURE pMultTropas
            PARAMETERS xPE_TROPA1,xPE_CANTR1,xPE_TROPA2,xPE_CANTR2,xPE_TROPA3,xPE_CANTR3,xPE_TROPA4,xPE_CANTR4,xPE_TROPA5,xPE_CANTR5,xPE_TROPA6,xPE_CANTR6,xPE_TROPA7,xPE_CANTR7
            
            SAVE SCREEN TO Ant
            
            XULT_CAMP = 14
            
            SET COLOR TO W/N
            @10,29 CLEAR TO 21,53
            SET COLOR TO W/G
            
            RESTORE SCREEN FROM Ant
            
            RETURN
            ***************************************
            
            ***************************************
            FUNCTION pPantDPD (cNuevo, lUltimo)
            
            SAVE SCREEN TO DPD_Pant
            
            *SET COLOR TO W/N
            *@ 2,2 CLEAR TO 3,55
            SET COLOR TO W/G
            @ 6, 2 SAY '┌────────┬──────┐'
            @ 7, 2 SAY '│ TROPA  │ CANT │'
            @ 8, 2 SAY '├────────┼──────┤'
            * 9, 2 SAY '│ ______ │ ____ │'
            *          '└────────┴──────┘'
            
            RESTORE SCREEN FROM DPD_Pant
            
            RETURN
            ***************************************
            This program is called from another program, because of this it has parameters on the beginnig of it, and it no need to show it on the list, so it's correct.
            Procedures and functions starts in * DECLARACION DE PROCEDIMIENTOS.
            Lines starting with * are comments like lines with // on it.
            Well, the expressions you give me show me this list of procedures/functions:

            Code: Select all

            Funciones
                FUNCTION pPantDPD
            [-] FUNCTION pValTropa
                [-] Parametros
                      cExitoVal
                      cExitoVal
                      cTropaP
                      dFechFae
                PROCEDURE pAsignaVar
                [-] Parametros
                      ;
                      ;
                      cAreaBusq
                      cDatIng
                      nColDat
                      nColVen
                      nFilDat
                      nFilVen
                      nLonVen
                PROCEDURE pIniDefVar
                [-] Parametros
                      ;
                      ;
                      cAreaBusq
                      cDatIng
                      nColDat
                      nColVen
                      nFilDat
                      nFilVen
                      nLonVen
                PROCEDURE pMultTropas
                [-] Parametros
                      xPE_CANTR1
                      xPE_CANTR2
                      xPE_CANTR3
                      xPE_CANTR4
                      xPE_CANTR5
                      xPE_CANTR6
                      xPE_CANTR7
                      xPE_TROPA1
                      xPE_TROPA2
                      xPE_TROPA3
                      xPE_TROPA4
                      xPE_TROPA5
                      xPE_TROPA6
                      xPE_TROPA7
                PROCEDURE pVentB3PE
                [-] Parametros
                      ;
                      ;
                      cAreaBusq
                      cDatIng
                      nColDat
                      nColVen
                      nFilDat
                      nFilVen
                      nLonVen
                PROCEDURE pVisualVar
                [-] Parametros
                      ;
                      ;
                      cAreaBusq
                      cDatIng
                      nColDat
                      nColVen
                      nFilDat
                      nFilVen
                      nLonVen
                PROCEDURE Salir
                [-] Parametros
                      nCatVaca
                      nOtraCat
                      nOtraCat
                STATIC PROCEDURE ContarVaca
                [-] Parametros
                      nCatVaca
                      nOtraCat
                      nOtraCat   
                STATIC PROCEDURE pAsignarTropa
                [-] Parametros
                      cCodArt
                      cCodCli
                      cReproc
                      cTropaAsig
                      cTropaAsig
                      dFechProd
                      nCantPiezas
            And it will be:

            Code: Select all

            Funciones
                FUNCTION pPantDPD
            [-] FUNCTION pValTropa
                [-] Parametros
                      cExitoVal
                      cTropaP
                      dFechFae
                PROCEDURE pAsignaVar
                PROCEDURE pIniDefVar
                PROCEDURE pMultTropas
                [-] Parametros
                      xPE_CANTR1
                      xPE_CANTR2
                      xPE_CANTR3
                      xPE_CANTR4
                      xPE_CANTR5
                      xPE_CANTR6
                      xPE_CANTR7
                      xPE_TROPA1
                      xPE_TROPA2
                      xPE_TROPA3
                      xPE_TROPA4
                      xPE_TROPA5
                      xPE_TROPA6
                      xPE_TROPA7
                PROCEDURE pVentB3PE
                [-] Parametros
                      cAreaBusq
                      cCamMues
                      nColDat
                      nColMue
                      cColorDat
                      nColVen
                      cDatIng
                      cExitoBusq
                      nFilDat
                      nFilMue
                      cFiltVen
                      nFilVen
                      nLonMue
                      nLonVen
                      cMuesErr
                      nUltTec
                PROCEDURE pVisualVar
                PROCEDURE Salir
                STATIC PROCEDURE ContarVaca
                [-] Parametros
                      nCatVaca
                      nOtraCat
                STATIC PROCEDURE pAsignarTropa
                [-] Parametros
                      cCodArt
                      cCodCli
                      cReproc
                      cTropaAsig
                      cTropaAsig
                      dFechProd
                      nCantPiezas
            Look at the function pVentB3PE, it show only the first of the three lines of parameters, like you said before, if it has a solution it's ok if not is not a problem.

            There are two problems here:
            • Some Procedures that don't have variables shows variables from others procedures.
            • Some Variables in procedures are listed two times.
            Like I said, I been trying but I can't do the expressions show me the list like it has to do. Thanks again for your patience.

            6,685587
            Grand MasterGrand Master
            6,685587

              Mar 22, 2010#6

              Following should result in a better list:

              /TGBegin "Funciones"
              /TGFindStr = "%[ AICST]++^{FUNCTION^}^{PROCEDURE^}[ ^t]+^([^-0-9_a-z]+^)"
              /TGBegin "Parametros"
              /TGFindStr = "^([0-9a-z_]+^)"
              /TGFindBStart = "%[ ^t]++PARAMETERS"
              /TGFindBEnd = "^p[ ^t]++$"
              /TGEnd
              /TGEnd

              As you can see I have changed the start and end expression for a parameter block. Now everything after PARAMETERS (must be at start of the line with preceding spaces/tabs allowed) until first blank (line without characters) or empty line (line with only containing spaces/tabs) is interpreted as parameter block.

              The subgroup feature is designed mainly for C, C++, C#, Java, Javascript and similar languages where every function must have () independent if the function has parameters or not, and the code of a function must be included in {} even if the function code is only 1 line (or contains no code line). That requirements can't be fulfilled by Clipper as far as I could see. There is no definite character or string which marks the beginning of the function code block. There is only keyword RETURN to mark the end of a function. And there is no character or string pair which defines the parameter block. If the function has parameters or not is only defined by the presence of keyword PARAMETERS and the end of a parameter block is where next command is. Well, the clipper interpreter surely knows what is the next command, but how should UltraEdit know that.

              In other words: With the expressions I posted here you will still not get the correct result.

              Every string consisting only of 0-9A-Za-z and an underscore after a comment starting with ; will be interpreted also as parameter. After 2 hours of trials I have given up to try to exclude everything after a semicolon till start of next line. Maybe in future using the Perl regexp engine it is possible to exclude comments. But currently with the UltraEdit engine I don't know how to do it.

              The second problem is that UltraEdit is searching for the parameters group not from start of a function definition line to start of next function definition line or end of file as I first expected. UltraEdit simply searches from start of a function definition line down to end of file if necessary to find the strings defined by the subgroup expressions. For languages like C, C++, C#, Java, Javascript that is no problem, but for language like clipper this is not a good behavior. I will suggest IDM a better search method for this problem.
              Best regards from an UC/UE/UES for Windows user from Austria

              4
              NewbieNewbie
              4

                Mar 23, 2010#7

                It is not possible then make the expression that consists of a PARAMETERS as the beginning of the expression and RETURN as a final instead of using the characters ( and ) or [ and ] and show everything until find an empty line, right?

                I apreciate very much your effort and I thank you all the explanations. The expression work nice.
                When the sub-groups accept Perl regex engine I start trying again.

                4

                  Jun 21, 2011#8

                  Good morning to all;
                  I looked this post and I have a question...
                  I write in Clipper/Xbase++ and I use dbsee to generate clipper sources.
                  The functions are automatically created in the following syntax:

                  Code: Select all

                  ******************************************************************************
                  STATIC FUNCTION OKVenduti(                          ; // Description
                                            IdNome, Stampato, bloccato   ) // Parameters
                  ******************************************************************************
                  * #COD FSFUNC000086    ###
                     LOCAL LastMov     := 0
                     LOCAL LastMovVid  := 0
                     LOCAL MovRigo     := 10
                     LOCAL ERRORE      := ""
                     LOCAL NuovoErrore := .F.
                  ...... function body
                  RETURN
                  I tried to use in the .uew file all you wrote in the previous messages and I tried to make something new following the instructions, but I never seen the function list in the panel.

                  Do you have an idea?

                  Thank you very much
                  Fabio

                  6,685587
                  Grand MasterGrand Master
                  6,685587

                    Jun 21, 2011#9

                    I downloaded a Clipper/Xbase++ wordfile from IDM's server, fixed all the mistakes in this user contributed wordfile and replaced the function strings with regular expressions suitable for the example you posted. Try the attached wordfile. I can see with this wordfile in function list view of UE v17.10.0.1010:

                    Code: Select all

                    Functions
                     [-] OKVenduti
                         [-] Parameters
                                bloccato
                                IdNome
                                Stampato
                         [-] Variables
                                ERRORE
                                LastMov
                                LastMovVid
                                MovRigo
                                NuovoErrore
                    Please note: The grouped function strings feature as used in this wordfile requires UE v16.00 or later.
                    clipper_xbase.zip (3.71 KiB)   265
                    Modified wordfile for Clipper/Xbase++

                    4

                      Jul 03, 2011#10

                      Hello Mofi, thank you for your answer.

                      The uew file doesn't work... or better, works whith the modified source of the function.
                      My problem is that I use dbsee to generate sources and the syntax of the functions are what I wrote in my example.
                      If I change it I cannot work properly...
                      Now I'm trying the UE 17.10.0.1010, the last version; in a old version (13 or 14 if I remember well) the wordfile.txt did work correctly, so I'm sure that may be a way to do it.
                      I tried to use the wordfile.txt renamed in clipper.uew but it's the same... I don't know if something is changed during versions...

                      Thank you very much
                      Fabio

                      6,685587
                      Grand MasterGrand Master
                      6,685587

                        Jul 04, 2011#11

                        I could help you much better if
                        1. you post which version of UltraEdit you use as recommended in the global readme announcement,
                        2. you pack the currently used wordfile(s) into a ZIP archive
                        3. together with one of your Clippper source files,
                        4. upload the ZIP file as attachment to this forum topic,
                        5. tell me what you see in the Syntax Highlighting configuration dialog - full name of a wordfile or full path of a wordfiles directory,
                        6. tell me if you perhaps use an UltraEdit project which has its own wordfile respectively wordfiles directory.
                        Do you have read the readme topic for the syntax highlighting forum explaining the differences on wordfiles management depending on version of UltraEdit?

                        4

                          Jul 11, 2011#12

                          Hello Mofi,

                          I use Ultraedit v. 17.10.0.1010.

                          I attached 2 source files (.prg) and all the wordfiles I used to try.
                          Currently I use clipper.uew; you'll find something wrong because I made many tries and now I'm sure it's non correct.

                          In the Syntax Highlighting configuration dialog I see a full path (X:\IDM Computer Solutions\Ultraedit\wordfiles)

                          The project has not an its own wordfile.

                          I have read the readme topic but whithout results.

                          Thank you very much for your cooperation.
                          Best regards
                          Fabio
                          wordfiles.zip (43.33 KiB)   252

                          6,685587
                          Grand MasterGrand Master
                          6,685587

                            Jul 19, 2011#13

                            Hello Fabio Raffaelli

                            Before I start with the function strings, I want to give some recommendations:
                            • Look on the keywords in the color groups C1 to C8 in the 4 wordfiles you have and put them together into a single wordfile. Cross check all the keywords with the manual you have for Clipper/Xbase++. A wordfile should contain only the keywords of the language, the standard symbol names of the standard libraries and operators. Please take the delimiter characters into account for the operators. For example if < and = are defined both as word delimiters, it is absolutely useless to define <= because the syntax highlighting engine of UltraEdit never interprets these 2 characters as 1 word. They are interpreted always as 2 words - < and =.
                            • Build the first line correct for Clipper/Xbase++ with correct line and block comments, string character, multiline string highlighting support and file extensions definition. Xbase_dbSee.uew and xbase++.uew contain shocking wrong definitions.
                            • Find out which characters should be really interpreted as word delimiters and use only those characters in the delimiters definition.
                            • Define open/close brace, indent/unindent and open/close fold strings really suitable for Clipper/Xbase++. When I look on the current definitions in the 4 wordfiles I must think they are for 4 different languages.
                            • Run the macros SortLanguage, TestForDuplicate and TestForInvalid from The ultimate syntax highlighting tools on this wordfile for sorting and validating the words in the color groups.

                            Now lets talk about the function strings. It was really hard for me to find good function strings because of
                            • bugs of the function string search engine of UltraEdit. I found several and really strange bugs while I was searching for working function strings. I reported them all to IDM by email and all of them are confirmed by IDM.
                            • An awful syntax in your *.prg files. There are so many variations in these 2 files that I was sometimes really near stopping the process to find suitable function strings. It was really hard to find common rules which I could use to build the regular expressions.
                            However, I can offer following function string block:

                            /TGBegin "Functions"
                            /TGFindStr = "%[ AICST]++^{FUNCTION^}^{PROCEDURE^}[ ^t]+^([^-0-9_a-z]+^)[ ^t]++("
                            /TGBegin "Parameters"
                            /TGFindStr = "[ ^t,]++^([0-9a-z_]+^)[ ^t]++[,;]"
                            /TGFindBStart = "("
                            /TGFindBEnd = ")"
                            /TGFindStr = "[,;][~^p]++^p[ ^t]++^([0-9a-z_]+^)"
                            /TGFindBStart = "("
                            /TGFindBEnd = ")"
                            /TGEnd
                            /TGBegin "Variables"
                            /TGFindStr = "LOCAL[ ^t]+^([0-9a-z_]+^)^{[ ^t:,^p]^}^{$^}"
                            /TGFindBStart = "^{FUNCTION^}^{PROCEDURE^}"
                            /TGFindBEnd = "RETURN"
                            /TGFindStr = "LOCAL[ ^t]+[0-9a-z_]+[ ^t:]++[~^p(),]+,[ ^t]++^([0-9a-z_]+^)"
                            /TGFindBStart = "^{FUNCTION^}^{PROCEDURE^}"
                            /TGFindBEnd = "RETURN"
                            /TGEnd
                            /TGEnd


                            Don't try to understand them. The regular expression strings contain parts which should not be really needed just to hide bugs of UE v17.10.0.1010. From my point of view all function names are correct displayed in function list view as also all the names of all local variables (and line numbers are correct, special problem on some variables). All parameters of the functions are also listed in the function list view, but for one problem caused by a bug of UE, I could not find a workaround.

                            For example for FUNCTION NOMf1Ecr( oLsb ,bBlk ) the function list view lists correct oLsb, but not 100% correct Blk. As you can see the first character is missing for the second parameter.

                            During the process to find suitable expressions I sometimes could see that for some found strings the first 2 characters were missing. If you insert 1 or more spaces after the comma the parameter name is correct displayed in function list view. The reason is a confirmed bug of UltraEdit which is hopefully fixed soon. I suppose that UE is deleting 2 bytes at end of found string or ignores the next 2 bytes after finding a string because of thinking by mistake that these 2 bytes must be a carriage return + line-feed pair which is not true.

                            I hope the IDM developers are fixing all the bugs I found and reported soon and then with next version of UltraEdit we can simplify the expressions.

                            4

                              Aug 03, 2011#14

                              Hello Mofi,

                              I understand what you mean and I tried as you suggest: it's real, in the function lists appear all the functions, many variables that are not part of the functions and other.

                              I had a look in other posts in the forum and I found an your answer (I don't remember the post) where you suggest this code:

                              /Function String = "%*STATIC FUNCTION[ ^t]+^([0-9a-z_]+^)[ ^t]++("

                              I tried and this works good and it's exactly what I need. Only the function I add to sources (static function) are displayed and it's ok because they are the only I need do find and modify (for the rest I do all inside dbsee).

                              So this is solved.

                              Thank you very much for you support, training and for the time you spent...

                              Best regards
                              Fabio