[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Syntax coloring of new keywords

Hello, List!

My name is Sergey Smolov and I am need your help. My purpose is to make a syntax highlight for our extension of C++ language. This extension just contain about a one hundred of macro directives with different functionality.

For achieving such purpose I've started developing a plugin. Here is my "plugin.xml":

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
ÂÂ <extension
ÂÂÂÂÂÂÂÂ id="Ñppteskkeywords"
ÂÂÂÂÂÂÂÂ name="CDT Language"
ÂÂÂÂÂÂÂÂ point="org.eclipse.cdt.core.language">
ÂÂÂÂÂ <language
ÂÂÂÂÂÂÂÂÂÂÂ class="cppteskpluginide.Keywords"
ÂÂÂÂÂÂÂÂÂÂÂ id="CppTESKPluginIDE.language1"
ÂÂÂÂÂÂÂÂÂÂÂ name="CppTesKLanguage">
ÂÂÂÂÂ </language>
ÂÂ </extension>
</plugin>

and here is class, that contains necessary keywords:

import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
import org.eclipse.cdt.core.model.ICLanguageKeywords;

public class Keywords extends GCCLanguage implements ICLanguageKeywords
{
ÂÂÂ
ÂÂÂ public Object getAdapter(Keywords keywords)
ÂÂÂ {
ÂÂÂÂÂÂÂ return getAdapter(this);
ÂÂÂ }
ÂÂÂÂÂÂ
ÂÂÂ public String[] getKeywords()
ÂÂÂ {
ÂÂÂ ÂÂÂ String[] array = new String[14];
ÂÂÂ ÂÂÂ
ÂÂÂ ÂÂÂ
/ array elements initialization
ÂÂÂ ÂÂÂ
ÂÂÂ ÂÂÂ return array;
ÂÂÂ }

ÂÂ
ÂÂÂ public String[] getBuiltinTypes()
ÂÂÂ {
ÂÂÂ ÂÂÂ String[] array = new String[4];
ÂÂÂ ÂÂÂ
ÂÂÂ ÂÂÂ
/ array elements initialization
ÂÂÂÂÂÂÂ
ÂÂÂ ÂÂÂ return array;
ÂÂÂ }
ÂÂÂ
ÂÂÂ public String[] getPreprocessorKeywords()
ÂÂÂ {
ÂÂÂÂÂÂÂ String[] array = new String[152];

ÂÂÂÂÂÂÂ // array elements initialization
ÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂ return array;
ÂÂÂ }

The main problem is that it didn't work in proper way, so I'd like to ask you the following question: what is the way for adding new keywords and making them highlighted like C++? May be I miss something?

You will be much obliged if you will help me.
Thanks in advance!
-- 
Sincerely yours,
Sergey Smolov
ISP RAS