Ignore:
Timestamp:
Oct 11, 2005, 1:43:49 PM (20 years ago)
Author:
ggaren
Message:
  • Implemented caching of match state inside the global RegExp object (lastParen, leftContext, rightContext, lastMatch, input).

exec(), test(), match(), search(), and replace() now dipatch regular
expression matching through the RegExp object's performMatch function,
to facilitate caching. This replaces registerRegexp and
setSubPatterns.

  • Implemented the special '$' aliases (e.g. RegExp.input aliases to RegExp.$_).
  • Moved support for backreferences into the new static hash table used for other special RegExp properties. Truncated backreferences at $9 to match IE, FF, and the "What's New in Netscape 1.2?" doc. (String.replace still supports double-digit backreferences.)
  • Tweaked RegExp.prototype.exec to handle ginormous values in lastIndex.

Fixes 11 -- count em, 11 -- JavaScriptCore tests.

Reviewed by NOBODY (OOPS!).

  • JavaScriptCore.xcodeproj/project.pbxproj: Added regexp_object.lut.h
  • kjs/create_hash_table: Tweaked to allow for more exotic characters.

We now rely on the compiler to catch illegal
identifiers.

  • kjs/regexp.cpp: (KJS::RegExp::RegExp):
  • kjs/regexp_object.cpp: (RegExpProtoFuncImp::callAsFunction): (RegExpObjectImp::RegExpObjectImp): (RegExpObjectImp::performMatch): (RegExpObjectImp::arrayOfMatches): (RegExpObjectImp::backrefGetter): (RegExpObjectImp::getLastMatch): (RegExpObjectImp::getLastParen): (RegExpObjectImp::getLeftContext): (RegExpObjectImp::getRightContext): (RegExpObjectImp::getOwnPropertySlot): (RegExpObjectImp::getValueProperty): (RegExpObjectImp::put): (RegExpObjectImp::putValueProperty):
  • kjs/regexp_object.h: (KJS::RegExpObjectImp::):
  • kjs/string_object.cpp: (substituteBackreferences): (replace): (StringProtoFuncImp::callAsFunction):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r10744 r10818  
    11301130                                93F1983308245BA1001E9ABC /* math_object.lut.h */,
    11311131                                93F1983108245B9E001E9ABC /* number_object.lut.h */,
     1132                                14F6037308FB039300E9E573 /* regexp_object.lut.h */,
    11321133                                93F1983508245BA6001E9ABC /* string_object.lut.h */,
    11331134                                932F5B3F0822A1C700736975 /* Headers */,
     
    13571358
    13581359/* Begin PBXShellScriptBuildPhase section */
     1360                14F6037308FB039300E9E573 /* regexp_object.lut.h */ = {
     1361                        isa = PBXShellScriptBuildPhase;
     1362                        buildActionMask = 2147483647;
     1363                        files = (
     1364                        );
     1365                        inputPaths = (
     1366                                "kjs/create_hash_table\nkjs/create_hash_table",
     1367                                kjs/regexp_object.cpp,
     1368                        );
     1369                        name = regexp_object.lut.h;
     1370                        outputPaths = (
     1371                                "$(DERIVED_FILE_DIR)/regexp_object.lut.h",
     1372                        );
     1373                        runOnlyForDeploymentPostprocessing = 0;
     1374                        shellPath = /bin/sh;
     1375                        shellScript = "kjs/create_hash_table kjs/regexp_object.cpp -i > \"$DERIVED_FILE_DIR/regexp_object.lut.h\"";
     1376                };
    13591377                93396BB50824516200AB803D /* chartables.c */ = {
    13601378                        isa = PBXShellScriptBuildPhase;
Note: See TracChangeset for help on using the changeset viewer.