Sublime Forum

Parsing Elm build system output

#1

I’m trying to make a build system for Elm.

Output looks like this:

elm make --output /dev/null src/Main.elm
Compiling ...-- NAMING ERROR --- src/Some/Path/File.elm

I cannot find a `SomeModule.someVariable` variable:

34|     , someVariable = SomeModule,someVariable

This one is working ok:

{
  "cmd": ["elm", "make", "--output", "/dev/null", "$file"],
  "selector": "source.elm",
  "file_regex": "-- .* [-]+ .*/([^/]+)$",
  "line_regex": "^([0-9]+)|>"
}

But I would also like to catch the error message, which in the above case is “NAMING ERROR”, which is on the same line but before the file name. In the manual (https://www.sublimetext.com/docs/build_systems.html#file_regex) I read that the capture groups is pre-defined in a specific order (filename first and message last), so I’m wondering if there is a way to change the order. I tried using named capture groups like this:

"file_regex": "-- (?<4>.*) [-]+ .*/(?<1>[^/]+)$",

but it didn’t work. Sublime tries to open the file “NAMING ERROR”.

0 Likes