[Qt-creator] [patch] C++ syntax highlighting and the (unused) 'style' format.

tbp tbptbp at gmail.com
Tue Apr 6 11:32:09 CEST 2010


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.

> 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.




More information about the Qt-creator-old mailing list