Author Topic: Multiline RE search which merges rows  (Read 308 times)

at5dapa1

  • Senior Community Member
  • Posts: 213
  • Hero Points: 19
Multiline RE search which merges rows
« on: January 28, 2021, 11:32:53 pm »
I have PC-Lint results which spreads on 2 or 3 rows and am trying to configure error parsing to extract the message concatenated in 1 line, so the idea is to find the new lines but to skip them: is it possible?

Test cases:
Code: [Select]
D:\work\path\buffer1.c  146  info 765: external
    symbol 'function' could be made static
uint32_t 'function'(struct Ctx *ctx, uint32_t start, uint32_t end)
         ^
..\src\path\buffer2.c  98  warning 613: potential use of null pointer
    'ctx'
    return ctx->Len;
           ~~~  ^
..\src\path\buffer3.c  146  info 818: parameter 'ctx' of function
    'sum(struct Ctx *, uint32_t, uint32_t)' could be pointer to
    const
uint32_t sum(struct Ctx *ctx, uint32_t start, uint32_t end)
                         ^
..\src\path\buffer4.c  166  info 818: parameter 'ctx' of function
    'diff(struct Ctx *, uint16_t, uint16_t)' could be pointer to
    const
uint32_t diff(struct Ctx *ctx, uint16_t start, uint16_t end)
                          ^

Tried RE:
Code: [Select]
^{#0:p}  {#1:i} {#3?+(\n|\r\n|\r)?+}$

Example of Matched Error Expression:
Code: [Select]
Matched expression on line #1
Filename: D:\work\path\buffer1.c
Line #: 146
Column:
Message:  info 765: external
    symbol 'function' could be made static

Is it possible to get "Message:  info 765: external symbol 'function' could be made static"?
Any hints are very wellcome!

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5707
  • Hero Points: 457
Re: Multiline RE search which merges rows
« Reply #1 on: January 29, 2021, 12:09:48 am »
Right now, the error regex matching doesn't support multiple lines yet.

I'll see if there is a way to improve this. Not easy.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5707
  • Hero Points: 457
Re: Multiline RE search which merges rows
« Reply #2 on: February 04, 2021, 12:52:05 am »
Getting this specific multi-line error message to work just required improving the display of multi-line error messages displayed on the message line.

I added a hot fix which improves the message line display for multi-line error messages.

Here is multi-line regular expression which works well for these multi-line error messages. You don't need the hot fix for this regex to work but you will notice that multi-line error messages displayed in the message line look bad.
Code: [Select]
{#0:p}( )#{#1:i}( )#{#3info ?@((\R(#![ \t]@\^$)(?@$))|$)#}