highlighting-kate - syntax highlighting library

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

highlighting-kate - syntax highlighting library

John MacFarlane
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

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

RE: highlighting-kate - syntax highlighting library

Michael Sloan
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
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: RE: highlighting-kate - syntax highlighting library

Colin Paul Adams
>>>>> "Michael" == mgsloan  <[hidden email]> writes:

    Michael> Awesome!

    >> 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

Not to me. Where is Eiffel?
--
Colin Adams
Preston Lancashire
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: RE: highlighting-kate - syntax highlighting library

Felipe Lessa
In reply to this post by Michael Sloan
On Feb 3, 2008 6:42 PM, mgsloan <[hidden email]> wrote:
> Would this be suitable for a text editor?

Note that we already have a binding to GtkSourceView, see
http://www.haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-SourceView.html
.

Cheers,

--
Felipe.
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: highlighting-kate - syntax highlighting library

John MacFarlane
In reply to this post by Colin Paul Adams
> Not to me. Where is Eiffel?

I've just added it.  The library is so big already that I left out a
bunch of languages for which there are Kate syntax definitions.  But I'm
happy to add them on request.

John
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: RE: highlighting-kate - syntax highlighting library

Michael Sloan
In reply to this post by Felipe Lessa
Hmm, yeah, I may switch to that.  Probably more practical than writing
a raw editor ontop cairo.  Won't be able to do a few things I was
intending to, but if I want to replace it with custom stuff later I
suppose I can.

That pretty much takes care of 95% of a text editor.

-Michael Sloan
http://mgsloan.nfhost.com

On Feb 3, 2008 1:38 PM, Felipe Lessa <[hidden email]> wrote:

> On Feb 3, 2008 6:42 PM, mgsloan <[hidden email]> wrote:
> > Would this be suitable for a text editor?
>
> Note that we already have a binding to GtkSourceView, see
> http://www.haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-SourceView.html
> .
>
> Cheers,
>
> --
> Felipe.
>
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: RE: highlighting-kate - syntax highlighting library

Duncan Coutts
In reply to this post by Felipe Lessa

On Sun, 2008-02-03 at 19:38 -0200, Felipe Lessa wrote:
> On Feb 3, 2008 6:42 PM, mgsloan <[hidden email]> wrote:
> > Would this be suitable for a text editor?
>
> Note that we already have a binding to GtkSourceView, see
> http://www.haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-SourceView.html

BTW, if anyone wants to update this binding to the GtkSourceView 2.x api
that'd be great. The api has not changed much so the changes should be
pretty simple. The advantage is that the 2.x version has a much better
highlighting engine which allows more accurate highlighters.

Duncan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe