Ignore:
Timestamp:
Nov 29, 2007, 3:13:33 AM (18 years ago)
Author:
[email protected]
Message:

2007-11-24 Eric Seidel <[email protected]>

Reviewed by Sam.

give PCRE_STARTLINE a better name and rename match_data to MatchData

  • pcre/pcre_compile.cpp: (compile_branch): (canApplyFirstCharOptimization): (find_firstassertedchar): (printCompiledRegExp): (jsRegExpCompile):
  • pcre/pcre_exec.cpp: (pchars): (jsRegExpExecute):
  • pcre/pcre_internal.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/pcre/pcre_exec.cpp

    r28144 r28148  
    118118doing traditional NFA matching, so that they are thread-safe. */
    119119
    120 typedef struct match_data {
     120struct MatchData {
    121121  unsigned long int match_call_count;      /* As it says */
    122   int   *offset_vector;         /* Offset vector */
     122  int*   offset_vector;         /* Offset vector */
    123123  int    offset_end;            /* One past the end */
    124124  int    offset_max;            /* The maximum usable for return data */
    125   const uschar *lcc;            /* Points to lower casing table */
    126   const uschar *ctypes;         /* Points to table of type maps */
     125  const uschar* lcc;            /* Points to lower casing table */
     126  const uschar* ctypes;         /* Points to table of type maps */
    127127  bool   offset_overflow;       /* Set if too many extractions */
    128128  UChar*  start_subject;         /* Start of the subject string */
     
    132132  bool   multiline;
    133133  bool   caseless;
    134 } match_data;
     134};
    135135
    136136#define match_isgroup      true    /* Set if start of bracketed group */
     
    166166*/
    167167
    168 static void
    169 pchars(const UChar* p, int length, bool is_subject, match_data *md)
     168static void pchars(const UChar* p, int length, bool is_subject, MatchData *md)
    170169{
    171 int c;
    172 if (is_subject && length > md->end_subject - p) length = md->end_subject - p;
    173 while (length-- > 0)
    174   if (isprint(c = *(p++))) printf("%c", c);
    175   else if (c < 256) printf("\\x%02x", c);
    176   else printf("\\x{%x}", c);
     170    if (is_subject && length > md->end_subject - p)
     171        length = md->end_subject - p;
     172    while (length-- > 0) {
     173        int c;
     174        if (isprint(c = *(p++)))
     175            printf("%c", c);
     176        else if (c < 256)
     177            printf("\\x%02x", c);
     178        else
     179            printf("\\x{%x}", c);
     180    }
    177181}
    178182#endif
     
    197201
    198202static bool
    199 match_ref(int offset, UChar* eptr, int length, match_data *md)
     203match_ref(int offset, UChar* eptr, int length, MatchData *md)
    200204{
    201205UChar* p = md->start_subject + md->offset_vector[offset];
     
    404408}
    405409
    406 static int match(UChar* eptr, const uschar* ecode, int offset_top, match_data* md)
     410static int match(UChar* eptr, const uschar* ecode, int offset_top, MatchData* md)
    407411{
    408412    int is_match = false;
     
    20682072    ASSERT(offsets || offsetcount == 0);
    20692073   
    2070     match_data match_block;
     2074    MatchData match_block;
    20712075    match_block.start_subject = (UChar*)subject;
    20722076    match_block.end_subject = match_block.start_subject + length;
     
    20762080    match_block.ctypes = _pcre_default_tables + ctypes_offset;
    20772081   
    2078     match_block.multiline = (re->options & PCRE_MULTILINE) != 0;
    2079     match_block.caseless = (re->options & PCRE_CASELESS) != 0;
     2082    match_block.multiline = (re->options & PCRE_MULTILINE);
     2083    match_block.caseless = (re->options & PCRE_CASELESS);
    20802084   
    20812085    /* If the expression has got more back references than the offsets supplied can
     
    21502154    UChar* start_match = (UChar*)subject + start_offset;
    21512155    UChar* req_byte_ptr = start_match - 1;
    2152     bool startline = re->options & PCRE_STARTLINE;
     2156    bool useMultiLineFirstCharOptimization = re->options & OptionUseMultiLineFirstCharOptimization;
    21532157   
    21542158    do {
     
    21892193       
    21902194        /* Or to just after \n for a multiline match if possible */
    2191        
    2192         else if (startline) {
     2195        else if (useMultiLineFirstCharOptimization) {
    21932196            if (start_match > match_block.start_subject + start_offset) {
    21942197                while (start_match < end_subject && !isNewline(start_match[-1]))
Note: See TracChangeset for help on using the changeset viewer.