@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
7
7
8
8
Written by Philip Hazel
9
9
Original API code Copyright (c) 1997-2012 University of Cambridge
10
- New API code Copyright (c) 2016-2022 University of Cambridge
10
+ New API code Copyright (c) 2016-2023 University of Cambridge
11
11
12
12
-----------------------------------------------------------------------------
13
13
Redistribution and use in source and binary forms, with or without
@@ -187,7 +187,8 @@ static const uint8_t coptable[] = {
187
187
0 , 0 , 0 , 0 , /* SKIP, SKIP_ARG, THEN, THEN_ARG */
188
188
0 , 0 , /* COMMIT, COMMIT_ARG */
189
189
0 , 0 , 0 , /* FAIL, ACCEPT, ASSERT_ACCEPT */
190
- 0 , 0 , 0 /* CLOSE, SKIPZERO, DEFINE */
190
+ 0 , 0 , 0 , /* CLOSE, SKIPZERO, DEFINE */
191
+ 0 , 0 /* \B and \b in UCP mode */
191
192
};
192
193
193
194
/* This table identifies those opcodes that inspect a character. It is used to
@@ -264,7 +265,8 @@ static const uint8_t poptable[] = {
264
265
0 , 0 , 0 , 0 , /* SKIP, SKIP_ARG, THEN, THEN_ARG */
265
266
0 , 0 , /* COMMIT, COMMIT_ARG */
266
267
0 , 0 , 0 , /* FAIL, ACCEPT, ASSERT_ACCEPT */
267
- 0 , 0 , 0 /* CLOSE, SKIPZERO, DEFINE */
268
+ 0 , 0 , 0 , /* CLOSE, SKIPZERO, DEFINE */
269
+ 1 , 1 /* \B and \b in UCP mode */
268
270
};
269
271
270
272
/* These 2 tables allow for compact code for testing for \D, \d, \S, \s, \W,
@@ -1100,6 +1102,8 @@ for (;;)
1100
1102
/*-----------------------------------------------------------------*/
1101
1103
case OP_WORD_BOUNDARY :
1102
1104
case OP_NOT_WORD_BOUNDARY :
1105
+ case OP_NOT_UCP_WORD_BOUNDARY :
1106
+ case OP_UCP_WORD_BOUNDARY :
1103
1107
{
1104
1108
int left_word , right_word ;
1105
1109
@@ -1112,7 +1116,8 @@ for (;;)
1112
1116
#endif
1113
1117
GETCHARTEST (d , temp );
1114
1118
#ifdef SUPPORT_UNICODE
1115
- if ((mb -> poptions & PCRE2_UCP ) != 0 )
1119
+ if (codevalue == OP_UCP_WORD_BOUNDARY ||
1120
+ codevalue == OP_NOT_UCP_WORD_BOUNDARY )
1116
1121
{
1117
1122
if (d == '_' ) left_word = TRUE; else
1118
1123
{
@@ -1137,7 +1142,8 @@ for (;;)
1137
1142
mb -> last_used_ptr = temp ;
1138
1143
}
1139
1144
#ifdef SUPPORT_UNICODE
1140
- if ((mb -> poptions & PCRE2_UCP ) != 0 )
1145
+ if (codevalue == OP_UCP_WORD_BOUNDARY ||
1146
+ codevalue == OP_NOT_UCP_WORD_BOUNDARY )
1141
1147
{
1142
1148
if (c == '_' ) right_word = TRUE; else
1143
1149
{
@@ -1151,7 +1157,9 @@ for (;;)
1151
1157
}
1152
1158
else right_word = FALSE;
1153
1159
1154
- if ((left_word == right_word ) == (codevalue == OP_NOT_WORD_BOUNDARY ))
1160
+ if ((left_word == right_word ) ==
1161
+ (codevalue == OP_NOT_WORD_BOUNDARY ||
1162
+ codevalue == OP_NOT_UCP_WORD_BOUNDARY ))
1155
1163
{ ADD_ACTIVE (state_offset + 1 , 0 ); }
1156
1164
}
1157
1165
break ;
0 commit comments