[Qt-creator] [patch] C++ syntax highlighting and the (unused) 'style' format.
roberto.raggi at nokia.com
roberto.raggi at nokia.com
Tue Apr 6 11:57:43 CEST 2010
Hi,
On Apr 6, 2010, at 11:32 AM, ext tbp wrote:
> On Tue, Apr 6, 2010 at 11:20 AM, <roberto.raggi at nokia.com> wrote:
>> You don't need to use a binary search to recognize keywords. The C++ keywords
>> are classified while tokenizing so instead of
>> [snip]
>> you should write something like
>>
>> switch (token.kind()) {
>> case T_VOID: case T_iNT: ...:
>> return true;
>> ...
>> }
> I thought about it but that either breaks encapsulation or ask for
> cplusplus/Token to be augmented with a dubious isDeclSpec predicate
> for the single purpose of syntax highlighting. But if that's
> preferable to another binary search, i'll gladly provide a patch if
> you want.
from a quick look at your patch it seems that you're highlighting cv-qualifiers, storage-class-specifiers and a subset of type-specifiers but i'm wondering why?
why do you think it is a good idea to highlight "extern", "mutable", "register" and so on as types?
>
>> I'm not against highlighting primitive types but i don't think that hardcoding the matching of size_t & co in the lexer is a good idea.
>> Yeah, I know about the hack we use in the lexer to match Qt-like classes (e.g. QObject, QPushButton and so on...) but I think it's wrong and we should definitely try to get rid of that ugly hack.
> Point taken.
Yep, we should use the Semantic Highlighter instead.
I won't be in the office this week but if you are interested we can continue this discussion on #qt-creator next week.
ciao robe
More information about the Qt-creator-old
mailing list