source: webkit/trunk/JavaScriptCore/runtime/RegExp.h@ 38477

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

2008-11-16 Geoffrey Garen <[email protected]>

Reviewed by Sam Weinig.


Renamed WREC => JSC::WREC, removing JSC:: prefix in a lot of places.
Renamed WRECFunction => WREC::CompiledRegExp, and deployed this type
name in place of a few casts.

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