Last couple of days (and months) I was secretly working on a new widget
for text editing under FLTK,
Fl_Highlight_Editor.
FLTK is missing a good editing widget with code highlighting capabilities,
so I gave it a shot adding some new concepts; not
revolutionary, but how many text widgets comes with a scripting
language? ;)
Having extensible editing facility, where you can easily add new
language support without digging in C/C++ code isn't common. My
favorite, Scintilla isn't
ready for FLTK (actually there is no available port for FLTK) and all syntax
highlighting capabilities are added by subclassing C++ classes. Means, you
have to recompile your binary if you want to add or modify something.
So, I tried to find inspiration in editor of all editors, Emacs. Sure,
that >50 MB monster isn't model for embedding, but some concepts
like small core and everything else written in extensible language
sounds quite interesting. By using similar design, widget user can easily remove
parts it doesn't like or only add one he/she likes. For example, editing and highlighting support
only for language X, where scripts could be embedded in binary (or not).
Scripting language I used is Scheme; better say TinyScheme, which is
still the only awesome interpreter I could find, bundled inside 4
files, that doesn't suck. Extensible language (the language which you
can extend without digging inside interpreter) where code is data, is
a great deal: you can easily experiment with the syntax, have so
called configuration files without external libraries or
additional code and the best of all, have fun using it.
Initial Fl_Highlight_Editor version comes with modes for C/C++,
Python, Scheme and Markdown; not advanced as Emacs modes, but capable
enough to highlight known patterns and setup TAB width depending on
language. Sure, there is a lot of work, but ultimate goal is to keep
the whole package simple, but flexible enough for adding new features.
Happy usage :)