Menu

#901 c++ syntax highlighting failure with "final"

v1.23
closed-fixed
v1.22
5
2013-07-23
2012-10-16
No

I sure hope this is a duplicate, since that would mean at least a few more people were annoyed by it :)

The c++11 standard introduced the "final" keyword to force classes to become leaf classes (i.e., subclassing them will cause errors at compile time). Geany 1.23 (git >= 306eaab) does not handle this keyword properly. In any class definition,

class SomeClass final : public scope::SomeBaseClass<templateArgs> {
....
};

or even as simple as

class SomeClass final {
...
};

Geany will highlight the "final" keyword, but not the class name. This erroneous highlighting is propagated to all other files in the project, e.g., "SomeClass" will not be highlighted anywhere else when used. This strikes me as somewhat strange, since autocompletion of the classname seems to work without any hickups.

I use Geany 1.23 (git >= 306eaab), Ubuntu Linux 11.04, kernel 2.6.38-13 (no, I am not allowed to upgrade :)

Discussion

  • Rody Oldenhuis

    Rody Oldenhuis - 2012-10-16

    c++ syntax highlighting failure with "final"

     
  • Lex Trotman

    Lex Trotman - 2012-10-16

    No this isn't a duplicate.

    The simple fact is that neither the Scintilla lexer or the symbol parser is C++11 compliant, so both are likely to be confused by the extra keyword after the "class xxx" (and other more complicated places it is allowed).

    Patches are welcome.

     
  • Lex Trotman

    Lex Trotman - 2012-10-16
    • status: open --> open-accepted
     
  • Colomban Wendling

    This is now fixed in Git, thanks for reporting!

    @elextr: I don't think Scintilla have any problem here, the missing highlight comes from ctags not parsing the class so we don't register it as a type.

     
  • Colomban Wendling

    • labels: 790033 --> Filetypes
    • milestone: --> v1.23
    • assigned_to: nobody --> colombanw
    • status: open-accepted --> closed-fixed
     
  • Colomban Wendling

    Now fixed in Git, thanks for reporting.

     
  • Colomban Wendling

    • labels: Filetypes --> Filetypes, C++, parser
    • Found in: --> v1.22
     

Log in to post a comment.