Home Download Buy Blog Forum Support

Yet another regex question for build systems

Yet another regex question for build systems

Postby youngmit on Mon Mar 04, 2013 8:08 pm

Hey all,

I am trying to get the build system to work properly using CMake and the gfortran compiler. Currently I have:
Code: Select all
{
   "cmd": ["make", "-j3"],
   "working_dir": "/home/youngmit/opt/mpact-debug",
   "file_regex": "^(.+):([0-9]+).([0-9]+):.*$",
   "line_regex": "^Error:\\s(.*)$"
}

which is very close to working, but not quite. The issure is that the error message and the file/line/column are on separate lines in the compiler output. Heres and example:
Code: Select all
/home/youngmit/.../file.f90:144.79:

    CALL UTest_Assert(bool,144,'CALL testCMR%init() %angles%nrays FAILED!')l
                                                                           1   
Error: Syntax error in CALL statement at (1)


When I hit F7, it goes through and builds, and the regular expressions detect the error, but hitting F4 just selects the line in the console corresponding to the error message, rather than opening up the offending file. If I remove the line_regex, F4 will take me to the location in the file where the file_regex matches, but this ends up including errors and warnings, when I really only want to cycle through errors. I also tried making a regex for fille_regex that matches the entire multi-line error message, but again, hitting F4 just sends me to the lines in the console that match, rather than to the file of interest. Any ideas?

Thanks!
youngmit
 
Posts: 6
Joined: Mon Mar 04, 2013 7:49 pm

Re: Yet another regex question for build systems

Postby jps on Mon Mar 04, 2013 10:48 pm

You may be able to find out more information by entering sublime.log_result_regex(True) in the console.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Yet another regex question for build systems

Postby youngmit on Tue Mar 05, 2013 5:25 pm

Thank you for the reply. I tried invoking sublime.log_result_regex(True), and it indicates that i only get valid matches if i only specify the "file_regex" expression. This makes sense, because it was the only one that would take me to the file when i press F4. The issue is that as soon as a specify the "line_regex," it no longer matches the path, line, column. It does match part of the output from the build command and takes me to that (it hilights the error message), but it doesnt seem to have extracted filename and line number from the file_regex.

Reading the documentation for the build system configurations, i am a little bit confused about the difference between the "file_regex" and "line_regex" values. The etymology does not make a lot of sense to me, or perhaps they are more specific than i may have thought... is the file_regex ONLY for all of the values (filename, line, column, error), with the possibility of the line, column, error message being on a separate line that should be matched with the line_regex? If so, under this paradigm is it possible to match a message that has filename, line and column on one line and the error message on another?
youngmit
 
Posts: 6
Joined: Mon Mar 04, 2013 7:49 pm

Re: Yet another regex question for build systems

Postby youngmit on Tue Mar 05, 2013 5:54 pm

This might be an old man yells at cloud situation, but maybe a more general form could be useful. Perhaps something that takes a similar form to the syntax hilighting format:

Code: Select all
{
    "cmd": ["make", "-j4"],
    "working_dir": "path",
    "patterns": [
        {
            "match": "^(.+):([0-9]+).([0-9]+):.*$",
            "captures": {
                "1": {"name": "file"},
                "2": {"name": "line"},
                "3": {"name": "column"}
            }
        },
        {
            "match": "^Error:\\s(.*)$",
            "captures": {
                "1": {"name": "message"}
            }
        }
    ]
}
youngmit
 
Posts: 6
Joined: Mon Mar 04, 2013 7:49 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 12 guests