Ignore:
Timestamp:
Mar 31, 2008, 1:01:09 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by darin.

Make matching of regexps using much faster
http://bugs.webkit.org/show_bug.cgi?id=18086

  • pcre/pcre_compile.cpp: (compileBranch): (branchNeedsLineStart):
  • pcre/pcre_exec.cpp: (match): (jsRegExpExecute):
  • pcre/pcre_internal.h:
File:
1 edited

Legend:

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

    r31388 r31454  
    637637            /* Handle single-character metacharacters. In multiline mode, ^ disables
    638638             the setting of any following char as a first character. */
    639                
     639
    640640            case '^':
    641641                if (options & MatchAcrossMultipleLinesOption) {
    642642                    if (firstbyte == REQ_UNSET)
    643643                        firstbyte = REQ_NONE;
    644                 }
     644                    *code++ = OP_BOL;
     645                } else
     646                    *code++ = OP_CIRC;
    645647                previous = NULL;
    646                 *code++ = OP_CIRC;
    647648                break;
    648                
     649
    649650            case '$':
    650651                previous = NULL;
    651                 *code++ = OP_DOLL;
     652                if (options & MatchAcrossMultipleLinesOption)
     653                  *code++ = OP_EOL;
     654                else
     655                  *code++ = OP_DOLL;
    652656                break;
    653                
     657
    654658            /* There can never be a first char if '.' is first, whatever happens about
    655659             repeats. The value of reqbyte doesn't change either. */
    656                
     660
    657661            case '.':
    658662                if (firstbyte == REQ_UNSET)
     
    19051909
    19061910    /* Explicit ^ */
    1907     return op == OP_CIRC;
     1911    return op == OP_CIRC || op == OP_BOL;
    19081912}
    19091913
Note: See TracChangeset for help on using the changeset viewer.