| LEFT | RIGHT | 
|---|
| 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 | 
| 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12  * GNU General Public License for more details. | 12  * GNU General Public License for more details. | 
| 13  * | 13  * | 
| 14  * You should have received a copy of the GNU General Public License | 14  * You should have received a copy of the GNU General Public License | 
| 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 16  */ | 16  */ | 
| 17 | 17 | 
| 18 #include <cctype> | 18 #include <cctype> | 
| 19 #include <climits> | 19 #include <climits> | 
| 20 #include <cstdio> | 20 #include <cstdio> | 
| 21 #include <string> | 21 #include <string> | 
| 22 | 22 | 
| 23 #include "RegExpFilter.h" | 23 #include "RegExpFilter.h" | 
| 24 #include "../library.h" | 24 #include "../library.h" | 
| 25 #include "../StringScanner.h" | 25 #include "../StringScanner.h" | 
| 26 #include "../StringMap.h" | 26 #include "../StringMap.h" | 
|  | 27 | 
|  | 28 ABP_NS_USING | 
| 27 | 29 | 
| 28 namespace | 30 namespace | 
| 29 { | 31 { | 
| 30   enum | 32   enum | 
| 31   { | 33   { | 
| 32     TYPE_OTHER = 0x1, | 34     TYPE_OTHER = 0x1, | 
| 33     TYPE_SCRIPT = 0x2, | 35     TYPE_SCRIPT = 0x2, | 
| 34     TYPE_IMAGE = 0x4, | 36     TYPE_IMAGE = 0x4, | 
| 35     TYPE_STYLESHEET = 0x8, | 37     TYPE_STYLESHEET = 0x8, | 
| 36     TYPE_OBJECT = 0x10, | 38     TYPE_OBJECT = 0x10, | 
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 343   } | 345   } | 
| 344 } | 346 } | 
| 345 | 347 | 
| 346 void RegExpFilter::GenerateCustomBindings() | 348 void RegExpFilter::GenerateCustomBindings() | 
| 347 { | 349 { | 
| 348   printf("exports.RegExpFilter.typeMap = {\n"); | 350   printf("exports.RegExpFilter.typeMap = {\n"); | 
| 349 | 351 | 
| 350   for (const auto& item : typeMap) | 352   for (const auto& item : typeMap) | 
| 351   { | 353   { | 
| 352     std::string type(item.first.length(), '\0'); | 354     std::string type(item.first.length(), '\0'); | 
| 353     for (int i = 0; i < item.first.length(); i++) | 355     for (String::size_type i = 0; i < item.first.length(); i++) | 
| 354       type[i] = (item.first[i] == '-' ? '_' : toupper(item.first[i])); | 356       type[i] = (item.first[i] == '-' ? '_' : toupper(item.first[i])); | 
| 355     printf("  %s: %i,\n", type.c_str(), item.second); | 357     printf("  %s: %i,\n", type.c_str(), item.second); | 
| 356   } | 358   } | 
| 357   printf("};\n"); | 359   printf("};\n"); | 
| 358 } | 360 } | 
| 359 | 361 | 
| 360 RegExpFilter::DomainMap* RegExpFilter::GetDomains() const | 362 RegExpFilter::DomainMap* RegExpFilter::GetDomains() const | 
| 361 { | 363 { | 
| 362   if (!mData.DomainsParsingDone()) | 364   if (!mData.DomainsParsingDone()) | 
| 363   { | 365   { | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 388     return false; | 390     return false; | 
| 389   } | 391   } | 
| 390 | 392 | 
| 391   if (!mData.RegExpParsingDone()) | 393   if (!mData.RegExpParsingDone()) | 
| 392   { | 394   { | 
| 393     const OwnedString pattern(mData.GetRegExpSource(mText)); | 395     const OwnedString pattern(mData.GetRegExpSource(mText)); | 
| 394     mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
     ; | 396     mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
     ; | 
| 395   } | 397   } | 
| 396   return TestRegExp(mData.mRegexpId, location); | 398   return TestRegExp(mData.mRegexpId, location); | 
| 397 } | 399 } | 
| LEFT | RIGHT | 
|---|