Skip to content

Commit

Permalink
Fix minor defect in Yarr
Browse files Browse the repository at this point in the history
Signed-off-by: HyukWoo Park <[email protected]>
  • Loading branch information
clover2123 authored and ksh8281 committed Sep 9, 2024
1 parent e801bb6 commit 6a0087c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions third_party/yarr/YarrPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,10 @@ class YarrPatternConstructor {
public:
YarrPatternConstructor(YarrPattern& pattern)
: m_pattern(pattern)
, m_alternative(nullptr)
, m_baseCharacterClassConstructor(pattern.ignoreCase(), pattern.compileMode())
, m_currentCharacterClassConstructor(nullptr)
, m_invertCharacterClass(false)
{
m_currentCharacterClassConstructor = &m_baseCharacterClassConstructor;
auto body = makeUnique<PatternDisjunction>();
Expand Down
15 changes: 15 additions & 0 deletions third_party/yarr/YarrPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ struct PatternTerm {
patternCharacter = ch;
quantityType = QuantifierType::FixedCount;
quantityMinCount = quantityMaxCount = 1;
inputPosition = 0;
frameLocation = 0;
}

PatternTerm(CharacterClass* charClass, bool invert, MatchDirection matchDirection = Forward)
Expand All @@ -229,6 +231,8 @@ struct PatternTerm {
characterClass = charClass;
quantityType = QuantifierType::FixedCount;
quantityMinCount = quantityMaxCount = 1;
inputPosition = 0;
frameLocation = 0;
}

PatternTerm(Type type, unsigned subpatternId, PatternDisjunction* disjunction, bool capture = false, bool invert = false, MatchDirection matchDirection = Forward)
Expand All @@ -243,6 +247,8 @@ struct PatternTerm {
parentheses.isTerminal = false;
quantityType = QuantifierType::FixedCount;
quantityMinCount = quantityMaxCount = 1;
inputPosition = 0;
frameLocation = 0;
}

PatternTerm(Type type, bool invert = false)
Expand All @@ -253,6 +259,8 @@ struct PatternTerm {
{
quantityType = QuantifierType::FixedCount;
quantityMinCount = quantityMaxCount = 1;
inputPosition = 0;
frameLocation = 0;
}

PatternTerm(unsigned spatternId)
Expand All @@ -264,6 +272,8 @@ struct PatternTerm {
backReferenceSubpatternId = spatternId;
quantityType = QuantifierType::FixedCount;
quantityMinCount = quantityMaxCount = 1;
inputPosition = 0;
frameLocation = 0;
}

PatternTerm(bool bolAnchor, bool eolAnchor)
Expand All @@ -276,6 +286,8 @@ struct PatternTerm {
anchors.eolAnchor = eolAnchor;
quantityType = QuantifierType::FixedCount;
quantityMinCount = quantityMaxCount = 1;
inputPosition = 0;
frameLocation = 0;
}

static PatternTerm ForwardReference()
Expand Down Expand Up @@ -360,6 +372,7 @@ struct PatternAlternative {
public:
PatternAlternative(PatternDisjunction* disjunction, unsigned firstSubpatternId, MatchDirection matchDirection = Forward)
: m_parent(disjunction)
, m_minimumSize(0)
, m_firstSubpatternId(firstSubpatternId)
, m_lastSubpatternId(0)
, m_direction(matchDirection)
Expand Down Expand Up @@ -436,6 +449,8 @@ struct PatternDisjunction {
public:
PatternDisjunction(PatternAlternative* parent = nullptr)
: m_parent(parent)
, m_minimumSize(0)
, m_callFrameSize(0)
, m_hasFixedSize(false)
{
}
Expand Down

0 comments on commit 6a0087c

Please sign in to comment.