source: webkit/trunk/JavaScriptCore/kjs/regexp.h@ 28476

Last change on this file since 28476 was 28468, checked in by [email protected], 17 years ago

JavaScriptCore:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and
functions accessing data members from Interpreter to JSGlobalObject.
Changed Interpreter member functions to static functions.


This resolves a bug in global object bootstrapping, where the global
ExecState could be used when uninitialized.


This is a big change, but it's mostly code motion and renaming.


Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
a .7% regression, but Shark sees no difference related to this patch,
and SunSpider reported a .7% speedup from an earlier step in this
refactoring, so I think it's fair to call that a wash.

JavaScriptGlue:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject. Replaced JSInterpreter
subclass with JSGlobalObject subclass.


  • JSRun.cpp: (JSRun::JSRun): (JSRun::Evaluate): (JSRun::CheckSyntax):
  • JSRun.h: (JSGlueGlobalObject::JSGlueGlobalObject):
  • JSUtils.cpp: (KJSValueToCFTypeInternal):
  • JSValueWrapper.cpp: (getThreadGlobalExecState):

WebCore:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject. Changed Interpreter
member functions to static functions. Same for the subclass,
ScriptInterpreter.


This is a big change, but it's mostly code motion and renaming.

WebKit/mac:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject.


  • WebView/WebFrame.mm: (-[WebFrame _attachScriptDebugger]):

WebKit/win:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject.


  • WebFrame.cpp: (WebFrame::globalContext): (WebFrame::attachScriptDebugger): (WebFrame::windowObjectCleared):
  • WebScriptDebugger.cpp: (WebScriptDebugger::WebScriptDebugger):
  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1// -*- c-basic-offset: 2 -*-
2/*
3 * Copyright (C) 1999-2000 Harri Porten ([email protected])
4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#ifndef KJS_REGEXP_H
23#define KJS_REGEXP_H
24
25#include "ustring.h"
26#include <pcre/pcre.h>
27#include <sys/types.h>
28#include <wtf/OwnArrayPtr.h>
29#include <wtf/RefCounted.h>
30
31namespace KJS {
32
33 class RegExp : public RefCounted<RegExp> {
34 private:
35 enum {
36 Global = 1,
37 IgnoreCase = 2,
38 Multiline = 4
39 };
40
41 public:
42 RegExp(const UString& pattern);
43 RegExp(const UString& pattern, const UString& flags);
44 ~RegExp();
45
46 bool global() const { return m_flagBits & Global; }
47 bool ignoreCase() const { return m_flagBits & IgnoreCase; }
48 bool multiline() const { return m_flagBits & Multiline; }
49
50 const UString& pattern() const { return m_pattern; }
51 const UString& flags() const { return m_flags; }
52
53 bool isValid() const { return !m_constructionError; }
54 const char* errorMessage() const { return m_constructionError; }
55
56 int match(const UString&, int offset, OwnArrayPtr<int>* ovector = 0);
57 unsigned numSubpatterns() const { return m_numSubpatterns; }
58
59 private:
60 void compile();
61
62 // Data supplied by caller.
63 UString m_pattern; // FIXME: Just decompile m_regExp instead of storing this.
64 UString m_flags; // FIXME: Just decompile m_regExp instead of storing this.
65 int m_flagBits;
66
67 // Data supplied by PCRE.
68 JSRegExp* m_regExp;
69 const char* m_constructionError;
70 unsigned m_numSubpatterns;
71 };
72
73} // namespace
74
75#endif
Note: See TracBrowser for help on using the repository browser.