Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Attempting to make a Cosmic C Language Extension

Hello Peter,

I did something similar for another compiler:
- used language extension point to create new langage extending GCCLanguage
- the new language refers to an own ScannerExtensionConfiguration and ParserExtensionConfiguration
- added the language mapping to the project configuration

However, I think that there may be a bug in your CosmicCLanguage Class. I think you must implement the method getDefault() to return an instance of your language. I did it like this:

    private static MyLanguage DEFAULT = new MyLanguage();
    public static MyLanguage getDefault() {
        return DEFAULT;

In your case it alway uses the getDefault of the super class and will therefore use GCCLanguage and it's configuration.

regards, Sebastian

To: cdt-dev@xxxxxxxxxxx
Date: Fri, 22 Mar 2013 07:19:34 -0800
From: peter.watkins@xxxxxxxxxxxxx
Subject: Re: [cdt-dev] Attempting to make a Cosmic C Language Extension

So part of my problem was that CosmicCScannerExtensionConfiguration was a singleton but I wasn't calling it as one (nor had I quite coded it as one). The end result is still the same (@far isn't recognized).

By the way, let me know if I should be posting this question in a different list.

From:        "Peter Watkins" <peter.watkins@xxxxxxxxxxxxx>
To:        cdt-dev@xxxxxxxxxxx,
Date:        03/21/2013 03:15 PM
Subject:        [cdt-dev] Attempting to make a Cosmic C Language Extension
Sent by:        cdt-dev-bounces@xxxxxxxxxxx

After reading, I'm trying to make a new language extension for the Cosmic dialect of C. Mostly the problem is "@" keywords such as @far. I've looked at bug #237028, and I also went off Mike Kucera's message to this group, "Re: [cdt-dev] How to extend the C99 / GCC LR Parser." on 11-Jul-2011 in which he suggests using an ILanguage extension point and providing my own configuration that implements IScannerExtensionConfiguration and defines supportAtSignInIdentifiers().

I've made the language plugin consisting of, CosmicCLanguage.Java, and I can choose my new language under Language Mappings in the CDT. However the parser still trips up over @far. Here's my parser log (I've deleted some lines to make it smaller):

_______________________________________________ cdt-dev mailing list cdt-dev@xxxxxxxxxxx

Back to the top