[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Parsing Objective C syntax in a header file

The problem you're going to run into is that there is no good mechanism to arbitrate content types in the platform. The given file will be considered to be of all the valid content types for it, but a lot of clients will probably ask for just the "preferred" content type for the file. This probably means that the CDT definition for "cHeader" wins, as it's lexigraphically less than yours, and hence found first.

Language mapping settings, as Mike has indicated, should influence which parser gets invoked on the file, but this won't affect other things such as which editor is opened by default on the file, etc.

===========================
Chris Recoskie
Team Lead, IBM CDT and RDT
IBM Toronto
Inactive hide details for Alex Blewitt <alex.blewitt@xxxxxxxxx>Alex Blewitt <alex.blewitt@xxxxxxxxx>


          Alex Blewitt <alex.blewitt@xxxxxxxxx>
          Sent by: cdt-dev-bounces@xxxxxxxxxxx

          07/09/2009 09:26 AM

          Please respond to
          "CDT General developers list." <cdt-dev@xxxxxxxxxxx>

To

"CDT General developers list." <cdt-dev@xxxxxxxxxxx>

cc


Subject

[cdt-dev] Parsing Objective C syntax in a header file

I'm working on resolving .h as an objective c header file (instead of  
a c/c++ header), but at the moment, it thinks .h files are C files.

http://code.google.com/p/objectiveclipse/issues/detail?id=25

The extension point defines the file extension as an objcHeader (based  
on objcSource):

 <extension
       point="org.eclipse.core.contenttype.contentTypes">
    <content-type
          base-type="org.eclipse.cdt.objc.core.objcSource"
          file-extensions="h"
          id="org.eclipse.cdt.objc.core.objcHeader"
          name="%objc.header.name"
          priority="high">
    </content-type>
 </extension>

These are then associated with the language:

   <extension
       point="org.eclipse.cdt.core.language">
    <language
          class="org.eclipse.cdt.objc.core.dom.ast.objc.ObjCLanguage"
          id="org.eclipse.cdt.objc.core.objcLanguage"
          name="%objc.language.name">
       <contentType
             id="org.eclipse.cdt.objc.core.objcHeader">
       </contentType>
       <contentType
             id="org.eclipse.cdt.objc.core.objcSource">
       </contentType>
    </language>
 </extension>

Creating a new file.h within an objective c project results in Eclipse  
defaulting to 'C header type' (as seen by right-clicking on the file  
and going to properties). I don't know how to get it recognised as an  
Objective-C header file instead, without which, the parser doesn't  
seem to be kicked in.

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

GIF image

GIF image

GIF image