CodeWarrior for S12(X) V5.9 - Syntax coloring for string literals

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CodeWarrior for S12(X) V5.9 - Syntax coloring for string literals

Jump to solution
3,076 Views
eJames
Contributor I

I am having trouble with syntax coloring in the CodeWarrior IDE. I have specified a custom color for "Strings" in the IDE preferences, but string literals simply do not show up in that color. For example, with the following line of code:

 

const char str[] = "some string";

 

"const char" and "str" will be properly colored as keywords and constants, but the string literal "some string" will be displayed with the default foreground text color. 

 

Am I doing something wrong, or is this a known bug in the IDE? 

 

I am using version 5.9 of the CodeWarrior IDE, targeting a Freescale S12(X) controller.

Labels (1)
0 Kudos
Reply
1 Solution
1,278 Views
CompilerGuru
NXP Employee
NXP Employee

You really want those strings to be colored? Well I never thought this would be important,

I have the impression strings are apparent on their own.

Sorry did not have a CW close by when I answered, so I did not say exactly where.

The setting is in the project settings (Alt-F7), go to File Mappings, select the line which contains the ".c" extension and change in the combo box below the Edit Language from "mwe_cpp_HC12" to "C/C++", then click "Change" and finally OK.

 

Daniel 

View solution in original post

0 Kudos
Reply
4 Replies
1,278 Views
CompilerGuru
NXP Employee
NXP Employee

The coloring has been disabled for strings and character constants because the language parser cannot reliably recognize inline assembler comments.

If you want to color string literals you can set the language coloring in the preferences and select the non HC12 specific C/C++ coloring. Note that you loose HC12 specifics (__far keyword, ...) and that the coloring can be off with inline assembly code.

 

Daniel

0 Kudos
Reply
1,278 Views
eJames
Contributor I

Hi Daniel,

 

Thank you for responding. Where can I find that setting in preferences? I've looked through every panel in IDE Preferences, but I don't see anything that lets me choose which coloring strategy is used.

 

0 Kudos
Reply
1,279 Views
CompilerGuru
NXP Employee
NXP Employee

You really want those strings to be colored? Well I never thought this would be important,

I have the impression strings are apparent on their own.

Sorry did not have a CW close by when I answered, so I did not say exactly where.

The setting is in the project settings (Alt-F7), go to File Mappings, select the line which contains the ".c" extension and change in the combo box below the Edit Language from "mwe_cpp_HC12" to "C/C++", then click "Change" and finally OK.

 

Daniel 

0 Kudos
Reply
1,278 Views
eJames
Contributor I

Daniel,

 

Thank you very much. That did the trick.

 

I can appreciate that most users wouldn't care about the string coloring, but the application I am working on has an interactive command-line interface, so there are a lot of string literals in my code. I wouldn't mind so much if they simply appeared in the default color, but since individual keywords within the string are colored, it messes with my mind.

 

Anyway, I appreciate you taking the time to respond. Thanks again!

0 Kudos
Reply