DervishD schrieb:
Hi all :))
I'm trying to fully understand the syntax commands, and when doing
tests a question popped up in my mind: let's say I have a region which
starts with something like "\I\i*{" and ends with "}". For example, the
example below will match:
strange{contents}
BUT, the below is valid for the filetype, too:
morestrange{content with words and {}, surprise!}
Of course, with something like this:
syntax region SomeRegion start="\I\i*{" skip="{[^}]*}" end="}"
I'm able to highlight the example above, without having "{}" end the
region. The problem here comes when I want to highlight the part between
the braces in a different color. I've tried this, to (by the moment)
only highlight *braces* within those braces:
syntax region SomeRegion start="\I\i*{" skip="{[^}]*}" end="}"
\ contains=Inner
syntax match Inner "{[^}]*}" contained
But this performs the following highlighting:
example{with some contents}
^^^^^^^++++++++++++++++++++
example{with another pair of braces {}}
^^^^^^^+++++++++++++++++++++++++++++++^
That is, the contained item is "swallowing" part of the "start"
match!. I thought that when the match for "start" was performed, the
matched test wasn't tried for any other match, including "contained"
items. Obviously, I was wrong (or I misunderstood the entire issue), and
I don't know if, just using regions, I can have a match like this:
example{{weird} and some mor{}e text}
^^^^^^^^++++++++++++++++++++++++++++^
that is, that the first opening brace is not "swallowed" by the
contained syntax item. As you can see, the contained item must be
allowed to start with "{".
Thanks a lot in advance and sorry for the weird question O:)))
Raúl Núñez de Arenas Coronado
:h :syn-matchgroup
| In a start or end pattern that is highlighted with "matchgroup" the
| contained items of the region are not used. This can be used to avoid
e.g.
syntax region SomeRegion matchgroup=SomeRegion start="\I\i*{" ...
HTH,
Andy
--
EOF
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de