summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/yarr/RegexPattern.h
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/yarr/RegexPattern.h')
-rw-r--r--JavaScriptCore/yarr/RegexPattern.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/JavaScriptCore/yarr/RegexPattern.h b/JavaScriptCore/yarr/RegexPattern.h
index c76c641..74ee897 100644
--- a/JavaScriptCore/yarr/RegexPattern.h
+++ b/JavaScriptCore/yarr/RegexPattern.h
@@ -39,7 +39,7 @@ namespace JSC { namespace Yarr {
#define RegexStackSpaceForBackTrackInfoParentheticalAssertion 1
#define RegexStackSpaceForBackTrackInfoParenthesesOnce 1 // Only for !fixed quantifiers.
#define RegexStackSpaceForBackTrackInfoParenthesesTerminal 1
-#define RegexStackSpaceForBackTrackInfoParentheses 4
+#define RegexStackSpaceForBackTrackInfoParentheses 2
struct PatternDisjunction;
@@ -103,11 +103,12 @@ struct PatternTerm {
TypeParenthesesSubpattern,
TypeParentheticalAssertion,
} type;
- bool invertOrCapture;
+ bool m_capture :1;
+ bool m_invert :1;
union {
UChar patternCharacter;
CharacterClass* characterClass;
- unsigned subpatternId;
+ unsigned backReferenceSubpatternId;
struct {
PatternDisjunction* disjunction;
unsigned subpatternId;
@@ -123,6 +124,8 @@ struct PatternTerm {
PatternTerm(UChar ch)
: type(PatternTerm::TypePatternCharacter)
+ , m_capture(false)
+ , m_invert(false)
{
patternCharacter = ch;
quantityType = QuantifierFixedCount;
@@ -131,16 +134,18 @@ struct PatternTerm {
PatternTerm(CharacterClass* charClass, bool invert)
: type(PatternTerm::TypeCharacterClass)
- , invertOrCapture(invert)
+ , m_capture(false)
+ , m_invert(invert)
{
characterClass = charClass;
quantityType = QuantifierFixedCount;
quantityCount = 1;
}
- PatternTerm(Type type, unsigned subpatternId, PatternDisjunction* disjunction, bool invertOrCapture)
+ PatternTerm(Type type, unsigned subpatternId, PatternDisjunction* disjunction, bool capture = false, bool invert = false)
: type(type)
- , invertOrCapture(invertOrCapture)
+ , m_capture(capture)
+ , m_invert(invert)
{
parentheses.disjunction = disjunction;
parentheses.subpatternId = subpatternId;
@@ -152,7 +157,8 @@ struct PatternTerm {
PatternTerm(Type type, bool invert = false)
: type(type)
- , invertOrCapture(invert)
+ , m_capture(false)
+ , m_invert(invert)
{
quantityType = QuantifierFixedCount;
quantityCount = 1;
@@ -160,9 +166,10 @@ struct PatternTerm {
PatternTerm(unsigned spatternId)
: type(TypeBackReference)
- , invertOrCapture(false)
+ , m_capture(false)
+ , m_invert(false)
{
- subpatternId = spatternId;
+ backReferenceSubpatternId = spatternId;
quantityType = QuantifierFixedCount;
quantityCount = 1;
}
@@ -189,12 +196,12 @@ struct PatternTerm {
bool invert()
{
- return invertOrCapture;
+ return m_invert;
}
bool capture()
{
- return invertOrCapture;
+ return m_capture;
}
void quantify(unsigned count, QuantifierType type)