Parsing IAR Toolchain Build messages

Hi all,

I have been recently involved in writing a parser that categorizes the build output of IAR toolchain and fits them into one of known diagnostic message. Apart from this it also infers the line number, filename, code and message. Since I am not able to find any pattern to match a diagnostic message from internet, I wrote my own to do so. The message pattern is documented in the Compiler User guide, provided along with the IAR Embedded workbench. Unlike other toolchain's the IAR assembler, linker, compiler emits diagnostics message in the same format, thus requiring me to write only one pattern to parse all the messages J. A sample C# snippet is also own below. The function accepts a line of text from the build output and matches them against the given pattern.

 

//The message pattern for the linker, assembler, compiler for IAR is same and so this is enough to parse the entire output.

static Regex iarDiagnosticMessagePattern = new Regex("^(?<filename>(.*)),(?<linenumber>[0-9]*)[\\s]{2}(?<category>(Error|Warning|Remark|Fatal Error))\\[(?<errorcode>[A-Za-z0-9]*)\\]:(?<message>.*)$");

 

 

Have a good time J