Parsing for MVS macro names to be displayed in function list view

Parsing for MVS macro names to be displayed in function list view

10210
Power UserPower User
10210

    Sep 06, 2013#1

    Most of the coding I do is in MVS (z/OS) assembler. I have a wordfile that provides syntax highlighting for this and identifies the functions (or CSECTs in MVS terms) in the assembler source. These are displayed in the UE function list as they are for C functions.

    I would also like the syntax highlighting to be able to identify the macros used in the code if possible. The coding conventions for macros are as follows.

    On the first line - or first non-comment line, starting in column 10 is the keyword MACRO, and nothing else. A comment line begins with a * or .* in column one. Any digits or characters from columns 73-80 as regarded as sequence numbers and are ignored.

    Then on the following line also in column 10 is the name of the macro. The name may or may not be preceded by a place holder variable that the programmer can use to declare a structure mapped by the macro using the name in the placeholder. So a typical macro would be coded would look like that below. The + in column 72 indicates a line continuation character.

    Code: Select all

             MACRO                                                          BCP00010
    &LAB     BCPTAB &DSECT=NO,                                             +BCP00020
                   &BCPLEN=,                                               +BCP00030
                   &BCPPRIME=,                                             +BCP00040
                   &BCPLOC=,                                               +BCP00050
                   &BCPVECTR=                                               BCP00060
    
    So for syntax highlighting purposes I would like if possible to have the macro name -BCPTAB in this case displayed in the UE function list. Is it possible to code up a search expression that looks for the keyword macro in column 10 and then on the following line, also in column 10 can extract the macro name to be displayed in the function list? Any assistance appreciated.

    Thanks...

    Frank

    6,649559
    Grand MasterGrand Master
    6,649559

      Sep 06, 2013#2

      I suppose that your wordfile contains UltraEdit regular expression function strings. Try following with adapted function string number

      /Function String = "%[^t ]+MACRO?++^p[~^p^t ]++[^t ]+^([A-Z0-9_]+^)"

      The expression means:

      % ... find a string beginning on start of a line.

      [^t ]+ ... there must be 1 or more spaces or horizontal tabs at start of a line of interest.

      MACRO ... this string must be next on the line in any case as function string searches are always executed with Match Case option not set.

      ?++ ... 0 or more characters except the new line characters carriage return and line-feed can follow.

      ^p ... line must end with any type of line termination. (^p means usually only DOS line termination, but in the wordfile the meaning is any type of line termination.)

      [~^p^t ]++ ... on the next line there can be 0 or more characters at start of the line which are whether a new line character nor a tab / space. In your example this expression matches &LAB.

      [^t ]+ ... there must be 1 or more spaces or horizontal tabs now on the second line.

      ^(...^) ... tags the string found by the expression inside the escaped round brackets. Only this part of the found string is displayed in the function list view.

      [A-Z0-9_]+ ... matches a string consisting of only letters A-Z in any case, digits and underscores.

      If that does not work as your wordfile contains Perl regular expression function strings, please post top of your wordfile from first line to the line starting with /C1 so that I can offer the line(s) you need in YOUR wordfile.

      10210
      Power UserPower User
      10210

        Sep 06, 2013#3

        Thanks very much for your fast response. It's working exactly as I had hoped.

        Cheers...

        Frank