On Thursday, May 30, 2013 2:42:26 AM UTC+9, Bram Moolenaar wrote:
> Hiroshi Shirosaki wrote:
> > I noticed a syntax highlighting issue with filetype=html.
> > test.html contains the following one line.
> > <script ><![CDATA[]]>
> >
> > When opening test.html, "[CDATA[]]" is highlighted as error with set re=0.
> >
> > But "[CDATA[]]" is not highlighted as error with set re=1.
>
> I didn't have a HTML file in my syntax file collection yet. I added one
>
> from Vim docs (not very diverse though). I added your line and can see
>
> the difference. I'll find out how to fix it.
>
It seems related to regexp '\_[^>]*'. Emitting end-of-line pattern would be
wrong with negated collection.
I attached a patch for this.
Thank you.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -1198,32 +1198,32 @@ collection:
if (*regparse == '-') /* if last, '-' is just a char */
{
EMIT('-');
TRY_NEG();
EMIT_GLUE();
}
mb_ptr_adv(regparse);
- if (extra == ADD_NL) /* \_[] also matches \n */
- {
- EMIT(reg_string ? NL : NFA_NEWL);
- TRY_NEG();
- EMIT_GLUE();
- }
-
/* skip the trailing ] */
regparse = endp;
mb_ptr_adv(regparse);
if (negated == TRUE)
{
/* Mark end of negated char range */
EMIT(NFA_END_NEG_RANGE);
EMIT(NFA_CONCAT);
}
+
+ if (extra == ADD_NL) /* \_[] also matches \n */
+ {
+ EMIT(reg_string ? NL : NFA_NEWL);
+ EMIT(NFA_OR);
+ }
+
return OK;
} /* if exists closing ] */
if (reg_strict)
{
syntax_error = TRUE;
EMSG_RET_FAIL(_(e_missingbracket));
}
diff --git a/src/testdir/test64.in b/src/testdir/test64.in
--- a/src/testdir/test64.in
+++ b/src/testdir/test64.in
@@ -339,16 +339,20 @@ STARTTEST
:"""" Look-behind with limit
:call add(tl, [0, '<\@<=span.', 'xxspanxx<spanyyy', 'spany'])
:call add(tl, [0, '<\@1<=span.', 'xxspanxx<spanyyy', 'spany'])
:call add(tl, [0, '<\@2<=span.', 'xxspanxx<spanyyy', 'spany'])
:call add(tl, [0, '\(<<\)\@<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
:call add(tl, [0, '\(<<\)\@1<=span.', 'xxspanxxxx<spanxx<<spanyyy'])
:call add(tl, [0, '\(<<\)\@2<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
:"
+:"""" "\_" prepended negated collection matches EOL
+:call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"])
+:call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"])
+:"
:"""" Run the tests
:"
:"
:for t in tl
: let re = t[0]
: let pat = t[1]
: let text = t[2]
: let matchidx = 3
diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok
--- a/src/testdir/test64.ok
+++ b/src/testdir/test64.ok
@@ -726,16 +726,22 @@ OK 1 - <\@1<=span.
OK 0 - <\@2<=span.
OK 1 - <\@2<=span.
OK 0 - \(<<\)\@<=span.
OK 1 - \(<<\)\@<=span.
OK 0 - \(<<\)\@1<=span.
OK 1 - \(<<\)\@1<=span.
OK 0 - \(<<\)\@2<=span.
OK 1 - \(<<\)\@2<=span.
+OK 0 - \_[^8-9]\+
+OK 1 - \_[^8-9]\+
+OK 2 - \_[^8-9]\+
+OK 0 - \_[^a]\+
+OK 1 - \_[^a]\+
+OK 2 - \_[^a]\+
192.168.0.1
192.168.0.1
192.168.0.1
<T="5">Ta 5</Title>
<T="7">Ac 7</Title>
ghi