| 1 | /* |
| 2 | * Copyright (C) 1999-2000 Harri Porten ([email protected]) |
| 3 | * Copyright (C) 2003, 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 | #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/ |
| 22 | #include "RegExpObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpObject.h`/ |
| 23 | |
| 24 | #include "Error.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Error.h`/ |
| 25 | #include "JSArray.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.h`/ |
| 26 | #include "JSGlobalObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h`/ |
| 27 | #include "JSString.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSString.h`/ |
| 28 | #include "RegExpConstructor.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpConstructor.h`/ |
| 29 | #include "RegExpPrototype.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpPrototype.h`/ |
| 30 | |
| 31 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 32 | |
| 33 | static JSValuecxx . . $ QTJSC/JSValue# regExpObjectGlobalcxx . . $ QTJSC/regExpObjectGlobal(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#&); |
| 34 | static JSValuecxx . . $ QTJSC/JSValue# regExpObjectIgnoreCasecxx . . $ QTJSC/regExpObjectIgnoreCase(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#&); |
| 35 | static JSValuecxx . . $ QTJSC/JSValue# regExpObjectMultilinecxx . . $ QTJSC/regExpObjectMultiline(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#&); |
| 36 | static JSValuecxx . . $ QTJSC/JSValue# regExpObjectSourcecxx . . $ QTJSC/regExpObjectSource(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#&); |
| 37 | static JSValuecxx . . $ QTJSC/JSValue# regExpObjectLastIndexcxx . . $ QTJSC/regExpObjectLastIndex(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#&); |
| 38 | static void setRegExpObjectLastIndexcxx . . $ QTJSC/setRegExpObjectLastIndex(30009bd3df25a93).(ExecStatecxx . . $ QTJSC/ExecState#*, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#); |
| 39 | |
| 40 | } // namespace JSC |
| 41 | |
| 42 | #include "RegExpObject.lut.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/generated/RegExpObject.lut.h`/ |
| 43 | |
| 44 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 45 | |
| 46 | ASSERT_CLASS_FITS_IN_CELLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.h:42:9`!(RegExpObject); |
| 47 | |
| 48 | const ClassInfocxx . . $ QTJSC/ClassInfo# RegExpObjectcxx . . $ QTJSC/RegExpObject#::infocxx . . $ QTJSC/RegExpObject#info. = { "RegExp", 0, 0, ExecStatecxx . . $ QTJSC/ExecState#::regExpTablecxx . . $ QTJSC/ExecState#regExpTable(3f6af30e59383ee). }; |
| 49 | |
| 50 | /* Source for RegExpObject.lut.h |
| 51 | @begin regExpTable |
| 52 | global regExpObjectGlobal DontDelete|ReadOnly|DontEnum |
| 53 | ignoreCase regExpObjectIgnoreCase DontDelete|ReadOnly|DontEnum |
| 54 | multiline regExpObjectMultiline DontDelete|ReadOnly|DontEnum |
| 55 | source regExpObjectSource DontDelete|ReadOnly|DontEnum |
| 56 | lastIndex regExpObjectLastIndex DontDelete|DontEnum |
| 57 | @end |
| 58 | */ |
| 59 | |
| 60 | RegExpObjectcxx . . $ QTJSC/RegExpObject#::RegExpObjectcxx . . $ QTJSC/RegExpObject#RegExpObject(896c625ff37d99a4).(NonNullPassRefPtrcxx . . $ NonNullPassRefPtr#<Structurecxx . . $ QTJSC/Structure#> structure, NonNullPassRefPtrcxx . . $ NonNullPassRefPtr#<RegExpcxx . . $ QTJSC/RegExp#> regExp) |
| 61 | : JSObjectcxx . . $ QTJSC/JSObject#(structure) |
| 62 | , d(new RegExpObjectData(regExp, 0)) |
| 63 | { |
| 64 | } |
| 65 | |
| 66 | RegExpObjectcxx . . $ QTJSC/RegExpObject#::~cxx . . $ QTJSC/RegExpObject#`~RegExpObject`(49f6e7a06ebc5aa8).RegExpObjectcxx . . $ QTJSC/RegExpObject#() |
| 67 | { |
| 68 | } |
| 69 | |
| 70 | bool RegExpObjectcxx . . $ QTJSC/RegExpObject#::getOwnPropertySlotcxx . . $ QTJSC/RegExpObject#getOwnPropertySlot(6f4ef3dbfe7d5ab9).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 71 | { |
| 72 | return getStaticValueSlotcxx . . $ QTJSC/getStaticValueSlot(e862481916033870).<RegExpObjectcxx . . $ QTJSC/RegExpObject#, JSObjectcxx . . $ QTJSC/JSObject#>(exec, ExecStatecxx . . $ QTJSC/ExecState#::regExpTablecxx . . $ QTJSC/ExecState#regExpTable(3f6af30e59383ee).(exec), this, propertyName, slot); |
| 73 | } |
| 74 | |
| 75 | bool RegExpObjectcxx . . $ QTJSC/RegExpObject#::getOwnPropertyDescriptorcxx . . $ QTJSC/RegExpObject#getOwnPropertyDescriptor(dce4ef7012294c32).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertyDescriptorcxx . . $ QTJSC/PropertyDescriptor#& descriptor) |
| 76 | { |
| 77 | return getStaticValueDescriptorcxx . . $ QTJSC/getStaticValueDescriptor(f314e86693912e6d).<RegExpObjectcxx . . $ QTJSC/RegExpObject#, JSObjectcxx . . $ QTJSC/JSObject#>(exec, ExecStatecxx . . $ QTJSC/ExecState#::regExpTablecxx . . $ QTJSC/ExecState#regExpTable(3f6af30e59383ee).(exec), this, propertyName, descriptor); |
| 78 | } |
| 79 | |
| 80 | JSValuecxx . . $ QTJSC/JSValue# regExpObjectGlobalcxx . . $ QTJSC/regExpObjectGlobal(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 81 | { |
| 82 | return jsBooleancxx . . $ QTJSC/jsBoolean(b805946c4147dfe1).(asRegExpObjectcxx . . $ QTJSC/asRegExpObject(b4b81e749ecabfea).(slot.slotBasecxx . . $ QTJSC/PropertySlot#slotBase(888c053acf364da1).())->regExpcxx . . $ QTJSC/RegExpObject#regExp(4a8334b8e2c199f0).()->globalcxx . . $ QTJSC/RegExp#global(50ce9a9e25b4a850).()); |
| 83 | } |
| 84 | |
| 85 | JSValuecxx . . $ QTJSC/JSValue# regExpObjectIgnoreCasecxx . . $ QTJSC/regExpObjectIgnoreCase(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 86 | { |
| 87 | return jsBooleancxx . . $ QTJSC/jsBoolean(b805946c4147dfe1).(asRegExpObjectcxx . . $ QTJSC/asRegExpObject(b4b81e749ecabfea).(slot.slotBasecxx . . $ QTJSC/PropertySlot#slotBase(888c053acf364da1).())->regExpcxx . . $ QTJSC/RegExpObject#regExp(4a8334b8e2c199f0).()->ignoreCasecxx . . $ QTJSC/RegExp#ignoreCase(50ce9a9e25b4a850).()); |
| 88 | } |
| 89 | |
| 90 | JSValuecxx . . $ QTJSC/JSValue# regExpObjectMultilinecxx . . $ QTJSC/regExpObjectMultiline(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 91 | { |
| 92 | return jsBooleancxx . . $ QTJSC/jsBoolean(b805946c4147dfe1).(asRegExpObjectcxx . . $ QTJSC/asRegExpObject(b4b81e749ecabfea).(slot.slotBasecxx . . $ QTJSC/PropertySlot#slotBase(888c053acf364da1).())->regExpcxx . . $ QTJSC/RegExpObject#regExp(4a8334b8e2c199f0).()->multilinecxx . . $ QTJSC/RegExp#multiline(50ce9a9e25b4a850).()); |
| 93 | } |
| 94 | |
| 95 | JSValuecxx . . $ QTJSC/JSValue# regExpObjectSourcecxx . . $ QTJSC/regExpObjectSource(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 96 | { |
| 97 | return jsStringcxx . . $ QTJSC/jsString(edccc873576bddf5).(exec, asRegExpObjectcxx . . $ QTJSC/asRegExpObject(b4b81e749ecabfea).(slot.slotBasecxx . . $ QTJSC/PropertySlot#slotBase(888c053acf364da1).())->regExpcxx . . $ QTJSC/RegExpObject#regExp(4a8334b8e2c199f0).()->patterncxx . . $ QTJSC/RegExp#pattern(de21ee9ecbd506fd).()); |
| 98 | } |
| 99 | |
| 100 | JSValuecxx . . $ QTJSC/JSValue# regExpObjectLastIndexcxx . . $ QTJSC/regExpObjectLastIndex(2d50ae1b8ebdc06b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#&, const PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 101 | { |
| 102 | return jsNumbercxx . . $ QTJSC/jsNumber(88e66938454912cb).(exec, asRegExpObjectcxx . . $ QTJSC/asRegExpObject(b4b81e749ecabfea).(slot.slotBasecxx . . $ QTJSC/PropertySlot#slotBase(888c053acf364da1).())->lastIndexcxx . . $ QTJSC/RegExpObject#lastIndex(21b6c25e127938e2).()); |
| 103 | } |
| 104 | |
| 105 | void RegExpObjectcxx . . $ QTJSC/RegExpObject#::putcxx . . $ QTJSC/RegExpObject#put(dfb3133dafbe9ff4).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, JSValuecxx . . $ QTJSC/JSValue# value, PutPropertySlotcxx . . $ QTJSC/PutPropertySlot#& slot) |
| 106 | { |
| 107 | lookupPutcxx . . $ QTJSC/lookupPut(a71e883b485a30dd).<RegExpObjectcxx . . $ QTJSC/RegExpObject#, JSObjectcxx . . $ QTJSC/JSObject#>(exec, propertyName, value, ExecStatecxx . . $ QTJSC/ExecState#::regExpTablecxx . . $ QTJSC/ExecState#regExpTable(3f6af30e59383ee).(exec), this, slot); |
| 108 | } |
| 109 | |
| 110 | void setRegExpObjectLastIndexcxx . . $ QTJSC/setRegExpObjectLastIndex(30009bd3df25a93).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#* baseObject, JSValuecxx . . $ QTJSC/JSValue# value) |
| 111 | { |
| 112 | asRegExpObjectcxx . . $ QTJSC/asRegExpObject(b4b81e749ecabfea).(baseObject)->setLastIndexcxx . . $ QTJSC/RegExpObject#setLastIndex(ba8836b59fb42830).(value.toIntegercxx . . $ QTJSC/JSValue#toInteger(1fd034e372fd1279).(exec)); |
| 113 | } |
| 114 | |
| 115 | JSValuecxx . . $ QTJSC/JSValue# RegExpObjectcxx . . $ QTJSC/RegExpObject#::testcxx . . $ QTJSC/RegExpObject#test(ea6737424ad1a2f7).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 116 | { |
| 117 | return jsBooleancxx . . $ QTJSC/jsBoolean(b805946c4147dfe1).(matchcxx . . $ QTJSC/RegExpObject#match(baea6669571f6a4c).(exec, args)); |
| 118 | } |
| 119 | |
| 120 | JSValuecxx . . $ QTJSC/JSValue# RegExpObjectcxx . . $ QTJSC/RegExpObject#::execcxx . . $ QTJSC/RegExpObject#exec(ea6737424ad1a2f7).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 121 | { |
| 122 | if (matchcxx . . $ QTJSC/RegExpObject#match(baea6669571f6a4c).(exec, args)) |
| 123 | return exec->lexicalGlobalObjectcxx . . $ QTJSC/ExecState#lexicalGlobalObject(3d50c730b5e26899).()->regExpConstructorcxx . . $ QTJSC/JSGlobalObject#regExpConstructor(a3203704c8a72071).()->arrayOfMatchescxx . . $ QTJSC/RegExpConstructor#arrayOfMatches(8709ed4849a165ab).(exec); |
| 124 | return jsNullcxx . . $ QTJSC/jsNull(ad9afe69d7bf6378).(); |
| 125 | } |
| 126 | |
| 127 | static JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! callRegExpObjectcxx . . $ QTJSC/callRegExpObject(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#* function, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 128 | { |
| 129 | return asRegExpObjectcxx . . $ QTJSC/asRegExpObject(b4b81e749ecabfea).(function)->execcxx . . $ QTJSC/RegExpObject#exec(ea6737424ad1a2f7).(exec, args); |
| 130 | } |
| 131 | |
| 132 | CallTypecxx . . $ QTJSC/CallType# RegExpObjectcxx . . $ QTJSC/RegExpObject#::getCallDatacxx . . $ QTJSC/RegExpObject#getCallData(9482040cf952d29d).(CallDatacxx . . $ QTJSC/CallData#& callData) |
| 133 | { |
| 134 | callData.nativecxx . . $ QTJSC/CallData#native..functioncxx . . $ QTJSC/CallData#$anonymous_type_0#function. =cxx . . $ QTJSC/NativeFuncWrapper#`operator=`(d9f3a0596fbce81c). callRegExpObjectcxx . . $ QTJSC/callRegExpObject(cac2aec6ecb9506b).; |
| 135 | return CallTypeHostcxx . . $ QTJSC/CallTypeHost.; |
| 136 | } |
| 137 | |
| 138 | // Shared implementation used by test and exec. |
| 139 | bool RegExpObjectcxx . . $ QTJSC/RegExpObject#::matchcxx . . $ QTJSC/RegExpObject#match(baea6669571f6a4c).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 140 | { |
| 141 | RegExpConstructorcxx . . $ QTJSC/RegExpConstructor#* regExpConstructor = exec->lexicalGlobalObjectcxx . . $ QTJSC/ExecState#lexicalGlobalObject(3d50c730b5e26899).()->regExpConstructorcxx . . $ QTJSC/JSGlobalObject#regExpConstructor(a3203704c8a72071).(); |
| 142 | |
| 143 | UStringcxx . . $ QTJSC/UString# input = argscxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d)..isEmptycxx . . $ QTJSC/ArgList#isEmpty(50ce9a9e25b4a850).() ? regExpConstructorcxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).->inputcxx . . $ QTJSC/RegExpConstructor#input(de21ee9ecbd506fd).() : argscxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d)..atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0).toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec); |
| 144 | if (input.isNullcxx . . $ QTJSC/UString#isNull(50ce9a9e25b4a850).()) { |
| 145 | throwErrorcxx . . $ QTJSC/throwError(7b4507467ace1137).(exec, GeneralErrorcxx . . $ QTJSC/GeneralError., makeStringcxx . . $ QTJSC/makeString(b1788f951b46c19b).("No input to ", toStringcxx . . $ QTJSC/JSObject#toString(9c94f5abb1995042).(exec), ".")); |
| 146 | return false; |
| 147 | } |
| 148 | |
| 149 | if (!regExpcxx . . $ QTJSC/RegExpObject#regExp(4a8334b8e2c199f0).()->globalcxx . . $ QTJSC/RegExp#global(50ce9a9e25b4a850).()) { |
| 150 | int position; |
| 151 | int length; |
| 152 | regExpConstructor->performMatchcxx . . $ QTJSC/RegExpConstructor#performMatch(9ce3bbb5be6c08e5).(d->regExp.get(), input, 0, position, length); |
| 153 | return position >= 0; |
| 154 | } |
| 155 | |
| 156 | if (d->lastIndex < 0 || d->lastIndex > input.size()) { |
| 157 | d->lastIndex = 0; |
| 158 | return false; |
| 159 | } |
| 160 | |
| 161 | int position; |
| 162 | int length = 0; |
| 163 | regExpConstructor->performMatchcxx . . $ QTJSC/RegExpConstructor#performMatch(9ce3bbb5be6c08e5).(d->regExp.get(), input, static_cast<int>(d->lastIndex), position, length); |
| 164 | if (position < 0) { |
| 165 | d->lastIndex = 0; |
| 166 | return false; |
| 167 | } |
| 168 | |
| 169 | d->lastIndex = position + length; |
| 170 | return true; |
| 171 | } |
| 172 | |
| 173 | } // namespace JSC |