
Awesome! It looks quite nice, though it takes ages to compile. Would this be suitable for a text editor? One issue with text editors is you don't want to reprocess the entire file for each highlight. This, combined with multi-line syntactic elements, such as multiline strings or comments, makes for a rather awkward combination. It becomes a bit harder to predict the scope, highlighting wise, of editing actions. It may not really be necessary to do this very well. I for one find it annoying when you introduce an opening/closing symbol, it freezes for an instant, and the highlighting of the rest of the document alternates... So perhaps it could check if you're introducting a multiline element at the end when navigating off, re-evaluate highlighting of the rest of the document. Regardless of if the library can handle the requirements of text-editing in its current state, it looks like it wouldn't be too hard to add. Most of the work has been done :) Thanks! -Michael Sloan http://mgsloan.nfshost.com
Hello all,
I've been working on a source code syntax highlighting library. It is now somewhat usable, and help would be welcome in testing it further, so I'm making it publicly available:
darcs get http://johnmacfarlane.net/repos/highlighting-kate
Currently, the following languages are supported:
Ada Asp Awk Bash Bibtex C Cmake Coldfusion Commonlisp Cpp Css D Diff Djangotemplate Doxygen Dtd Erlang Fortran Haskell Html Java Javadoc Javascript Json Latex Lex LiterateHaskell Lua Makefile Matlab Mediawiki Nasm Objectivec Objectivecpp Ocaml Pascal Perl Php Postscript Prolog Python Ruby Scala Scheme Sgml Sql SqlMysql SqlPostgresql Tcl Texinfo Xml Xslt Yacc
The parsers for individual languages are automatically generated from Kate syntax definitions. The xml files have been included in the repository, together with the program that converts them to Haskell modules. There's also a standalone program, Highlight, that you can use to test the highlighting. (See README for instructions.)
Bug reports and patches are welcome. Note that I don't want to make any manual modifications to the generated modules in Text/Highlighting/Kate/Syntax. Changes should be made either in the source xml files or in the program ParseSyntaxFiles.hs that generates these modules.
John