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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 AddSitekey(DependentString(sitekeys, start, scanner.position() - start))
; | 346 AddSitekey(DependentString(sitekeys, start, scanner.position() - start))
; |
347 start = scanner.position() + 1; | 347 start = scanner.position() + 1; |
348 } | 348 } |
349 } | 349 } |
350 } | 350 } |
351 | 351 |
352 void RegExpFilter::GenerateCustomBindings() | 352 void RegExpFilter::GenerateCustomBindings() |
353 { | 353 { |
354 printf("exports.RegExpFilter.typeMap = {\n"); | 354 printf("exports.RegExpFilter.typeMap = {\n"); |
355 | 355 |
356 for (const auto& it : typeMap) | 356 for (const auto& item : typeMap) |
357 { | 357 { |
358 std::string type(it.first.length(), '\0'); | 358 std::string type(item.first.length(), '\0'); |
359 for (int i = 0; i < it.first.length(); i++) | 359 for (int i = 0; i < item.first.length(); i++) |
360 type[i] = (it.first[i] == '-' ? '_' : toupper(it.first[i])); | 360 type[i] = (item.first[i] == '-' ? '_' : toupper(item.first[i])); |
361 printf(" %s: %i,\n", type.c_str(), it.second); | 361 printf(" %s: %i,\n", type.c_str(), item.second); |
362 } | 362 } |
363 printf("};\n"); | 363 printf("};\n"); |
364 } | 364 } |
365 | 365 |
366 RegExpFilter::DomainMap* RegExpFilter::GetDomains() const | 366 RegExpFilter::DomainMap* RegExpFilter::GetDomains() const |
367 { | 367 { |
368 if (!mData.DomainsParsingDone()) | 368 if (!mData.DomainsParsingDone()) |
369 { | 369 { |
370 ParseDomains(mData.GetDomainsSource(mText), u'|'); | 370 ParseDomains(mData.GetDomainsSource(mText), u'|'); |
371 mData.SetDomainsParsingDone(); | 371 mData.SetDomainsParsingDone(); |
(...skipping 22 matching lines...) Expand all Loading... |
394 return false; | 394 return false; |
395 } | 395 } |
396 | 396 |
397 if (!mData.RegExpParsingDone()) | 397 if (!mData.RegExpParsingDone()) |
398 { | 398 { |
399 const OwnedString pattern(mData.GetRegExpSource(mText)); | 399 const OwnedString pattern(mData.GetRegExpSource(mText)); |
400 mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
; | 400 mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
; |
401 } | 401 } |
402 return EM_ASM_INT(return regexps.test($0, $1), mData.mRegexpId, &location); | 402 return EM_ASM_INT(return regexps.test($0, $1), mData.mRegexpId, &location); |
403 } | 403 } |
LEFT | RIGHT |