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

Side by Side Diff: compiled/filter/RegExpFilter.cpp

Issue 29556737: Issue 5141 - Convert filter match to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Fixed many issues. One test left out. Created Oct. 6, 2017, 1:45 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 308
309 ParseOptions(text, error, data, data.mPatternEnd + 1); 309 ParseOptions(text, error, data, data.mPatternEnd + 1);
310 if (!error.empty()) 310 if (!error.empty())
311 return Type::INVALID; 311 return Type::INVALID;
312 312
313 if (data.mPatternEnd - data.mPatternStart >= 2 && 313 if (data.mPatternEnd - data.mPatternStart >= 2 &&
314 text[data.mPatternStart] == u'/' && 314 text[data.mPatternStart] == u'/' &&
315 text[data.mPatternEnd - 1] == u'/') 315 text[data.mPatternEnd - 1] == u'/')
316 { 316 {
317 data.SetRegExp(GenerateRegExp(DependentString(text, data.mPatternStart + 1, 317 data.SetRegExp(GenerateRegExp(DependentString(text, data.mPatternStart + 1,
318 data.mPatternEnd - data.mPatternStart - 2), data.mMatchCase)); 318 data.mPatternEnd - data.mPatternStart - 2), data.mMatchCase, false));
319 if (data.mRegexpId == -1) 319 if (data.mRegexpId == -1)
320 { 320 {
321 error.reset(u"filter_invalid_regexp"_str); 321 error.reset(u"filter_invalid_regexp"_str);
322 return Type::INVALID; 322 return Type::INVALID;
323 } 323 }
324 } 324 }
325 325
326 return type; 326 return type;
327 } 327 }
328 328
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 (mData.mThirdParty == TrippleState::YES && !thirdParty) || 384 (mData.mThirdParty == TrippleState::YES && !thirdParty) ||
385 (mData.mThirdParty == TrippleState::NO && thirdParty) || 385 (mData.mThirdParty == TrippleState::NO && thirdParty) ||
386 !IsActiveOnDomain(docDomain, sitekey)) 386 !IsActiveOnDomain(docDomain, sitekey))
387 { 387 {
388 return false; 388 return false;
389 } 389 }
390 390
391 if (!mData.RegExpParsingDone()) 391 if (!mData.RegExpParsingDone())
392 { 392 {
393 const OwnedString pattern(mData.GetRegExpSource(mText)); 393 const OwnedString pattern(mData.GetRegExpSource(mText));
394 mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase)) ; 394 mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase, false));
395 } 395 }
396 return TestRegExp(mData.mRegexpId, location); 396 return TestRegExp(mData.mRegexpId, location);
397 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld