[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.cdt] Re: when is the Syntax coloring be detemined ? (modified)

Misoullee wrote:
> I use Eclipse 3.3 M6 with CDT4.0 M6.
> Last day for while I have coding in my c/c++  project,I was woundering
> something about syntax coloring.
> specially such functions, typedef, struct etc..
> 
> There seems to check a validation of C/C++ syntax' in the time when
> syntax coloring is applied to codes.
> so if the syntax is incorrect the coloring is not applied but in correct
> do well.
> as the result the syntax coloring seems not to be speed and flexsible
>  so there can be incorrect coloring.
> 
> My thought is some different.
> I believe which the syntax coloring should be determined for each
> separate tokens.
> because all files to edit are in my c/c++ project and so it is already
> enough to know it is c/c++. therefore all worlds are going to write
> should be treated as c/c++'s tokens but not general text.
> 
> 
> thank you.

Syntax coloring is done in two steps:
1. colorize based on simple tokens, like keywords, string literals, etc.
2. colorize based on the semantic of names (functions, typedefs, etc.)

The second step requires building an AST (abstract syntax tree) from the
source and resolving the names to their "bindings", ie. their semantic
meaning. In the presence of syntax (or other) errors, this name
resolution may fail and therefore no coloring will be applied.

Toni

-- 
Anton Leherbauer
Wind River CDT Team, Austria