Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » when is the Syntax coloring be detemined ? (modified)
when is the Syntax coloring be detemined ? (modified) [message #190116] Thu, 26 April 2007 02:14 Go to next message
Misoullee is currently offline MisoulleeFriend
Messages: 34
Registered: July 2009
Member
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.
Re: when is the Syntax coloring be detemined ? (modified) [message #190220 is a reply to message #190116] Fri, 27 April 2007 09:44 Go to previous messageGo to next message
Anton Leherbauer is currently offline Anton LeherbauerFriend
Messages: 490
Registered: July 2009
Senior Member
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
Re: when is the Syntax coloring be detemined ? (modified) [message #190262 is a reply to message #190220] Fri, 27 April 2007 16:31 Go to previous messageGo to next message
Misoullee is currently offline MisoulleeFriend
Messages: 34
Registered: July 2009
Member
Thank for your reply.
Well then, syntax coloring based on the semantic would be easy to get
some problems in various situations.
In fact, even if simple project and syntax is rights, the coloring was
not applied.
for example, I included glib.h into my C make project to use ADT such
GSList, GHashTable. but no coloring was applied for typedefs such
GSList, GHashTable.
this is certain bugs.

in another side, the semantic coloring can't work in real time while
writting codes on just a line. then where is I can get the convenience
from syntax coloring? just in the time read sources?
change back to the first purpose of syntax coloring and even code assist
what should do in coding time is certain.

thank you.



Anton Leherbauer 쓴 글:
> 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
>
Re: when is the Syntax coloring be detemined ? (modified) [message #725301 is a reply to message #190262] Wed, 14 September 2011 13:22 Go to previous message
Ganesh S is currently offline Ganesh SFriend
Messages: 1
Registered: September 2011
Junior Member
Hi,

I do not know if Misoullee's problem has been solved, but I have run into a similar issue as well.

I use eclipse IDE primarily for editing only, not even building or debugging. In our project, not all symbol errors wil be resolved, simply because, not all the source is owned/visible to us.

However the syntx coloring not working for unresolved symbols is reducing my concentration and efficiency. For e.g. I have set function calls to be highlighted in bold. The functions which are not resolved are not highlighted, and when I hover my mouse pointer over the function, it says "Function XYZ could not be resolved"

My question is -- as long as the eclipse IDE figures out that it is a function, why not apply the coloring, no matter whether it is resolved or not?
Previous Topic:problem with HUGE pointer
Next Topic:Formatter Removing Preprocessor Conditionals
Goto Forum:
  


Current Time: Sat Apr 27 04:02:17 GMT 2024

Powered by FUDForum. Page generated in 0.04216 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top