Sublime Forum

Build system's file_regex

#1

I’m having trouble getting ST (2111 build) to put the cursor on the line containing a compile error.
My sublime-build file is this:

{ "cmd": "make", "probuild"], "file_regex": "(C:(.*?))\\(([0-9]+)\\) : error", "working_dir": "${file_path}" }

and here is the partial compiler output. The red text in the build output window is selected by ST on hitting F4:

[compilername:4288, [color=#FF0040]C:\path\to\file\3506.clc(18) : error : ]
[compilername:4288, Syntax error]

(I know, that’s weird output, but this is an in-house compiler)

So it seems that “(18)” is matched and it is the second group so I am expecting ST to pick that up as the line number. On hitting F4, ST opens the file if it’s not already open and goes to the file if it is already open but does not move the cursor from where it already is. ST puts the cursor on line 1 if it opens the file. If I put [a-z] in there instead of [0-9] there is no match so that makes me believe that “(.*?)” isn’t slurping up the line number as well.

I modeled the regex after D.sublime-build due to the line number being surrounded by parens and the grouping parens are inside that. I’ve verified that D.sublime-build *does *put the cursor on the correct error line, so I know ST works in this regard.

Does anyone see where my file_regex is wrong?

Thanks.

1 Like

#2

Never mind. I figured it out. The “(.*?)” is wrong.

Remove the parens from around that and it works (duh):

"file_regex": "(C:.*?)\\(([0-9]+)\\) : error",

Wouldn’t you know I struggle with it for a half hour yesterday, post the question this morning and then figure it out a minute after that. geez.

0 Likes