Home Download Buy Blog Forum Support

Build system's file_regex

Build system's file_regex

Postby terryarno on Fri Sep 16, 2011 3:15 pm

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:
Code: Select all
{
   "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, 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.
terryarno
 
Posts: 2
Joined: Fri Sep 16, 2011 2:31 pm

Re: Build system's file_regex

Postby terryarno on Fri Sep 16, 2011 3:33 pm

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

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

Code: Select all
"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.
terryarno
 
Posts: 2
Joined: Fri Sep 16, 2011 2:31 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 11 guests