Syntax highlighting for AutoIt

Home Forums cherrytree Syntax highlighting for AutoIt

Tagged: ,

This topic contains 6 replies, has 4 voices, and was last updated by  acry 6 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1912

    robinsiebler
    Member

    I’d like to request syntax highlighting for AutoIt (http://www.autoitscript.com). There is already plenty of syntax highlighting files out there for the language, it would simply be a matter of tweaking the format of one of these files to match whatever format your lexer uses.

    Thanks!

    #1914

    giuspen
    Moderator

    Hi,
    the syntax highlighting languages come from the library
    http://projects.gnome.org/gtksourceview/
    in version 2.x (for gtk 2.x) then it should be possible to add new languages reading the documentation. I’ll add to the TODO list but don’t know when I’ll have time to take care.
    Cheers.

    #1921

    robinsiebler
    Member

    Actually, I found a syntax file for gtksourceview already created. However, I can’t figure out how to get the new option to show up in cherrytree. Is there some file I have to edit or is it hardcoded?

    AutoIt lang file – http://www.autoit.de/index.php?page=Thread&threadID=12670

    #1925

    giuspen
    Moderator

    The list of available languages comes directly from a call to the library at application start. I’s not hardcoded and there’s no file to edit. All you have to do is to add the language to the installed library (I can’t help you with this now), cherrytree will then see it and list it.

    #125025

    BarryBKS
    Member

    Hi,

    I am trying to track down a LANG file for Au3 (AutoIT), so I can add it to CherryTree.

    I came across this thread and I have tried the above link, but it would appear that that thread is no longer accessible.

    Could someone please let me know if there is a current LANG file which I can use?

    Cheers,

    Barry.

    #125026

    acry
    Member

    Extra GtkSourceView language definitions
    https://wiki.gnome.org/Projects/GtkSourceView/LanguageDefinitions

    Language Definition v2.0 Tutorial
    https://developer.gnome.org/gtksourceview/stable/lang-tutorial.html

    A AutoIt 3 language definition file
    http://mirror.hmc.edu/ctan///support/highlight/langDefs/au3.lang

    Cheers,
    Cass aka Acry

    #125190

    acry
    Member

    Hi Barry,
    don’t know if you are still interested in the language definition of AutoIt, but:

    The language definition file I posted before is from highlight, which I use for Shell-Syntax-Highlighting. It is now hosted here:
    https://gitlab.com/saalen/highlight/tree/master/langDefs

    Both language definition file (ldf) formats use Regular Expressions, but you do not have to mess with them, just copy and paste. It’s really just the layout of the file.

    I contacted the author André Simon asking for a convert script, waiting for an answer.

    Today I used a sourceview4 ldf (markdown) in pygtksourceview2.
    GtkSourceView 2, 3 and 4 have the same language definition file format.

    So either you put the ldf in a path reachable for pygtksourceview2 or CT’s source need a slight change:
    You have to preserve the Gtk.SourceLanguageManager’s original search path when you add your own.
    Append to it instead of replacing it.

    I provide the language file in the demodir.
    The relevant code is:

        lm = gtksourceview2.LanguageManager()
        pathes = lm.get_search_path()
        path = DEMODIR
        pathes.append(path)
        lm.set_search_path(pathes)
        id = lm.get_language('markdown')
        self.inbuffer.set_language(id)
        self.inbuffer.set_highlight_syntax(True)

    Cheers,
    –Cass

    • This reply was modified 6 months ago by  acry.
    • This reply was modified 6 months ago by  acry.
Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.