From 02bda3ab38c93466ef1204dd70cdac33d006795a Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 20 Sep 2011 12:41:32 +0000 Subject: [PATCH] Created a new page documenting available editor modes for GF Also adding editing modes for Gedit and Geany contributed by John J. Camilleri. --- doc/gf-editor-modes.t2t | 64 +++++++++ doc/index.html | 5 + index.html | 1 + src/tools/dark-filetypes.GF.conf | 37 ++++++ src/tools/gf.lang | 211 ++++++++++++++++++++++++++++++ src/tools/light-filetypes.GF.conf | 33 +++++ 6 files changed, 351 insertions(+) create mode 100644 doc/gf-editor-modes.t2t create mode 100644 src/tools/dark-filetypes.GF.conf create mode 100644 src/tools/gf.lang create mode 100644 src/tools/light-filetypes.GF.conf diff --git a/doc/gf-editor-modes.t2t b/doc/gf-editor-modes.t2t new file mode 100644 index 000000000..a511d9b19 --- /dev/null +++ b/doc/gf-editor-modes.t2t @@ -0,0 +1,64 @@ +Editor modes for GF + + +%!style:../css/style.css +%!options(html): --toc +%!postproc(html):

+ +We collect GF modes for various editors on this page. Contributions are +welcome! + +==Emacs== + +[gf.el ../src/tools/gf.el] by Johan Bockgård provides syntax highlighting and +automatic indentation and lets you run the GF Shell in an emacs buffer. +See installation instructions inside. + + +==Gedit== + +[John J. Camilleri http://johnjcamilleri.com/] +provided the following syntax highlighting mode for +[Gedit http://www.gedit.org/] (the default text editor in Ubuntu). + +Copy the file below to +``~/.local/share/gtksourceview-2.0/language-specs/gf.lang`` (under Ubuntu). + +- [gf.lang ../src/tools/gf.lang] + + +Some helpful notes/links: + +- The code is based heavily on the ``haskell.lang`` file which I found in + ``/usr/share/gtksourceview-2.0/language-specs/haskell.lang``. +- Ruslan Osmanov recommends + [registering your file extension as its own MIME type http://osmanov-dev-notes.blogspot.com/2011/04/how-to-add-new-highlight-mode-in-gedit.html] + (see also [here https://help.ubuntu.com/community/AddingMimeTypes]), + however on my system the ``.gf`` extension was already registered + as a generic font (``application/x-tex-gf``) and I didn't want to risk + messing any of that up. +- This is a quick 5-minute job and might require some tweaking. + [The GtkSourceView language definition tutorial http://developer.gnome.org/gtksourceview/stable/lang-tutorial.html] + is the place to start looking. +- Contributions are welcome! + + +==Geany== + +[John J. Camilleri http://johnjcamilleri.com/] provided the following +[custom filetype http://www.geany.org/manual/dev/index.html#custom-filetypes] +config files for syntax highlighting in [Geany http://www.geany.org/]. + +Copy one of the files below to ``/usr/share/geany/filetypes.GF.conf`` +(under Ubuntu). You will need to manually create the file. + +- [light-filetypes.GF.conf ../src/tools/light-filetypes.GF.conf] +- [dark-filetypes.GF.conf ../src/tools/dark-filetypes.GF.conf] + + +You will also need to edit the ``filetype_extensions.conf`` file and add the +following line somewhere: + +``` +GF=*.gf +``` diff --git a/doc/index.html b/doc/index.html index 1accf3fe6..3d2cda8dc 100644 --- a/doc/index.html +++ b/doc/index.html @@ -52,6 +52,11 @@ Describes the commands available in the interactive GF shell. Also summarizes how to run GF as a batch compiler. +
  • + Editor modes for GF. + Editor modes for GF provides syntax highligting, automatic indentation and + other features that makes editing GF grammar files easier. + diff --git a/index.html b/index.html index 4ec66fb69..1036e9e1a 100644 --- a/index.html +++ b/index.html @@ -33,6 +33,7 @@ December 2010 | Publications | QuickRefCard | GF Shell Reference +| GF Editor Modes | LibTutorial | MOLTO | SummerSchool diff --git a/src/tools/dark-filetypes.GF.conf b/src/tools/dark-filetypes.GF.conf new file mode 100644 index 000000000..f1ffae48b --- /dev/null +++ b/src/tools/dark-filetypes.GF.conf @@ -0,0 +1,37 @@ +# This file written by John J. Camilleri, June 2011 +# Geany documentation ref: http://www.geany.org/manual/dev/index.html#custom-filetypes + +[styling] +# foreground;background;bold;italic +default=0xffffff;0x1E1E1E;false;false +commentline=0x747474;0x1E1E1E;false;false +commentblock=0x747474;0x1E1E1E;false;false +commentblock2=0x747474;0x1E1E1E;false;false +commentblock3=0x747474;0x1E1E1E;false;false +number=0x7ECDFF;0x1E1E1E;false;false +keyword=0xFFCA4A;0x1E1E1E;true;false +import=0x8C2421;0x1E1E1E;false;false +string=0xA18651;0x1E1E1E;false;false +character=0xA18651;0x1E1E1E;false;false +class=0xB2A886;0x1E1E1E;True;false +operator=0x98BAC5;0x1E1E1E;true;false +identifier=0xffffff;0x1E1E1E;false;false +capital=0x7BB25A;0x1E1E1E;false;false +module=0xAD7DAD;0x1E1E1E;false;false +data=0x5ABEFF;0x1E1E1E;false;false + +[keywords] +keywords=PType Str Strs Type abstract case cat concrete data def flags fun in incomplete instance interface let lin lincat lindef of open oper param pre printname resource strs table transfer variants where with + +[settings] +extension=gf + +comment_single=-- +comment_open={- +comment_close=-} +comment_use_indent=true + +#tag_parser=GF +lexer_filetype=Haskell + +[build_settings] diff --git a/src/tools/gf.lang b/src/tools/gf.lang new file mode 100644 index 000000000..6ddd37fb8 --- /dev/null +++ b/src/tools/gf.lang @@ -0,0 +1,211 @@ + + + + + text/x-gf;text/plain + *.gf + + + +