Re: syntax highlighting
- From: <hohe72 arcor de>
- To: mc gnome org
- Subject: Re: syntax highlighting
- Date: Sun, 30 Aug 2015 17:29:48 +0200
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
constructs.
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:
<mc-cfg-path>/mcedit/syntaxtest.syntax:
(This file have to be included in <mc-cfg-path>/mcedit/Syntax.)
--->8--->8---
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
--->8--->8---
source file (contains TABs):
--->8--->8---
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
match.
--->8--->8---
undocumented. What a shame we can't use regex,
IMHO,
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!
--Ben
--Holger
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]