Skip to content

C preprocessor

Sylvain Chiron requested to merge Frigory33/gtksourceview:c-preprocessor into master

Hello. I am bringing improvements to the C style formatting.

The main improvement is having styling in C preprocessor lines. You know, sometimes, macro patterns are very long, and span on several lines. It is quite common, especially in libraries, and I want to see C syntax formatting in it. The list of macro parameters is matched to have the “preprocessor” color (including a possible ellipsis ...). The rest of the line (and also the next lines if you have \ at their ends) is colored like other C code, except the \ at the end of lines which also has the preprocessor color. It is the case for #define but also for #if and #elif.

I also made an improvement for numeric constants (the same thing I saw in Java and OCaml): instead of marking numbers entirely wrong or entirely correct, mark correct while they are correct, and then eventually detect an error if there is one. It allowed me to merge rules for invalid and valid numeric constants, so needs a bit less code.

And I made small changes to the Oblivion style I’m using with gedit (because it’s the only dark theme in this program): the error and notes styles were really too flashy, bad for the eyes.

Edited by Sylvain Chiron

Merge request reports