I am trying to filter the output of my build system in SublimeText3.
First of all, can someone explain the difference between:
"file_regex": "",
"line_regex": "",
I want to catch the following line from this example output:
Compile success 0 Errors 0 Warnings Analysis time : 15.0 [ms]
.
VHDL/Verilog/EDIF/SystemC Simulator build 10.3.3558.6081
(c) 1997-2016 Aldec, Inc. All rights reserved.
License Number 0
Welcome to VSIMSA!
This message was printed from `startup.do' macro file.
# creating library
alib work
ALIB: Library `work' attached.
Compile success 0 Errors 0 Warnings Analysis time : 31.0 [ms]
Compile Package "BT601_cfg"
Compile success 0 Errors 0 Warnings Analysis time : 15.0 [ms]
# starting simulation with tb_top as the top level module
# asim fpc_tb
# running the simulation
# run 1000us
echo hi
hi
quit
First of all, can someone explain the difference between:
"file_regex": "", "line_regex": "",
The file_regex is used in sublime-build systems to capture the locations of warnings, errors or things of that type to allow you to directly navigate to the associated location in the file that generated the message.
The regex should match on such lines by including anywhere from one to four regex captures which capture the following information:
The captures have to appear in this order, so if for example there is no column number but there is message text, you need to include an empty regex capture so that the capture on the message text is the fourth one.
The file and line/column information are used to allow Sublime to directly open the file and position the cursor at the appropriate location. The file name can be a relative path, in which case the folder set as the working_dir in your build file is used to determine where the file can actually be found.
The text of the message would be used for things such as inline error messages attached to the file window with phantoms, if you happen to have the appropriate feature turned on.
The line_regex is only needed in cases where the tool that you're running displays the name of the file on a line different than the line that contains the error.
In that case, you should provide a line_regex that has the following captures:
If there is a line_regex set and it matches on a line, Sublime will look backwards through the results to find the first line that matches the file_regex you provided, allowing it to pick up the name of the file as well.
While you're working on setting up a build system, it can sometimes be helpful to open the Sublime console by selecting View > Show Console from the menu or pressing the associated key.
From there you can enter the following command and press enter:
sublime.log_result_regex(True)
This will get Sublime to log to the console what it's finding, so you can see if things are working as expected.
For example, given this example:
int main(int argc, char const *argv[])
{
printf("Hello, World!\n");
}
Building with the shipped C++ Single File build system generates the following output in the console:
Running g++ "/home/tmartin/test.c" -o "/home/tmartin/test"
found result file, line, col of [/home/tmartin/test.c], [3], [29] full path: /home/tmartin/test.c
More information on this topic can be found in the Official documentation as well as in the Unofficial documentation (linked here are the build system sections of both documentation sets).
I want to catch the following line from this example output:
Compile success 0 Errors 0 Warnings Analysis time : 15.0 [ms]
Since these regex values are for capturing the actual errors and warnings, it doesn't make sense to capture this particular line since it's not allowing you to navigate anywhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With