Sorry for duplicating, but my mailer for some reason removed several
spaces from my "pictures".
Yakov Lerner wrote:
On 9/3/06, Ilya <[EMAIL PROTECTED]> wrote:
Yakov Lerner wrote:
> When I removed both 'keepend' and 'extend', it
> started to work as expected.
No, it would not work as I want it to. Block would not end unclosed
String. Like this:
{ Some string with a quote ( " ) inside }
Ah, I have a guess what can be the problem. Maybe
region does not like it when ending pattern (["]) is same as
beginning pattern. It does not know then whether to treat 2nd
double-quote as a beginning of new nested
region (string), or end of previous block (string).
I do not understand how ending pattern for the String region could be
connected to my case, could you please explain in more detail what is
your point?
Note that I want `" ) inside ' to be highlighted as a String, but with
`}' String highlight should stop. And this could be easily achieved
with proposed solution. Problem arises only when String contains
Identifier. In this case Identifier region ends also enclosing a String
region, but not enclosing Block region. Here is picture:
{ "string ${var} string" }
BBBBBBBBBBBBBBBBBBBBBBBBBB
SSSSSSSSSSSSSS SS
IIIIII
B - Block region
S - String region
I - Identifier region
I believe that matching could be as follows:
{ "string ${var} string" }
BBBBBBBBBBBBBBBBBBBBBBBBBB
SSSSSSSSSSSSSSSSSSSSSS
IIIIII
Here is a picture for Block that contains only one quote. It is
perfectly legal and match my expectations:
{ string with a quote ( " ) inside }
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
SSSSSSSSSSS
Maybe you should try
'syn match' for both strings and identifiers.
I've tried using match for both the String and the Identifier - there is
absolutely no difference from using two regions or using one region and
one match.
(nested 'syn match'). Maybe you should look into perl.vim
how it does it.
I'll gladly look there, but could you please be more specific? Where in
Perl syntax there is such a situation when outer block ends all
contained blocks of different type? I've used perl syntax highlight for
some time and I cannot remember if I thought something similar there and
rereading and understanding whole syntax highlight scheme, I believe, is
quite a bit of work...
In Perl "everything" could be understood from syntax. There is no need
to "force" some region to end "unexpectedly". I'm trying to improve Tcl
highlight - there you could not tell whether some Block contains code
and thus should be highlighted appropriately or it contains some
arbitrary data that does not follow any of the Tcl code rules or follow
some "other code" rules (like been SQL code), without evaluation program
itself.
Yakov