I have a custom makefile that outputs ANSI color characters on some lines that I execute with a custom build system cloned from the Make build system. The basic file_regex option in the build system is:
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
Here is a sample message that I would be matching, which is a basic GCC warning with ANSI color characters at the start and end:
e[33m./common/src/XXX.c:528:6: warning: 'foobar' defined but not used [-Wunused-function]e[0m
Browsing the build results produce the correct behaviour for the filename, line and column (I am able to browse to the precise location of the message). However, the message itself is not displayed in the text editor. Removing the starting ANSI character results in the message being displayed correctly. I have tried modifying file_regex as follows to remove the starting characters, but this only truncates my file name:
"file_regex": "^.....(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
In addition, another problem arises when I try to strip the ending ANSI character (e[0m). The following regex will produce the correct behaviour, but will truncate messages that don’t end with that color character:
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)....$",
However, using more elaborated regular expressions such as the following:
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? \\e\\[.*m(.*)\\e\\[.*m$",
Or even just:
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)...\\w$
Produces a correctly stripped error message in the editor, but breaks all browsing of the matched build results.
Any help would be appreciated