Changeset 18182 in webkit for trunk/JavaScriptCore/kjs/regexp.h


Ignore:
Timestamp:
Dec 12, 2006, 12:09:58 PM (18 years ago)
Author:
ap
Message:

Reviewed by Geoff. Based on a patch by Maks Orlovich.

http://bugs.webkit.org/show_bug.cgi?id=6257
Throw errors on invalid expressions (KJS merge)

JavaScriptCore:

  • kjs/regexp.cpp: (KJS::RegExp::RegExp): (KJS::RegExp::~RegExp): (KJS::RegExp::match):
  • kjs/regexp.h: (KJS::RegExp::flags): (KJS::RegExp::isValid): (KJS::RegExp::errorMessage): (KJS::RegExp::subPatterns): Remember and report RegExp construction failures. Renamed data members not to start with underscores.
  • kjs/regexp_object.cpp: (RegExpObjectImp::construct): Raise an exception if RegExp construction fails. (RegExpObjectImp::callAsFunction): Removed an obsolete comment.
  • tests/mozilla/ecma_3/RegExp/regress-119909.js: Reduced the number of nested parentheses to a value supported by PCRE.

LayoutTests:

  • fast/js/kde/RegExp-expected.txt: One more test passes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/regexp.h

    r17862 r18182  
    4646    ~RegExp();
    4747
    48     int flags() const { return _flags; }
     48    int flags() const { return m_flags; }
     49    bool isValid() const { return !m_constructionError; }
     50    const char* errorMessage() const { return m_constructionError; }
    4951
    5052    UString match(const UString &s, int i, int *pos = 0, int **ovector = 0);
    51     unsigned subPatterns() const { return _numSubPatterns; }
     53    unsigned subPatterns() const { return m_numSubPatterns; }
    5254
    5355  private:
    5456#if HAVE(PCREPOSIX)
    55     pcre *_regex;
     57    pcre *m_regex;
    5658#else
    57     regex_t _regex;
     59    regex_t m_regex;
    5860#endif
    59     int _flags;
    60     unsigned _numSubPatterns;
     61    int m_flags;
     62    char* m_constructionError;
     63    unsigned m_numSubPatterns;
    6164
    6265    RegExp(const RegExp &);
Note: See TracChangeset for help on using the changeset viewer.