[exim] Exim configuration syntax highlighting for joe

Góra strony
Delete this message
Reply to this message
Autor: jori.hamalainen
Data:  
Dla: exim-users
Temat: [exim] Exim configuration syntax highlighting for joe
I got tired of single-color-hard-to-read-text on editor when configuring
exim - so I quickly implemented in syntax highlighting into joe (Joe's
Own Editor) state machine. However working with Exim config file is not
that simple, as configuration syntax is not the best possible. This
highlighting works at least with Joe-3.7

- For example ACL's "set acl_m_test" it is hard to have "acl_m_test" to
be highlighted as variable, normally variables are identified with "$"
starting the name. Why not after set?
- "def:" requires just some variable/header to be checked - without $.
For syntax highlighting it would be easier to have "$" as well.
- In theory it would be possible to build better coloring of "string
expansion" but it would have taken time and I am not paid to do it :)

So please consider as feature request to standardize syntax to use $ for all
varibles and everywhere.

Example "what-you-see"
http://www.jori.ws/images/exim_syntax_hl.gif

BR,
Jori

------

Add to file /etc/joe/ftyperc, this config example captures *.conf to exim.
Perhaps some more clever way could be used to identify that this is exim
config file. If you don't like to capture *.conf, you can also manually
enable exim-syntax by entering after joe has loaded the file
"^T Y exim [enter]".

----------------
Exim configuration
*.conf
-autoindent
-syntax exim
----------------

Copy this file to /usr/share/joe/syntax/exim.jsf
----------------
# JOE syntax highlight file for Exim configuration
#
# v0.1: Jori Hamalainen - basic highlighting
#
# Define colors

=Value
=Comment green
=Keyword bold
=Var yellow
=Macro cyan
=Regexp yellow

# State machine

:ident Keyword
        *       ident
        "#"     comment noeat
        "="     value noeat
        "."     macro noeat


:comment Comment
        *       comment
        "\n"    ident


:value Value
        *       value
        "\n"    ident
        "#"     comment noeat
        "$"     variable recolor=-1
        "\\"    value_nextline


:value_nextline Value
        *       value
        "\n"    value # found "\'\n'" so value is continueing on the next
line
        "N"     regexp # found "\N" start of regexp quote


:regexp Regexp
        *       regexp
        "\\"    regexp_out


:regexp_out Regexp
        *       regexp
        "N"     value recolor=-2 # found \N


:variable Var
        *       value noeat
        "{"     value recolor=-2
        "\\"    value recolor=-2
        "a-zA-Z0-9_"    variable


:macro Macro
        *       value
        "a-zA-Z."       macro
-----------------