simple question :
How to add a new keyword in Sintax highlighting ?
I want to add : uint8_t , uint16_t , uint32_t , __interrupt etc etc
luca : ctarabo@tin.it
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
simple question :
How to add a new keyword in Sintax highlighting ?
I want to add : uint8_t , uint16_t , uint32_t , __interrupt etc etc
luca : ctarabo@tin.it
Hi Carmine,
Any syntax colouring options that are available will be found under Window->Preferences.
Have a look in general as this can be a very useful area to get back to.
The syntax colouring is specifically then under C/C++->Editor->Syntax Colouring
Please keep us posted.
Best Regards,
Lisa
hi
tank you for :
( The syntax colouring is specifically then under C/C++->Editor->Syntax Colouring ..)
but is no true , on this windows you can modify ONLY the color ! , by I not find a new keyword method !
best regard !
Luca
Hi Carmine,
what exactly do you wish to do? I am a bit confused. In your first post you asked about the syntax colouring .... what do you mean exactly but find a new keyword method? Do yo meant define these items?
Best Regards,
Lisa
HI Carmine,
I think this is likely somethng that actually comes more or less from eclipse. Let me see if I can get an answer for you.
In the mean time, do these topics help?
http://danielbaggio.blogspot.com/2008/07/adding-keywords-to-eclipse-rcp.html
Best Regards,
Lisa
Hi lisa,
tank for your help .
I am ceated plugin.xml in folder :eclipse\plugins
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="org.eclipse.ui.keywords">
<keyword
label="uint8_t uint16_t uint32_t"
id="com.xyz.AppearanceKeywords"/>
</extension>
</plugin>
tested in CCSv4, but eclipse not recognize this !
can you try thi's procedure ??
note : uint16_t ,for me is : #typedef unsigned short uint16_t , etc ets , is a simple type declaration
tank you !
Luca
Hi Luca,
These keywords in the editor have to be added to the current set of keywords that we support, there is no UI that you can contribute these keyword by the end user that I am aware of.
Can you let me know what ISA is your project and a short code snippet illustrating the usage of these keywords?
Regards,
Patrick
Hi Patrick,
here an "useless" snipped code .
/* use thi's declaration for unambiguous type declaration :
* this a good mode.
*/
typedef unsigned char uint8_t ; // 8 bit unsigned
typedef unsigned short uint16_t ; // 16 bit unsigned
typedef unsigned long uint32_t ; // 32 bit unsigned
typedef short int16_t ; // 16 bit signed
// declare vars
uint32_t var_32_bit;
uint16_t var_16_bit;
uint8_t var_8_bit;
//------------------------------------------------------
extern uint16_t empty_snippet( uint8_t pippo);
/* useless code ! */
void snippet_code( void)
{
while( 1)
{
var_16_bit = empty_snippet( var_8_bit++);
var_32_bit = var_16_bit ^3;
}
}
note : add to new keywords in eclipse ( CCSvx ) IDE , is not important feature , MSP430 work very well! .
normally I use this mode , because I developing firmware / application on multi platform ( eg: ARM / MSP430 / STM8 / ARC etc etc )
this way ( type definition ) is very convenient for library, snippet code, ... on my job !
normally , others IDE, integrate this feature !!!!!! ( external file or dedicated menu item )
eg : int var == 16 bit on MSP430, 32 bit on ARM this a mistake in code library !!!!!
really thanks,
Regard
Luca Taraborrelli
Hi Luca,
These are not compiler keywords that I was expecting. In CCSv5. You can configure typedef color by opening the Preferences dialog and select C/C++ / Editor / Syntax Coloring node in the left side tree, then select Typedefs in the list on the right side.

Will this work for you?
Regards,
Patrick
Hi Patrick,
this is a "trick" solution : ok work in CCSv5 ( adequate) , but not in CCSv4!
ok its one solution !
the question :
- integrated editor ha a list of keywords ( unsigned char void return int struct #define ....)
its possible to add a new keyword to the list ???
ex:
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{ }
how to add ( ex BLUE color) the words : " __interrupt" and "vector" or "luca" or "pippo" or "patrick" ??
its a "technical question" !!!!!
Regard
Luca
It is possible to add compiler keywords, i.e __interrupte and vectors, but I have to manually add it to the list that we have. Each keyword has a meaning in the grammar that is understand by the compiler, the C-Scanner will parse the text that you type and it will provides static syntax checking on the fly. Without knowing how each keyword is been use, it is not possible to randomly add a keyword to the list, otherwise, the static syntaix checker will give you many errors in the editor annotation margin.
To do what you ask for, just highlight any word in the editor is not currently supported. I will open a defect to be able to highlight any keywords, but if the keyword does not correctly parsed by the C-Scanner, then you will see the error icon in the editor annotation margin.
CQ: SDSCM00043165
Regards,
Patrick