Changeset 27686 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Nov 11, 2007, 10:56:13 AM (18 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/regexp.cpp
r27571 r27686 38 38 , m_numSubpatterns(0) 39 39 { 40 const char* errorMessage; 41 m_regExp = jsRegExpCompile(reinterpret_cast<const JSRegExpChar*>(m_pattern.data()), m_pattern.size(), 0, &m_numSubpatterns, &errorMessage); 42 if (!m_regExp) 43 m_constructionError = strdup(errorMessage); 40 m_regExp = jsRegExpCompile(reinterpret_cast<const ::UChar*>(m_pattern.data()), m_pattern.size(), 41 JSRegExpDoNotIgnoreCase, JSRegExpSingleLine, &m_numSubpatterns, &m_constructionError); 44 42 } 45 43 … … 56 54 m_flags |= Global; 57 55 58 // FIXME: Eliminate duplication by adding a way ask a JSRegExp what its flags are .59 int options = 0;56 // FIXME: Eliminate duplication by adding a way ask a JSRegExp what its flags are? 57 JSRegExpIgnoreCaseOption ignoreCaseOption = JSRegExpDoNotIgnoreCase; 60 58 if (flags.find('i') != -1) { 61 59 m_flags |= IgnoreCase; 62 options |= JS_REGEXP_CASELESS;60 ignoreCaseOption = JSRegExpIgnoreCase; 63 61 } 64 62 63 JSRegExpMultilineOption multilineOption = JSRegExpSingleLine; 65 64 if (flags.find('m') != -1) { 66 65 m_flags |= Multiline; 67 options |= JS_REGEXP_MULTILINE;66 multilineOption = JSRegExpMultiline; 68 67 } 69 68 70 const char* errorMessage; 71 m_regExp = jsRegExpCompile(reinterpret_cast<const JSRegExpChar*>(m_pattern.data()), m_pattern.size(), options, &m_numSubpatterns, &errorMessage); 72 if (!m_regExp) 73 m_constructionError = strdup(errorMessage); 69 m_regExp = jsRegExpCompile(reinterpret_cast<const ::UChar*>(m_pattern.data()), m_pattern.size(), 70 ignoreCaseOption, multilineOption, &m_numSubpatterns, &m_constructionError); 74 71 } 75 72 76 73 RegExp::~RegExp() 77 74 { 78 jsRegExpFree(m_regExp); 79 free(m_constructionError); 75 jsRegExpFree(m_regExp); 80 76 } 81 77 … … 107 103 } 108 104 109 int numMatches = jsRegExpExecute(m_regExp, reinterpret_cast<const JSRegExpChar*>(s.data()), s.size(), i, offsetVector, offsetVectorSize);105 int numMatches = jsRegExpExecute(m_regExp, reinterpret_cast<const ::UChar*>(s.data()), s.size(), i, offsetVector, offsetVectorSize); 110 106 111 107 if (numMatches < 0) { 112 108 #ifndef NDEBUG 113 if (numMatches != JS _REGEXP_ERROR_NOMATCH)109 if (numMatches != JSRegExpErrorNoMatch) 114 110 fprintf(stderr, "KJS: pcre_exec() failed with result %d\n", numMatches); 115 111 #endif -
trunk/JavaScriptCore/kjs/regexp.h
r27571 r27686 69 69 // Data supplied by PCRE. 70 70 JSRegExp* m_regExp; 71 c har* m_constructionError;71 const char* m_constructionError; 72 72 unsigned m_numSubpatterns; 73 73 };
Note:
See TracChangeset
for help on using the changeset viewer.