| 412 |
"\\k is not followed by a braced, angle-bracketed, or quoted name\0" |
"\\k is not followed by a braced, angle-bracketed, or quoted name\0" |
| 413 |
/* 70 */ |
/* 70 */ |
| 414 |
"internal error: unknown opcode in find_fixedlength()\0" |
"internal error: unknown opcode in find_fixedlength()\0" |
| 415 |
|
"\\N is not supported in a class\0" |
| 416 |
|
"too many forward references\0" |
| 417 |
; |
; |
| 418 |
|
|
| 419 |
/* Table to identify digits and hex digits. This is used when compiling |
/* Table to identify digits and hex digits. This is used when compiling |
| 1530 |
|
|
| 1531 |
Returns: the fixed length, |
Returns: the fixed length, |
| 1532 |
or -1 if there is no fixed length, |
or -1 if there is no fixed length, |
| 1533 |
or -2 if \C was encountered |
or -2 if \C was encountered (in UTF-8 mode only) |
| 1534 |
or -3 if an OP_RECURSE item was encountered and atend is FALSE |
or -3 if an OP_RECURSE item was encountered and atend is FALSE |
| 1535 |
or -4 if an unknown opcode was encountered (internal error) |
or -4 if an unknown opcode was encountered (internal error) |
| 1536 |
*/ |
*/ |
| 1704 |
cc++; |
cc++; |
| 1705 |
break; |
break; |
| 1706 |
|
|
| 1707 |
/* The single-byte matcher isn't allowed */ |
/* The single-byte matcher isn't allowed. This only happens in UTF-8 mode; |
| 1708 |
|
otherwise \C is coded as OP_ALLANY. */ |
| 1709 |
|
|
| 1710 |
case OP_ANYBYTE: |
case OP_ANYBYTE: |
| 1711 |
return -2; |
return -2; |
| 3355 |
} |
} |
| 3356 |
|
|
| 3357 |
*lengthptr += (int)(code - last_code); |
*lengthptr += (int)(code - last_code); |
| 3358 |
DPRINTF(("length=%d added %d c=%c\n", *lengthptr, code - last_code, c)); |
DPRINTF(("length=%d added %d c=%c\n", *lengthptr, (int)(code - last_code), |
| 3359 |
|
c)); |
| 3360 |
|
|
| 3361 |
/* If "previous" is set and it is not at the start of the work space, move |
/* If "previous" is set and it is not at the start of the work space, move |
| 3362 |
it back to there, in order to avoid filling up the work space. Otherwise, |
it back to there, in order to avoid filling up the work space. Otherwise, |
| 3772 |
if (*errorcodeptr != 0) goto FAILED; |
if (*errorcodeptr != 0) goto FAILED; |
| 3773 |
|
|
| 3774 |
if (-c == ESC_b) c = CHAR_BS; /* \b is backspace in a class */ |
if (-c == ESC_b) c = CHAR_BS; /* \b is backspace in a class */ |
| 3775 |
|
else if (-c == ESC_N) /* \N is not supported in a class */ |
| 3776 |
|
{ |
| 3777 |
|
*errorcodeptr = ERR71; |
| 3778 |
|
goto FAILED; |
| 3779 |
|
} |
| 3780 |
else if (-c == ESC_Q) /* Handle start of quoted string */ |
else if (-c == ESC_Q) /* Handle start of quoted string */ |
| 3781 |
{ |
{ |
| 3782 |
if (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E) |
if (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E) |
| 4884 |
*lengthptr += delta; |
*lengthptr += delta; |
| 4885 |
} |
} |
| 4886 |
|
|
| 4887 |
/* This is compiling for real */ |
/* This is compiling for real. If there is a set first byte for |
| 4888 |
|
the group, and we have not yet set a "required byte", set it. */ |
| 4889 |
|
|
| 4890 |
else |
else |
| 4891 |
{ |
{ |
| 4897 |
memcpy(code, previous, len); |
memcpy(code, previous, len); |
| 4898 |
for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE) |
for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE) |
| 4899 |
{ |
{ |
| 4900 |
|
if (cd->hwm >= cd->start_workspace + WORK_SIZE_CHECK) |
| 4901 |
|
{ |
| 4902 |
|
*errorcodeptr = ERR72; |
| 4903 |
|
goto FAILED; |
| 4904 |
|
} |
| 4905 |
PUT(cd->hwm, 0, GET(hc, 0) + len); |
PUT(cd->hwm, 0, GET(hc, 0) + len); |
| 4906 |
cd->hwm += LINK_SIZE; |
cd->hwm += LINK_SIZE; |
| 4907 |
} |
} |
| 4929 |
add 2 + 2*LINKSIZE to allow for the nesting that occurs. Do some |
add 2 + 2*LINKSIZE to allow for the nesting that occurs. Do some |
| 4930 |
paranoid checks to avoid integer overflow. The INT64_OR_DOUBLE type is |
paranoid checks to avoid integer overflow. The INT64_OR_DOUBLE type is |
| 4931 |
a 64-bit integer type when available, otherwise double. */ |
a 64-bit integer type when available, otherwise double. */ |
| 4932 |
|
|
| 4933 |
if (lengthptr != NULL && repeat_max > 0) |
if (lengthptr != NULL && repeat_max > 0) |
| 4934 |
{ |
{ |
| 4935 |
int delta = repeat_max * (length_prevgroup + 1 + 2 + 2*LINK_SIZE) - |
int delta = repeat_max * (length_prevgroup + 1 + 2 + 2*LINK_SIZE) - |
| 4969 |
memcpy(code, previous, len); |
memcpy(code, previous, len); |
| 4970 |
for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE) |
for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE) |
| 4971 |
{ |
{ |
| 4972 |
|
if (cd->hwm >= cd->start_workspace + WORK_SIZE_CHECK) |
| 4973 |
|
{ |
| 4974 |
|
*errorcodeptr = ERR72; |
| 4975 |
|
goto FAILED; |
| 4976 |
|
} |
| 4977 |
PUT(cd->hwm, 0, GET(hc, 0) + len + ((i != 0)? 2+LINK_SIZE : 1)); |
PUT(cd->hwm, 0, GET(hc, 0) + len + ((i != 0)? 2+LINK_SIZE : 1)); |
| 4978 |
cd->hwm += LINK_SIZE; |
cd->hwm += LINK_SIZE; |
| 4979 |
} |
} |
| 5619 |
|
|
| 5620 |
/* ------------------------------------------------------------ */ |
/* ------------------------------------------------------------ */ |
| 5621 |
case CHAR_C: /* Callout - may be followed by digits; */ |
case CHAR_C: /* Callout - may be followed by digits; */ |
| 5622 |
previous_callout = code; /* Save for later completion */ |
previous_callout = code; /* Save for later completion */ |
| 5623 |
after_manual_callout = 1; /* Skip one item before completing */ |
after_manual_callout = 1; /* Skip one item before completing */ |
| 5624 |
*code++ = OP_CALLOUT; |
*code++ = OP_CALLOUT; |
| 5625 |
{ |
{ |
| 5626 |
int n = 0; |
int n = 0; |
| 5989 |
/* Fudge the value of "called" so that when it is inserted as an |
/* Fudge the value of "called" so that when it is inserted as an |
| 5990 |
offset below, what it actually inserted is the reference number |
offset below, what it actually inserted is the reference number |
| 5991 |
of the group. Then remember the forward reference. */ |
of the group. Then remember the forward reference. */ |
| 5992 |
|
|
| 5993 |
called = cd->start_code + recno; |
called = cd->start_code + recno; |
| 5994 |
|
if (cd->hwm >= cd->start_workspace + WORK_SIZE_CHECK) |
| 5995 |
|
{ |
| 5996 |
|
*errorcodeptr = ERR72; |
| 5997 |
|
goto FAILED; |
| 5998 |
|
} |
| 5999 |
PUTINC(cd->hwm, 0, (int)(code + 1 - cd->start_code)); |
PUTINC(cd->hwm, 0, (int)(code + 1 - cd->start_code)); |
| 6000 |
} |
} |
| 6001 |
|
|
| 6016 |
} |
} |
| 6017 |
} |
} |
| 6018 |
|
|
| 6019 |
/* Insert the recursion/subroutine item. */ |
/* Insert the recursion/subroutine item. It does not have a set first |
| 6020 |
|
byte (relevant if it is repeated, because it will then be wrapped |
| 6021 |
|
with ONCE brackets). */ |
| 6022 |
|
|
| 6023 |
*code = OP_RECURSE; |
*code = OP_RECURSE; |
| 6024 |
PUT(code, 1, (int)(called - cd->start_code)); |
PUT(code, 1, (int)(called - cd->start_code)); |
| 6025 |
code += 1 + LINK_SIZE; |
code += 1 + LINK_SIZE; |
| 6026 |
|
groupsetfirstbyte = FALSE; |
| 6027 |
} |
} |
| 6028 |
|
|
| 6029 |
/* Can't determine a first byte now */ |
/* Can't determine a first byte now */ |
| 6505 |
} |
} |
| 6506 |
else |
else |
| 6507 |
#endif |
#endif |
| 6508 |
{ |
/* In non-UTF-8 mode, we turn \C into OP_ALLANY instead of OP_ANYBYTE |
| 6509 |
|
so that it works in DFA mode and in lookbehinds. */ |
| 6510 |
|
|
| 6511 |
|
{ |
| 6512 |
previous = (-c > ESC_b && -c < ESC_Z)? code : NULL; |
previous = (-c > ESC_b && -c < ESC_Z)? code : NULL; |
| 6513 |
*code++ = -c; |
*code++ = (!utf8 && c == -ESC_C)? OP_ALLANY : -c; |
| 6514 |
} |
} |
| 6515 |
} |
} |
| 6516 |
continue; |
continue; |