Author Topic: error parser fails when file path has spaces  (Read 4864 times)

davehohl

  • Senior Community Member
  • Posts: 271
  • Hero Points: 27
error parser fails when file path has spaces
« on: August 20, 2010, 09:59:59 PM »
I am trying to set up an error parser for PC-Lint, but it seems to choke when the file path contains blanks.  Attached are screen shots showing the expression editor and the results of validating the parser.  As you can see, the parser stops getting the file path as soon as a blank space is seen.  Is there any way for me to configure the parser so it will correctly deal with such paths?

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: error parser fails when file path has spaces
« Reply #1 on: August 20, 2010, 11:23:02 PM »
From the Regular Expression help in SE, it looks like the ":p" expression does not match spaces:

:p (([A-Za-z]\:|)(\\|/|)(:f(\\|/))@:f) - Windows: Matches a path.
:p ((/|)(:f(/))@:f) - UNIX: Matches a path.

Use a different expression than ":p" if you need to match a path with spaces.
It looks like the PC-Lint uses space as the delimiter between the path and the next part of the output, so probably you'll need to give more complex parsing hints.

davehohl

  • Senior Community Member
  • Posts: 271
  • Hero Points: 27
Re: error parser fails when file path has spaces
« Reply #2 on: August 21, 2010, 12:31:42 AM »
Thanks for the explanation, chrisant.

So rather than try to mess with the :p expression, I modified the PC-lint message output so it puts quotes around the file name and I used :q instead.  I was able to create an error parser that, when I use the Validate feature, successfully extracts the file path, error line, error column and message.  However, when I run lint and double-click on the message in the Build window, SE pops up a Find File dialog.  It does not seem to be using the parser, even though I believe I had it selected properly.  Is there something else I need to do to get SE to use the new parser?
« Last Edit: August 23, 2010, 04:38:20 PM by davehohl »

davehohl

  • Senior Community Member
  • Posts: 271
  • Hero Points: 27
Re: error parser fails when file path has spaces
« Reply #3 on: August 23, 2010, 05:03:57 PM »
So I went back to the error parser config screen and unchecked Lint-Unit, clicked Apply, then re-checked Lint-Unit and clicked OK.  The parser is now getting called.

In case anyone else is using PC-Lint and wants to do the same thing, here is how I modified the format command in the env-sl3.lnt file:

-"format=%(\q%f\q line %l, col %c %) >> error %n (%t -- %m)"

And the regular expression for the error parser is:

^{#0:q},{#1:i}:b{#3?+}$
« Last Edit: August 23, 2010, 05:07:35 PM by davehohl »