emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] support a few of the new features of C++11 in syntax highlig


From: Óscar Fuentes
Subject: Re: [PATCH] support a few of the new features of C++11 in syntax highlighting
Date: Tue, 18 Nov 2014 19:01:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Daniel Colascione <address@hidden> writes:

> On 11/18/2014 08:36 AM, Rüdiger Sonderfeld wrote:
>> On Tuesday 18 November 2014 15:47:43 Óscar Fuentes wrote:
>>> Daniel Colascione <address@hidden> writes:
>>>>>> The "alignof" keyword is the only one still missing.
>>>>>
>>>>> From the top of my head: override is also missing.
>>>>
>>>> Because "override" (and "final") are keywords only in certain semantic
>>>> contexts, supporting them requires special care.
>>>
>>> override and final have the same context as `const' for methods, so we
>>> could take that as a model. Skimming over cc-langs.el didn't show an
>>> obvious place for it, though.
>> 
>> Yes, but "const" has a meaning in other places as well.  That's why it is 
>> dealt with in `c-type-modifier-kwds'.  I think the problem is similar for 
>> "noexcept".  I've simply added it to `c-type-modifier-kwds' for now.  But 
>> it's 
>> actually the wrong place.  However unlike "override" and "final", there is 
>> also an operator version of "noexcept".
>
> C++11 introduced the noexcept and constexpr keywords. They're always
> keywords. "override" and "final" are different. Please don't go hack
> those into cc-engine. Better to leave them unfontified than to fontify
> perfectly good identifiers as keywords.

Is this the problem? *If* hacking c-mode font-lock system ends with
"override" and "final" fontified as specifiers, is that so terrible? Are
those identifiers so popular? C-mode already gets confused very often
about how to fontify certain non-C-ish chunks of C++ code, so having
"override" and "final" fontified as specifiers everywhere seems a
non-issue to me. What's more annoying is to not fontify them on method
declarations, because my first reaction when glancing at that code is to
assume a typo.

> They're not like "const" at all.

As far as c-mode is concerned, they are like "certain variety of const."
If c-mode uses the same heuristics everywhere for fontifying `const',
that means that we cannot exploit the existing mechanism for fontifying
"override" and "final". To bad. Then I would vote for adding them to
some list of keywords. As I said, not having them fontified when they
should is worse than having them fontified when they shouldn't.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]