Sublime Forum

Buildsystems "file_regex" for C

#1

Hello,

I am trying capture errors with buildsystems but my regex does not seem to work.
I have tried some examples and tried tweaked one of them, it works partially but not exactly the way I want.

My compile errors show up like this:

"../foo/bar.c", line 528: warning #179-D: function "foo_bar" was

My “file_regex” looks like this, the file opens but it does not parse the linenumber correctly:

  "file_regex": "\/(.*)\".*:?,.*([0-9]*):.*:?#.*([0-9]).*:? (.*)$",

Also, my output doesn’t show the column number. So I want that to always be 0 (zero), how would I do that?

Thanks,

Z

0 Likes

#2

[quote=“Zuidd”]My compile errors show up like this:

"../foo/bar.c", line 528: warning #179-D: function "foo_bar" was [/quote]

I guess we have to match

1.) the file
2.) the line number
3.) the column
4.) the error message

For your output you can try to match 1 and 2:

“(.+), line (\d+): .+”

.

0 Likes

#3

[quote=“Jim”]

[quote=“Zuidd”]My compile errors show up like this:

"../foo/bar.c", line 528: warning #179-D: function "foo_bar" was [/quote]

I guess we have to match

1.) the file
2.) the line number
3.) the column
4.) the error message

For your output you can try to match 1 and 2:

“(.+), line (\d+): .+”

.[/quote]

Thanks alot Jim I got it working!

your first “(.+)” did not work for me though, as it does not exclude the double quotes and the two dots it tried to open the filepath: [my_project_directory/"…/foo/bar.c"].
And the backslash in “(\d=)” must have another backslash to parse correctly as the buildsetting conf is written in JSON.

So the end result is the following:

  "file_regex": "\/(.*)\", line (\\d+): .+",

Thanks again.

0 Likes