Skip to content

Commit

Permalink
minor cleanup to previous fix
Browse files Browse the repository at this point in the history
Move tests to the non UTF file, remove dead code and document
another bugfix
  • Loading branch information
carenas committed Sep 30, 2023
1 parent ab47f88 commit 3368925
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 43 deletions.
11 changes: 0 additions & 11 deletions src/pcre2_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2786,7 +2786,6 @@ int escape;
int i;
BOOL inescq = FALSE;
BOOL inverbname = FALSE;
BOOL next_is_literal = FALSE;
BOOL utf = (options & PCRE2_UTF) != 0;
BOOL auto_callout = (options & PCRE2_AUTO_CALLOUT) != 0;
BOOL isdupname;
Expand Down Expand Up @@ -2882,16 +2881,6 @@ while (ptr < ptrend)
thisptr = ptr;
GETCHARINCTEST(c, ptr);

/* Handle cases where previous processing has determined that the next
character is literal. */

if (next_is_literal)
{
PARSED_LITERAL(c, parsed_pattern);
next_is_literal = FALSE;
continue; /* Next character */
}

/* Copy quoted literals until \E, allowing for the possibility of automatic
callouts, except when processing a (*VERB) "name". */

Expand Down
8 changes: 4 additions & 4 deletions src/pcre2_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1345,10 +1345,10 @@ mode rather than an escape sequence. It is also used for [^] in JavaScript
compatibility mode, and for \C in non-utf mode. In non-DOTALL mode, "." behaves
like \N.
ESC_ub is a special return from check_escape() when, in BSUX mode, \u{ is not
followed by hex digits and }, in which case it should mean a literal "u"
followed by a literal "{". This hack is necessary for cases like \u{ 12}
because without it, this is interpreted as u{12} now that spaces are allowed in
ESC_ub is a special return from check_escape() when, in BSUX mode, \u{ is not
followed by hex digits and }, in which case it should mean a literal "u"
followed by a literal "{". This hack is necessary for cases like \u{ 12}
because without it, this is interpreted as u{12} now that spaces are allowed in
quantifiers.
Negative numbers are used to encode a backreference (\1, \2, \3, etc.) in
Expand Down
17 changes: 17 additions & 0 deletions testdata/testinput2
Original file line number Diff line number Diff line change
Expand Up @@ -3420,6 +3420,23 @@
/^\u{7a}/extra_alt_bsux
zoo

/\u{2}/B,extra_alt_bsux
\x02
\= Expect no match
uu

/\u{}/extra_alt_bsux
u{}

/\u{Q12}/extra_alt_bsux
--u{Q12}--

/\u{ 12}/extra_alt_bsux
--u{ 12}--

/\u{{3}}/extra_alt_bsux
--u{{{}--

/(?(?=c)c|d)++Y/B

/(?(?=c)c|d)*+Y/B
Expand Down
12 changes: 0 additions & 12 deletions testdata/testinput5
Original file line number Diff line number Diff line change
Expand Up @@ -822,18 +822,6 @@
\= Expect no match
\x{1bb1}

/\u{}/extra_alt_bsux
u{}

/\u{ 12}/extra_alt_bsux
--u{ 12}--

/\u{Q12}/extra_alt_bsux
--u{Q12}--

/\u{{3}}/extra_alt_bsux
--u{{{}--

/\u/utf,alt_bsux
\\u

Expand Down
29 changes: 29 additions & 0 deletions testdata/testoutput2
Original file line number Diff line number Diff line change
Expand Up @@ -11358,6 +11358,35 @@ No match
zoo
0: z

/\u{2}/B,extra_alt_bsux
------------------------------------------------------------------
Bra
\x02
Ket
End
------------------------------------------------------------------
\x02
0: \x02
\= Expect no match
uu
No match

/\u{}/extra_alt_bsux
u{}
0: u{}

/\u{Q12}/extra_alt_bsux
--u{Q12}--
0: u{Q12}

/\u{ 12}/extra_alt_bsux
--u{ 12}--
0: u{ 12}

/\u{{3}}/extra_alt_bsux
--u{{{}--
0: u{{{}

/(?(?=c)c|d)++Y/B
------------------------------------------------------------------
Bra
Expand Down
16 changes: 0 additions & 16 deletions testdata/testoutput5
Original file line number Diff line number Diff line change
Expand Up @@ -1744,22 +1744,6 @@ Failed: error 173 at offset 6: disallowed Unicode code point (>= 0xd800 && <= 0x
\x{1bb1}
No match

/\u{}/extra_alt_bsux
u{}
0: u{}

/\u{ 12}/extra_alt_bsux
--u{ 12}--
0: u{ 12}

/\u{Q12}/extra_alt_bsux
--u{Q12}--
0: u{Q12}

/\u{{3}}/extra_alt_bsux
--u{{{}--
0: u{{{}

/\u/utf,alt_bsux
\\u
0: u
Expand Down

0 comments on commit 3368925

Please sign in to comment.