Adding syntax highlighting for new languages to Eclipse with the Colorer library

 

You are reading the old blog! This post has been moved to http://www.ohadsoft.com/2012/05/adding-syntax-highlighting-for-new-languages-to-eclipse-with-the-colorer-library/

 

Say you have an HRC file containing the syntax and lexical structure of some programming language Eclipse does not support (for example D).

Using the EclipseColorer plugin, you can easily add support for it. For this tutorial I’ll be using Eclipse Classic 3.7.2 32-bit.

  1. Go to Help -> Install New Software and click Add..
  2. In the Name field write Colorer and in the Location field write http://colorer.sf.net/eclipsecolorer/
  3. Select the entry you’ve just added in the work with: combo box, wait for the component list to populate and click Select All
  4. Click Next and follow the instructions
  5. Once the plugin is installed, close Eclipse
  6. Copy your HRC file to [EclipseFolder]pluginsnet.sf.colorer_0.9.9colorerhrcautotypes
  7. Use your favorite text editor to open [EclipseFolder]pluginsnet.sf.colorer_0.9.9colorerhrcautoempty.hrc
  8. Add the appropriate prototype element. For example, if your HRC file is d.hrc, empty.hrc  will look like this:
     <?xml version="1.0" encoding='Windows-1251'?>
     <!DOCTYPE hrc PUBLIC
     "-//Cail Lomecb//DTD Colorer HRC take5//EN"
     "http://colorer.sf.net/2003/hrc.dtd"
     >
     <hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd"
     ><annotation><documentation>
     'auto' is a place for include
     to colorer your own HRCs
    </documentation></annotation>
    <prototype name="d" group="main" description="D">
     <location link="types/d.hrc"/>
     <filename>/.(d)$/i</filename>
     </prototype>
    </hrc> 
  9. Save the changes and close the text editor
  10. Open Eclipse and go to Window -> Preferences -> General -> Editors -> File Associations
  11. In the file types section, click Add.. and fill in the appropriate filetype (for example .d)
  12. Click OK and click your newly added entry in the list
  13. In the associated editors section, click Add.., select Colorer Editor and press OK

All done! Now you can open your new language files in Eclipse and enjoy syntax highlighting and parsing.

Adding new language support to FAR manager (plugin) and Midnight Commander (plugin) is similar.

References

http://colorer.sourceforge.net

http://colorer.sourceforge.net/eclipsecolorer/

http://colorer.sourceforge.net/other/Color5Eclipse_Newlanguagedoc.html

http://thecybershadow.net/d/colorer/

http://mcnptips.blogspot.com/2011/08/mcnp-input-file-syntax-for-farcolorer.html

http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-124.htm

Advertisements

3 Responses to “Adding syntax highlighting for new languages to Eclipse with the Colorer library”

  1. WinRABCDAsm – Flash ABC (ActionScript Bytecode) disassembly and reassembly made easy « Programs & Programming Says:

    […] Double click to open it in your favorite editor, and make your changes (for syntax highlighting use asasm.hrc in Eclipse) […]

    Like

  2. Health Maintenance Organizations Says:

    Hi there would you mind sharing which blog platform you’re using? I’m planning to start
    my own blog in the near future but I’m having a difficult time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something completely unique.
    P.S Apologies for being off-topic but I had to ask!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: