242 |
/* 55 */ |
/* 55 */ |
243 |
"repeating a DEFINE group is not allowed", |
"repeating a DEFINE group is not allowed", |
244 |
"inconsistent NEWLINE options", |
"inconsistent NEWLINE options", |
245 |
"\\g is not followed by an (optionally braced) non-zero number", |
"\\g is not followed by a braced name or an optionally braced non-zero number", |
246 |
"(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number" |
"(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number" |
247 |
}; |
}; |
248 |
|
|
453 |
|
|
454 |
/* \g must be followed by a number, either plain or braced. If positive, it |
/* \g must be followed by a number, either plain or braced. If positive, it |
455 |
is an absolute backreference. If negative, it is a relative backreference. |
is an absolute backreference. If negative, it is a relative backreference. |
456 |
This is a Perl 5.10 feature. */ |
This is a Perl 5.10 feature. Perl 5.10 also supports \g{name} as a |
457 |
|
reference to a named group. This is part of Perl's movement towards a |
458 |
|
unified syntax for back references. As this is synonymous with \k{name}, we |
459 |
|
fudge it up by pretending it really was \k. */ |
460 |
|
|
461 |
case 'g': |
case 'g': |
462 |
if (ptr[1] == '{') |
if (ptr[1] == '{') |
463 |
{ |
{ |
464 |
|
const uschar *p; |
465 |
|
for (p = ptr+2; *p != 0 && *p != '}'; p++) |
466 |
|
if (*p != '-' && (digitab[*p] & ctype_digit) == 0) break; |
467 |
|
if (*p != 0 && *p != '}') |
468 |
|
{ |
469 |
|
c = -ESC_k; |
470 |
|
break; |
471 |
|
} |
472 |
braced = TRUE; |
braced = TRUE; |
473 |
ptr++; |
ptr++; |
474 |
} |
} |
1381 |
const uschar *ccode; |
const uschar *ccode; |
1382 |
|
|
1383 |
c = *code; |
c = *code; |
1384 |
|
|
1385 |
|
/* Groups with zero repeats can of course be empty; skip them. */ |
1386 |
|
|
1387 |
|
if (c == OP_BRAZERO || c == OP_BRAMINZERO) |
1388 |
|
{ |
1389 |
|
do code += GET(code, 1); while (*code == OP_ALT); |
1390 |
|
c = *code; |
1391 |
|
continue; |
1392 |
|
} |
1393 |
|
|
1394 |
|
/* For other groups, scan the branches. */ |
1395 |
|
|
1396 |
if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE) |
if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE) |
1397 |
{ |
{ |
1398 |
BOOL empty_branch; |
BOOL empty_branch; |
1409 |
} |
} |
1410 |
while (*code == OP_ALT); |
while (*code == OP_ALT); |
1411 |
if (!empty_branch) return FALSE; /* All branches are non-empty */ |
if (!empty_branch) return FALSE; /* All branches are non-empty */ |
1412 |
|
c = *code; |
|
/* Move past the KET and fudge things so that the increment in the "for" |
|
|
above has no effect. */ |
|
|
|
|
|
c = OP_END; |
|
|
code += 1 + LINK_SIZE - _pcre_OP_lengths[c]; |
|
1413 |
continue; |
continue; |
1414 |
} |
} |
1415 |
|
|
4481 |
zerofirstbyte = firstbyte; |
zerofirstbyte = firstbyte; |
4482 |
zeroreqbyte = reqbyte; |
zeroreqbyte = reqbyte; |
4483 |
|
|
4484 |
/* \k<name> or \k'name' is a back reference by name (Perl syntax) */ |
/* \k<name> or \k'name' is a back reference by name (Perl syntax). |
4485 |
|
We also support \k{name} (.NET syntax) */ |
4486 |
|
|
4487 |
if (-c == ESC_k && (ptr[1] == '<' || ptr[1] == '\'')) |
if (-c == ESC_k && (ptr[1] == '<' || ptr[1] == '\'' || ptr[1] == '{')) |
4488 |
{ |
{ |
4489 |
is_recurse = FALSE; |
is_recurse = FALSE; |
4490 |
terminator = (*(++ptr) == '<')? '>' : '\''; |
terminator = (*(++ptr) == '<')? '>' : (*ptr == '\'')? '\'' : '}'; |
4491 |
goto NAMED_REF_OR_RECURSE; |
goto NAMED_REF_OR_RECURSE; |
4492 |
} |
} |
4493 |
|
|