forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRegexPattern.h
More file actions
86 lines (67 loc) · 2.6 KB
/
RegexPattern.h
File metadata and controls
86 lines (67 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
namespace Js
{
class JavascriptLibrary;
}
namespace UnifiedRegex
{
struct Program;
class Matcher;
struct TrigramInfo;
static const uint TestCacheSize = 8;
struct RegExpTestCache
{
Field(BVStatic<TestCacheSize>) resultBV;
Field(RecyclerWeakReference<Js::JavascriptString>*) inputArray[];
};
struct RegexPattern : FinalizableObject
{
Field(RegExpTestCache*) testCache;
struct UnifiedRep
{
Field(Program*) program;
Field(Matcher*) matcher;
Field(TrigramInfo*) trigramInfo;
};
Field(Js::JavascriptLibrary *) const library;
Field(bool) isLiteral : 1;
Field(bool) isShallowClone : 1;
union Rep
{
Field(UnifiedRep) unified;
Rep() : unified() {}
};
Field(Rep) rep;
RegexPattern(Js::JavascriptLibrary *const library, Program* program, bool isLiteral);
static RegexPattern *New(Js::ScriptContext *scriptContext, Program* program, bool isLiteral);
virtual void Finalize(bool isShutdown) override;
virtual void Dispose(bool isShutdown) override;
virtual void Mark(Recycler *recycler) override { AssertMsg(false, "Mark called on object that isn't TrackableObject"); }
Js::ScriptContext *GetScriptContext() const;
inline bool IsLiteral() const { return isLiteral; }
uint16 NumGroups() const;
bool IsIgnoreCase() const;
bool IsGlobal() const;
bool IsMultiline() const;
bool IsDotAll() const;
bool IsUnicode() const;
bool IsSticky() const;
bool WasLastMatchSuccessful() const;
GroupInfo GetGroup(int groupId) const;
Js::InternalString GetSource() const;
RegexFlags GetFlags() const;
Field(RegExpTestCache*) EnsureTestCache();
static uint GetTestCacheIndex(Js::JavascriptString* str);
#if ENABLE_REGEX_CONFIG_OPTIONS
void Print(DebugWriter* w);
#endif
RegexPattern *CopyToScriptContext(Js::ScriptContext *scriptContext);
#if ENABLE_REGEX_CONFIG_OPTIONS
static void TraceTestCache(bool cacheHit, Js::JavascriptString* input, Js::JavascriptString* cachedValue, bool disabled);
#endif
};
}