[Geany] Help with custom compiler

Lex Trotman elextr at xxxxx
Thu Jul 19 08:30:58 UTC 2012

On 19 July 2012 17:38, Laszlo Nagy <gandalf at shopzeus.com> wrote:
> Thanks. But I still don't know how to do it. Obviously, I wouldn't like to
> browse C source files. In fact it was about 5 years ago when I last wrote a
> program in C, so even if I downloaded the sources, it wouldn't help.
> A quick search of the manual for regex finds
> http://www.geany.org/manual/current/#build-settings-section for how
> the regex is used
> I could setup Geany so that it automatically opens files referenced from
> error messages (if they are not opened yet). It can also navigate to the
> good line number. How can I use non-capturing groups in the error parsing
> regex?

Presume you read
http://www.geany.org/manual/gtk/glib/glib-regex-syntax.html since you
seem to have it right below.

> Here is an example. There are two kinds of error messages that I can get -
> because there can be an error in the compiler that I'm working on, and also
> there can be an error in the file that is being compiled:
> Error message (type one):
> File "/home/gandalf/Python/Lib/shopzeus/scripts/ssdlc.py", line 23, in
> <module>
> Regexp (type one):
> \s*File\s\"([^\"]+)\", line (\d+), in\s*(.*)
> Error message (type two):
> /home/gandalf/Python/Lib/shopzeus/demos/ssdl/test/test.ssdl:53:9:Syntax
> error
> Regexp (type two):
> ([^:]+):([^:]+):[^:]+:([^:]+)
> Both of these errors can happen then I press F8, so I would like to capture
> both messages if possible.  This is what I have tried:
> (?:\s*File\s\"([^\"]+)\", line (\d+),
> in\s*(.*))|(?:([^:]+):([^:]+):[^:]+:([^:]+))
> But it does not capture errors in the compiler. Maybe my regular expression
> is wrong. Or maybe the non-capturing group "?:" does not work.

IIUC Match group numbering is in the order they occur in the regex,
not the order they match, so the "type two" regex groups are 3 and 4
which geany ignores. The method isn't really suited to mixed
languages, but possibly you could manage a really messy combined regex
that would not be very specific but would match both cases.

> Here are some things that don't work:
> Cannot make a difference between warnings and errors. Now I know that this
> is a limitation of Geany and I can live with it. It would be a good
> improvement though.

Agree, but "somebody has to do it" (tm).

Patches/pull requests are welcome :)

> My compiler actually can tell the column number of the error too. Geany
> cannot interpret column numbers in error messages, right? This could be a
> good improvement too. ( Should I post this as a request on the dev list? )

As above.

> It is a bit off topic. When using GNU style error messages under Windows,
> parts of the error messages are ambiguous. Because the parts should be
> separated with colons, but under Windows the file names can contain colons
> too. I understand that this is a limitation of the GNU standard, not Geany.
> And I know that I could use a different error message format. But I'm
> hesitant to do it. What is better: follow the standard, or make it working?
> Is there a way to have both?

Whats the VS standard? that would be considered the "standard" on
windows not gnu.

> Otherwise, I'm quite satisfied now. :-) Thank you for your help!
> Best,
>   Laszlo
> _______________________________________________
> Geany mailing list
> Geany at uvena.de
> https://lists.uvena.de/cgi-bin/mailman/listinfo/geany

More information about the Users mailing list