341 |
"number is too big\0" |
"number is too big\0" |
342 |
"subpattern name expected\0" |
"subpattern name expected\0" |
343 |
"digit expected after (?+\0" |
"digit expected after (?+\0" |
344 |
"] is an invalid data character in JavaScript compatibility mode"; |
"] is an invalid data character in JavaScript compatibility mode\0" |
345 |
|
/* 65 */ |
346 |
|
"different names for subpatterns of the same number are not allowed"; |
347 |
|
|
348 |
|
|
349 |
/* Table to identify digits and hex digits. This is used when compiling |
/* Table to identify digits and hex digits. This is used when compiling |
4869 |
} |
} |
4870 |
} |
} |
4871 |
|
|
4872 |
/* In the real compile, create the entry in the table */ |
/* In the real compile, create the entry in the table, maintaining |
4873 |
|
alphabetical order. Duplicate names for different numbers are |
4874 |
|
permitted only if PCRE_DUPNAMES is set. Duplicate names for the same |
4875 |
|
number are always OK. (An existing number can be re-used if (?| |
4876 |
|
appears in the pattern.) In either event, a duplicate name results in |
4877 |
|
a duplicate entry in the table, even if the number is the same. This |
4878 |
|
is because the number of names, and hence the table size, is computed |
4879 |
|
in the pre-compile, and it affects various numbers and pointers which |
4880 |
|
would all have to be modified, and the compiled code moved down, if |
4881 |
|
duplicates with the same number were omitted from the table. This |
4882 |
|
doesn't seem worth the hassle. However, *different* names for the |
4883 |
|
same number are not permitted. */ |
4884 |
|
|
4885 |
else |
else |
4886 |
{ |
{ |
4887 |
|
BOOL dupname = FALSE; |
4888 |
slot = cd->name_table; |
slot = cd->name_table; |
4889 |
|
|
4890 |
for (i = 0; i < cd->names_found; i++) |
for (i = 0; i < cd->names_found; i++) |
4891 |
{ |
{ |
4892 |
int crc = memcmp(name, slot+2, namelen); |
int crc = memcmp(name, slot+2, namelen); |
4894 |
{ |
{ |
4895 |
if (slot[2+namelen] == 0) |
if (slot[2+namelen] == 0) |
4896 |
{ |
{ |
4897 |
if ((options & PCRE_DUPNAMES) == 0) |
if (GET2(slot, 0) != cd->bracount + 1 && |
4898 |
|
(options & PCRE_DUPNAMES) == 0) |
4899 |
{ |
{ |
4900 |
*errorcodeptr = ERR43; |
*errorcodeptr = ERR43; |
4901 |
goto FAILED; |
goto FAILED; |
4902 |
} |
} |
4903 |
|
else dupname = TRUE; |
4904 |
} |
} |
4905 |
else crc = -1; /* Current name is substring */ |
else crc = -1; /* Current name is a substring */ |
4906 |
} |
} |
4907 |
|
|
4908 |
|
/* Make space in the table and break the loop for an earlier |
4909 |
|
name. For a duplicate or later name, carry on. We do this for |
4910 |
|
duplicates so that in the simple case (when ?(| is not used) they |
4911 |
|
are in order of their numbers. */ |
4912 |
|
|
4913 |
if (crc < 0) |
if (crc < 0) |
4914 |
{ |
{ |
4915 |
memmove(slot + cd->name_entry_size, slot, |
memmove(slot + cd->name_entry_size, slot, |
4916 |
(cd->names_found - i) * cd->name_entry_size); |
(cd->names_found - i) * cd->name_entry_size); |
4917 |
break; |
break; |
4918 |
} |
} |
4919 |
|
|
4920 |
|
/* Continue the loop for a later or duplicate name */ |
4921 |
|
|
4922 |
slot += cd->name_entry_size; |
slot += cd->name_entry_size; |
4923 |
} |
} |
4924 |
|
|
4925 |
|
/* For non-duplicate names, check for a duplicate number before |
4926 |
|
adding the new name. */ |
4927 |
|
|
4928 |
|
if (!dupname) |
4929 |
|
{ |
4930 |
|
uschar *cslot = cd->name_table; |
4931 |
|
for (i = 0; i < cd->names_found; i++) |
4932 |
|
{ |
4933 |
|
if (cslot != slot) |
4934 |
|
{ |
4935 |
|
if (GET2(cslot, 0) == cd->bracount + 1) |
4936 |
|
{ |
4937 |
|
*errorcodeptr = ERR65; |
4938 |
|
goto FAILED; |
4939 |
|
} |
4940 |
|
} |
4941 |
|
else i--; |
4942 |
|
cslot += cd->name_entry_size; |
4943 |
|
} |
4944 |
|
} |
4945 |
|
|
4946 |
PUT2(slot, 0, cd->bracount + 1); |
PUT2(slot, 0, cd->bracount + 1); |
4947 |
memcpy(slot + 2, name, namelen); |
memcpy(slot + 2, name, namelen); |
4949 |
} |
} |
4950 |
} |
} |
4951 |
|
|
4952 |
/* In both cases, count the number of names we've encountered. */ |
/* In both pre-compile and compile, count the number of names we've |
4953 |
|
encountered. */ |
4954 |
|
|
|
ptr++; /* Move past > or ' */ |
|
4955 |
cd->names_found++; |
cd->names_found++; |
4956 |
|
ptr++; /* Move past > or ' */ |
4957 |
goto NUMBERED_GROUP; |
goto NUMBERED_GROUP; |
4958 |
|
|
4959 |
|
|