From d159ad48390373ff52e64aa679e477716a290607 Mon Sep 17 00:00:00 2001 From: YueLiPicasso Date: Wed, 14 Sep 2022 17:54:35 +0800 Subject: [PATCH] initial --- .gitignore | 2 + README.md | 44 ++++++++++++- catala.lang | 131 ++++++++++++++++++++++++++++++++++++++ test.catala_en | 169 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 344 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 catala.lang create mode 100644 test.catala_en diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c26bd7a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# emacs backupfile +*~ diff --git a/README.md b/README.md index a8ee225..7bd8718 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,42 @@ -# Catala-gedit-syntax-highlighting -GEdit syntax highlighting for Catala +# GEdit syntax highlighting for Catala + +This is to support syntax highlighting of English Catala code in GEdit. + +The code is modelled after the [Catala syntax highlighting code for the iro compiler](https://github.com/CatalaLang/catala/blob/e7c3ef604e1862dee82a1395ee2a1ea6beb5f9a2/syntax_highlighting/en/catala_en.iro). + + +## How to use + +Copy the file [catala.lang](catala.lang) to the directory below (create if it does not exist) and then +restart GEdit. +``` +~/.local/share/gtksourceview-4/language-specs +``` + +I use [test.catala_en](YCatala.catala_en) as a test file. + +## Reference + +Here I collect further resources which helped me write the code. + + +The posts below basically say that to provide gedit syntax highlighting support we simply need to write a XML file specifiying the syntax and put it under the gedit syntax highlighting directory. +``` +https://unix.stackexchange.com/questions/4203/how-can-i-write-a-new-syntax-highlighter-for-gedit +https://askubuntu.com/questions/55494/how-do-i-add-a-syntax-highlighter-format-to-gedit +https://github.com/thomasysliu/Gedit-SPICE-syntax-highlighting +``` + +Below is a trouble shooting Q&A from a user who successfully added a custom syntax highlighting extension to gedit. +``` +https://askubuntu.com/questions/295559/how-to-add-a-new-language-definition-for-syntax-highlighting-in-gedit +``` + +The definitive guide. +``` +https://developer-old.gnome.org/gtksourceview/stable/syntax-highlighting-reference.html +``` + + + + diff --git a/catala.lang b/catala.lang new file mode 100644 index 0000000..9394ad2 --- /dev/null +++ b/catala.lang @@ -0,0 +1,131 @@ + + + + + + text/x-catala + *.catala_en + + + +