| OLD | NEW |
| 1 /* This is JavaScriptCore's variant of the PCRE library. While this library | 1 /* This is JavaScriptCore's variant of the PCRE library. While this library |
| 2 started out as a copy of PCRE, many of the features of PCRE have been | 2 started out as a copy of PCRE, many of the features of PCRE have been |
| 3 removed. This library now supports only the regular expression features | 3 removed. This library now supports only the regular expression features |
| 4 required by the JavaScript language specification, and has only the functions | 4 required by the JavaScript language specification, and has only the functions |
| 5 needed by JavaScriptCore and the rest of WebKit. | 5 needed by JavaScriptCore and the rest of WebKit. |
| 6 | 6 |
| 7 Originally written by Philip Hazel | 7 Originally written by Philip Hazel |
| 8 Copyright (c) 1997-2006 University of Cambridge | 8 Copyright (c) 1997-2006 University of Cambridge |
| 9 Copyright (C) 2002, 2004, 2006, 2007 Apple Inc. All rights reserved. | 9 Copyright (C) 2002, 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 10 Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 10 Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 { | 559 { |
| 560 int repeat_type, op_type; | 560 int repeat_type, op_type; |
| 561 int repeat_min = 0, repeat_max = 0; /* To please picky compilers */ | 561 int repeat_min = 0, repeat_max = 0; /* To please picky compilers */ |
| 562 int bravalue = 0; | 562 int bravalue = 0; |
| 563 int reqvary, tempreqvary; | 563 int reqvary, tempreqvary; |
| 564 int c; | 564 int c; |
| 565 unsigned char* code = *codeptr; | 565 unsigned char* code = *codeptr; |
| 566 unsigned char* tempcode; | 566 unsigned char* tempcode; |
| 567 bool groupsetfirstbyte = false; | 567 bool groupsetfirstbyte = false; |
| 568 const UChar* ptr = *ptrptr; | 568 const UChar* ptr = *ptrptr; |
| 569 const UChar* tempptr; | |
| 570 unsigned char* previous = NULL; | 569 unsigned char* previous = NULL; |
| 571 unsigned char classbits[32]; | 570 unsigned char classbits[32]; |
| 572 | 571 |
| 573 bool class_utf8; | 572 bool class_utf8; |
| 574 unsigned char* class_utf8data; | 573 unsigned char* class_utf8data; |
| 575 unsigned char utf8_char[6]; | 574 unsigned char utf8_char[6]; |
| 576 | 575 |
| 577 /* Initialize no first byte, no required byte. REQ_UNSET means "no char | 576 /* Initialize no first byte, no required byte. REQ_UNSET means "no char |
| 578 matching encountered yet". It gets changed to REQ_NONE if we hit something
that | 577 matching encountered yet". It gets changed to REQ_NONE if we hit something
that |
| 579 matches a non-fixed char first char; reqbyte just remains unset if we never | 578 matches a non-fixed char first char; reqbyte just remains unset if we never |
| (...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 *errorcodeptr = ERR14; | 1556 *errorcodeptr = ERR14; |
| 1558 goto FAILED; | 1557 goto FAILED; |
| 1559 } | 1558 } |
| 1560 break; | 1559 break; |
| 1561 | 1560 |
| 1562 /* Check \ for being a real metacharacter; if not, fall through and
handle | 1561 /* Check \ for being a real metacharacter; if not, fall through and
handle |
| 1563 it as a data character at the start of a string. Escape items are c
hecked | 1562 it as a data character at the start of a string. Escape items are c
hecked |
| 1564 for validity in the pre-compiling pass. */ | 1563 for validity in the pre-compiling pass. */ |
| 1565 | 1564 |
| 1566 case '\\': | 1565 case '\\': |
| 1567 tempptr = ptr; | |
| 1568 c = checkEscape(&ptr, patternEnd, errorcodeptr, cd.numCapturingB
rackets, false); | 1566 c = checkEscape(&ptr, patternEnd, errorcodeptr, cd.numCapturingB
rackets, false); |
| 1569 | 1567 |
| 1570 /* Handle metacharacters introduced by \. For ones like \d, the
ESC_ values | 1568 /* Handle metacharacters introduced by \. For ones like \d, the
ESC_ values |
| 1571 are arranged to be the negation of the corresponding OP_values.
For the | 1569 are arranged to be the negation of the corresponding OP_values.
For the |
| 1572 back references, the values are ESC_REF plus the reference numb
er. Only | 1570 back references, the values are ESC_REF plus the reference numb
er. Only |
| 1573 back references and those types that consume a character may be
repeated. | 1571 back references and those types that consume a character may be
repeated. |
| 1574 We can test for values between ESC_b and ESC_w for the latter;
this may | 1572 We can test for values between ESC_b and ESC_w for the latter;
this may |
| 1575 have to change if any new ones are ever created. */ | 1573 have to change if any new ones are ever created. */ |
| 1576 | 1574 |
| 1577 if (c < 0) { | 1575 if (c < 0) { |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2668 *numSubpatterns = re->top_bracket; | 2666 *numSubpatterns = re->top_bracket; |
| 2669 return re; | 2667 return re; |
| 2670 } | 2668 } |
| 2671 | 2669 |
| 2672 void jsRegExpFree(JSRegExp* re, free_t* free_function) | 2670 void jsRegExpFree(JSRegExp* re, free_t* free_function) |
| 2673 { | 2671 { |
| 2674 (*free_function)(reinterpret_cast<void*>(re)); | 2672 (*free_function)(reinterpret_cast<void*>(re)); |
| 2675 } | 2673 } |
| 2676 | 2674 |
| 2677 } } // namespace dart::jscre | 2675 } } // namespace dart::jscre |
| OLD | NEW |