Re: syntax highlighting

Ben <2blkbelt nemontel net> wrote (Fri, 28 Aug 2015 10:55:54 -0600):
Thank you hohe72, that was very helpful. The documentation
I have does not mention the \s escape, and further, it
specifically declares that regex wasn't going to be forthcoming,
so I wasn't thinking about trying other regex-like

I wonder what else is lurking in there,

It's lurking at the existing syntax definitions in the sub directory
'mcedit'. Once there was a chapter at the [F1]-help but I didn't found
it yet.

Provided as is/ happy hacking:

(This file have to be included in <mc-cfg-path>/mcedit/Syntax.)
context default

  keyword \t*\n brown

  keyword P\[123\]P cyan
  keyword L\{123\}L brightcyan

# the 'whole' keyword matters
  keyword whole I*I red
  keyword whole O+O brightred

wholechars 0123456789=
context  >1>  <1<  magenta
  keyword whole I*I red
  keyword whole O+O brightred

wholechars 0123456789
context  >2>  <2<  blue
  keyword whole 111 brightblue

wholechars 0123456789()
context  >3>  <3<  green
  keyword whole 111 brightgreen

source file (contains TABs):
PP P1P P22P P333P P4444P        \[\] regex: P[123]*P
LL L1L L22L L333L L4444L        \{\} regex: L[123]L

    II I1I I22I I3=3I           '*' interpolates everything
    OO O1O O22O O3=3O           '+' interpolates regular chars
1> OO O1O O22O O3=3O <1<       '+'
At default context '=' is not a regular character. However
I changed that for context #1.

2> (111) [111] <2<     braces are delimeters
3> (111) [111] <3<     braces are regular chars
In context #2 braces '(' and ')' aren't regular characters.
So 'whole' takes them being delimiters. In context #3 they
are enlisted as regular characters, such that '111' don't

undocumented. What a shame we can't use regex,

even if you have regex, you cannot match the declaration of a C
function. Therefore it's more promising to highlight less than all.
Further effort made, should support migration of syntax highlighting
definitions to other editors.

anyway. It's trivial
to implement a good deal of it, and it's quite fast, too. Oh well. :)

Much appreciated!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]