Changeset 18483 in webkit for trunk/JavaScriptCore/pcre/pcre_compile.c
- Timestamp:
- Dec 29, 2006, 7:03:43 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/pcre/pcre_compile.c
r17372 r18483 718 718 int max = -1; 719 719 720 /* Read the minimum value and do a paranoid check: a negative value indicates 721 an integer overflow. */ 722 720 723 while ((DIGITAB(*p) & ctype_digit) != 0) min = min * 10 + *p++ - '0'; 721 724 if (min < 0 || min > 65535) … … 724 727 return p; 725 728 } 729 730 /* Read the maximum value if there is one, and again do a paranoid on its size. 731 Also, max must not be less than min. */ 726 732 727 733 if (*p == '}') max = min; else … … 3916 3922 #endif 3917 3923 BOOL inescq = FALSE; 3924 BOOL capturing; 3918 3925 unsigned int brastackptr = 0; 3919 3926 size_t size; … … 4480 4487 branch_newextra = 0; 4481 4488 bracket_length = 1 + LINK_SIZE; 4489 capturing = FALSE; 4482 4490 4483 4491 /* Handle special forms of bracket, which all start (? */ … … 4572 4580 case 'P': 4573 4581 ptr += 3; 4582 4583 /* Handle the definition of a named subpattern */ 4584 4574 4585 if (*ptr == '<') 4575 4586 { … … 4584 4595 name_count++; 4585 4596 if (ptr - p > max_name_size) max_name_size = INT_CAST(ptr - p); 4597 capturing = TRUE; /* Named parentheses are always capturing */ 4586 4598 break; 4587 4599 } 4600 4601 /* Handle back references and recursive calls to named subpatterns */ 4588 4602 4589 4603 if (*ptr == '=' || *ptr == '>') … … 4772 4786 } 4773 4787 4774 /* If options were terminated by ':' control comes here. Fall through 4775 to handle the group below. */ 4788 /* If options were terminated by ':' control comes here. This is a 4789 non-capturing group with an options change. There is nothing more that 4790 needs to be done because "capturing" is already set FALSE by default; 4791 we can just fall through. */ 4792 4776 4793 } 4777 4794 } 4778 4795 4779 /* Extracting brackets must be counted so we can process escapes in a 4780 Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to 4781 need an additional 3 bytes of store per extracting bracket. However, if 4782 PCRE_NO_AUTO)CAPTURE is set, unadorned brackets become non-capturing, so we 4783 must leave the count alone (it will aways be zero). */ 4784 4785 else if ((options & PCRE_NO_AUTO_CAPTURE) == 0) 4796 /* Ordinary parentheses, not followed by '?', are capturing unless 4797 PCRE_NO_AUTO_CAPTURE is set. */ 4798 4799 else capturing = (options & PCRE_NO_AUTO_CAPTURE) == 0; 4800 4801 /* Capturing brackets must be counted so we can process escapes in a 4802 Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to need 4803 an additional 3 bytes of memory per capturing bracket. */ 4804 4805 if (capturing) 4786 4806 { 4787 4807 bracount++;
Note:
See TracChangeset
for help on using the changeset viewer.