Hi,
Is there an existing extension to add fortran syntax highlighting to Komodo Edit? I use Komodo Edit for my python code all the time, and would like to use it for fortran as well.
Else, is there a tutorial somewhere to demonstrate how to add support for a new language to Komodo Edit? I don't want autocompletion etc., just syntax highlighting and indenting. I found a tutorial at http://blogs.activestate.com/2007/01/kid_adding_a_ne but if it doesn't work for Komodo 4.2, I doubt it will work for version 5.2.1. Is there a more updated tutorial somewhere?
Thanks,
Sourish
You could try running [koext help] and [koext gettingstarted]
(koext is in the sdk folder of your Komodo install directory.
I imagine that Fortran colorizing might be non-trivial, given
everything else I've heard about the language (white-space is
ignored everywhere, to the point that it isn't used for
delimiting tokens).
UDL focuses on colorizing, but it also gives you the a
skeleton language service, in which you would implement
code like indentation. Most of Komodo's indentation is
table-driven, but again from what I know about Fortran
(in particular that C and Algol were structured reactions
against it), I expect Fortran auto-indentation to be
non-trivial. You could look at koRubyLanguage.py to see
how to do keyword-based indentation (as opposed to brace-driven).
- Eric
Having a sample would really help. For example, I think I could take the syntax highlighting rules of C/C++ and modify them for Fortran (instead of starting from scratch). I mention C/C++ because there too white spaces are ignored, indentation is purely for visual clarity, etc. (just like Fortran).
So is there a UDL definition for C/C++ that I can copy and modify?
-Sourish
Komodo includes a colorizer for Fortran (actually "Fortran 77"),
and by default maps *.f and *.for files to it. We don't do any kind
of auto-indentation though.
What extension are you using?
- Eric
The maya extension is based on C/C++ rules, so you may find that an easy extension to modify, see:
http://svn.openkomodo.com/openkomodo/browse/addons/maya/
You can checkout this code using:
Cheers,
Todd
Then perhaps I won't need to write my own colorizer.
Alternatively, how can I copy the colorizing rules for Fortran 77, modify them, and associate them with a new file extension?
-Sourish
See [Preferences|File Associations|New Association]
There are no "rules" for the Fortran colorizer -- it's done
in C++ code. You *could* write a new colorizer and submit
it to the scintilla project, but I think that would be overkill.
On the other hand, if you have some thoughts on how indentation
should work for Fortran, that will take some Python code, in
koFortranLanguage.py.
- Eric