Author Topic: Formatting Build Output so that Slickedit would support it  (Read 12015 times)

heedless

  • Community Member
  • Posts: 24
  • Hero Points: 1
Formatting Build Output so that Slickedit would support it
« on: August 23, 2006, 01:58:43 PM »
Hello.

At the company where I work, we use custom build tools.
I would like to write a script that would parse our build tool's output, and format it so that Visual Slickedit could read it.

The point is, to get Visual Slickedit to show the error on it's "Build" window, and to be able to jump to the relevant line of code on double clicking of the window.

What output format does Vslick Accept so that I would get the above functionality?
(i.e. what can it parse as the build tool's output?)


Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Formatting Build Output so that Slickedit would support it
« Reply #1 on: August 23, 2006, 02:30:32 PM »
Go to Build->Configure Error Parsing...
You can add a new set of regular expressions that SlickEdit will use to parse your error output.  See the SlickEdit help for a description of what tokens are used for filename, line number, etc.

heedless

  • Community Member
  • Posts: 24
  • Hero Points: 1
Re: Formatting Build Output so that Slickedit would support it
« Reply #2 on: August 23, 2006, 02:41:24 PM »
I forgot to mention: We use vslick v9.

That option is not available there...

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: Formatting Build Output so that Slickedit would support it
« Reply #3 on: August 23, 2006, 03:11:49 PM »
Try modelling your output after gcc, which is one the standard defaults for error processing in SlickEdit:

Example:
c:/Projects/ucpp/cpp.cpp:47: error: expected `;' before "char"

Or, if you are good at crafting regular expressions, you can append a regular expression of your output syntax to def_error_re2 macro variable (using Macro> Set Macro Variable... or set-var on the command line. Here's an example:

Error message appears as this in build window:
**Error** C:\Projects\Hello World\Application.as: Line 16: Unexpected '}' encountered

SlickEdit regular expression would be:
^\*\*Error\*\* {#0:p}\: Line {#1:i}\: {#2}{#3?*$}

The expression is parsed and the match groups provide the info:
#0 = filename - (path and filename)
#1 = linenum - (integer)
#2 = column number - (optional)
#3 = error description
« Last Edit: September 19, 2006, 07:41:52 PM by Lee »

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Formatting Build Output so that Slickedit would support it
« Reply #4 on: August 23, 2006, 03:19:31 PM »
You've to use set-var def_error_re2 w/ a regexp to parse your output (@see error.e).
e.g.
Code: [Select]
/home/user/file.c:31:6: warning: "/*" within comment

path: ((/|)(([~/ \t"']#)(/))@([~/ \t"']#))
file: ([~/ \t"']#)
-> def_error_re2=^?*((/|)(([~/ \t"']#)(/))@([~/ \t"']#)){#0([~/\ \t"']#)}\:{#1:i}\:{#2:i}\:{#3?*}$

Edit:
@Lee: I thought tailoring 'def_error_re2' is the way to go. Wrong ?
Missed to refresh my browser and didn't see your posting...

HS2

« Last Edit: August 23, 2006, 03:51:41 PM by hs2 »

heedless

  • Community Member
  • Posts: 24
  • Hero Points: 1
Re: Formatting Build Output so that Slickedit would support it
« Reply #5 on: August 27, 2006, 12:17:34 PM »
Thanks!

That worked....

p.s. Is there a way to have multi-line matching? (We output multiple lines..)

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Formatting Build Output so that Slickedit would support it
« Reply #6 on: August 27, 2006, 02:07:51 PM »
No - error output is parsed line by line.
Maybe you could 'join' your compiler output to form a single line carrying all information you need.
pseudo script:
greps compiler output for 'error_or_warning_regexp and joines 3 'after-context' lines through sed:
Code: [Select]
compiler <...> 2>&1 grep error_or_warning_regexp -A 3 | sed 's/\n/ /'
------------------
grep --help:
...
Context control:
  -B, --before-context=NUM  print NUM lines of leading context
  -A, --after-context=NUM   print NUM lines of trailing context
  -C, --context[=NUM]       print NUM (default 2) lines of output context
                            unless overridden by -A or -B
  -NUM                      same as --context=NUM

grep.exe --version: grep (GNU grep) 2.4.2


Note that grep regexps differ from SlickEdit regexps ;)

HS2

PS: There are grep.exe / sed.exe for Windows too: http://unxutils.sourceforge.net/
« Last Edit: August 27, 2006, 02:11:49 PM by hs2 »

heedless

  • Community Member
  • Posts: 24
  • Hero Points: 1
Re: Formatting Build Output so that Slickedit would support it
« Reply #7 on: August 27, 2006, 02:43:32 PM »
Thanks.

We're working on IRIX btw, so no need for the windows utils.

And, I figured as much. Already wrote a perl script to extract required data.

Thanks again!

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Formatting Build Output so that Slickedit would support it
« Reply #8 on: August 27, 2006, 04:13:09 PM »
Congrats !
I still stick to the legacy cmdline tools (thanks god they are avail. on win32 too), which are sometimes a bit clumsy to use. :(
Perl is much more powerful - should get used to it asap...

HS2