Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/filter/RegExpFilter.cpp

Issue 29581602: Issue 5141 - [emscripten] Convert filter matcher to C++ Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created Oct. 17, 2017, 12:31 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiled/filter/RegExpFilter.cpp
===================================================================
--- a/compiled/filter/RegExpFilter.cpp
+++ b/compiled/filter/RegExpFilter.cpp
@@ -305,22 +305,24 @@ Filter::Type RegExpFilter::Parse(Depende
data.mPatternEnd = text.find(u'$', data.mPatternStart);
if (data.mPatternEnd == text.npos)
data.mPatternEnd = text.length();
ParseOptions(text, error, data, data.mPatternEnd + 1);
if (!error.empty())
return Type::INVALID;
+ data.mRegexpId = -1;
if (data.mPatternEnd - data.mPatternStart >= 2 &&
text[data.mPatternStart] == u'/' &&
text[data.mPatternEnd - 1] == u'/')
{
- data.SetRegExp(GenerateRegExp(DependentString(text, data.mPatternStart + 1,
- data.mPatternEnd - data.mPatternStart - 2), data.mMatchCase));
+ data.mRegexpId = GenerateRegExp(DependentString(text,
+ data.mPatternStart + 1, data.mPatternEnd - data.mPatternStart - 2),
+ data.mMatchCase);
if (data.mRegexpId == -1)
{
error.reset(u"filter_invalid_regexp"_str);
return Type::INVALID;
}
}
return type;
@@ -386,12 +388,12 @@ bool RegExpFilter::Matches(const String&
!IsActiveOnDomain(docDomain, sitekey))
{
return false;
}
if (!mData.RegExpParsingDone())
{
const OwnedString pattern(mData.GetRegExpSource(mText));
sergei 2017/10/18 10:58:42 BTW, `pattern` should be a DependentString there i
- mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase));
+ mData.mRegexpId = GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase);
}
return TestRegExp(mData.mRegexpId, location);
}

Powered by Google App Engine
This is Rietveld