• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ECMASCRIPT_JSREGEXP_H
17 #define ECMASCRIPT_JSREGEXP_H
18 
19 #include "ecmascript/ecma_macros.h"
20 #include "ecmascript/js_object.h"
21 #include "ecmascript/js_hclass.h"
22 #include "ecmascript/js_tagged_value-inl.h"
23 
24 namespace panda::ecmascript {
25 class JSRegExp : public JSObject {
26 public:
27     static constexpr int EXEC_INLINE_PROPERTY_INDEX = 1;
28     static constexpr int SPLIT_INLINE_PROPERTY_INDEX = 13;
29     static constexpr int SEARCH_INLINE_PROPERTY_INDEX = 14;
30     static constexpr int MATCH_INLINE_PROPERTY_INDEX = 15;
31     static constexpr int MATCHALL_INLINE_PROPERTY_INDEX = 16;
32     static constexpr int REPLACE_INLINE_PROPERTY_INDEX = 17;
33 
34     CAST_CHECK(JSRegExp, IsJSRegExp);
35 
36     static constexpr size_t REGEXP_BYTE_CODE_OFFSET = JSObject::SIZE;
37     ACCESSORS(ByteCodeBuffer, REGEXP_BYTE_CODE_OFFSET, ORIGINAL_SOURCE_OFFSET)
38     ACCESSORS_WITH_RB_MODE(OriginalSource, ORIGINAL_SOURCE_OFFSET, ORIGINAL_FLAGS_OFFSET)
39     ACCESSORS_WITH_RB_MODE(OriginalFlags, ORIGINAL_FLAGS_OFFSET, GROUP_NAME_OFFSET)
40     ACCESSORS(GroupName, GROUP_NAME_OFFSET, LENGTH_OFFSET)
41     ACCESSORS_PRIMITIVE_FIELD(Length, uint32_t, LENGTH_OFFSET, LAST_OFFSET)
42     DEFINE_ALIGN_SIZE(LAST_OFFSET);
43 
44     DECL_VISIT_OBJECT_FOR_JS_OBJECT(JSObject, REGEXP_BYTE_CODE_OFFSET, LENGTH_OFFSET)
45 
46     DECL_DUMP()
47 };
48 }  // namespace panda::ecmascript
49 
50 #endif  // ECMASCRIPT_JSPRIMITIVEREF_H
51