Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Creating a new extended C Editor using cdt

Hi Mike,

thank you for your response.
Well I am assuming that I have to create a Plugin based project in Eclipse for the method you have defined.So by following this approach I can be able to create a Plugin Editor which can highlight the C language keywords but also my new Keywords.
The other thing is I am new to java and eclipse. If it is possible then Can you send me some reading material or example related to the approach you have defined.

thank you again for help

On Thu, Nov 11, 2010 at 7:21 PM, Mike Kucera <mkucera@xxxxxxxxxx> wrote:

You don't need to extend the CEditor. What you need to do is provide a new language using the ILanguage extension point in the cdt core.

If all you need to do is highlight some new keywords then start by creating an implementation of ICLanguageKeywords. Then extend the GCCLangauge class and override the getAdapter method to return your implementation. Then register your subclass of GCCLangauge with the ILanguage extension point. Then to see the changes open the Language Mappings preference page and map the C content type to your language. With this approach you will get the highlighting but the parser will still treat the keywords as identifiers. If you want the parser to ignore the keywords as well then also override getScannerExtensionConfiguration and have it return a scanner config that has an empty macro defined for each keyword.

Otherwise, if you need more than just highlighting, if your extension adds some new syntax, then you may need to extend the parser or provide your own parser.


Mike Kucera
Java JIT Compiler Development
IBM Toronto
mkucera@xxxxxxxxxx

Inactive hide details for Muhammad Salman ---11/11/2010 01:02:07 PM---Hi,Muhammad Salman ---11/11/2010 01:02:07 PM---Hi,


From:

Muhammad Salman <muhammadsalman83@xxxxxxxxx>

To:

cdt-dev@xxxxxxxxxxx

Date:

11/11/2010 01:02 PM

Subject:

[cdt-dev] Creating a new extended C Editor using cdt




Hi,

I would like to know how can I create a new plugin Text Editor for a extended version of 'C' language. Actually we have extended C Langusge by adding some Key words and my task is to create an editor that can support syntax highlighting and outline features for C language and the new extended keywords.
I have tried to explore this task and till now the following is what I have found ;
I am using Eclipse with java and I have created a new plugin project. I am assuming that if I inherit my Editor class with CEditor(provided by CDT) then all the features(syntax Highlighting) of the C language will start showing in my new editor. Now from here I have to code in such a way that new keywords should also be syntax highlighted.
I donot know how to implement it because I am new in Eclipse. Kindly help me in this matter.

Waiting for your response.
--
regards,
Muhammad Salman
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev




--
regards,
Muhammad Salman

Back to the top