| 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 | 
|   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 <emscripten.h> |  | 
|   24  |  | 
|   25 #include "RegExpFilter.h" |   23 #include "RegExpFilter.h" | 
 |   24 #include "../library.h" | 
|   26 #include "../StringScanner.h" |   25 #include "../StringScanner.h" | 
|   27 #include "../StringMap.h" |   26 #include "../StringMap.h" | 
|   28  |  | 
|   29 extern "C" |  | 
|   30 { |  | 
|   31   int GenerateRegExp(const String& regexp, bool matchCase); |  | 
|   32   void DeleteRegExp(int id); |  | 
|   33   bool TestRegExp(int id, const String& str); |  | 
|   34 } |  | 
|   35  |   27  | 
|   36 namespace |   28 namespace | 
|   37 { |   29 { | 
|   38   enum |   30   enum | 
|   39   { |   31   { | 
|   40     TYPE_OTHER = 0x1, |   32     TYPE_OTHER = 0x1, | 
|   41     TYPE_SCRIPT = 0x2, |   33     TYPE_SCRIPT = 0x2, | 
|   42     TYPE_IMAGE = 0x4, |   34     TYPE_IMAGE = 0x4, | 
|   43     TYPE_STYLESHEET = 0x8, |   35     TYPE_STYLESHEET = 0x8, | 
|   44     TYPE_OBJECT = 0x10, |   36     TYPE_OBJECT = 0x10, | 
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  396     return false; |  388     return false; | 
|  397   } |  389   } | 
|  398  |  390  | 
|  399   if (!mData.RegExpParsingDone()) |  391   if (!mData.RegExpParsingDone()) | 
|  400   { |  392   { | 
|  401     const OwnedString pattern(mData.GetRegExpSource(mText)); |  393     const OwnedString pattern(mData.GetRegExpSource(mText)); | 
|  402     mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
     ; |  394     mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
     ; | 
|  403   } |  395   } | 
|  404   return TestRegExp(mData.mRegexpId, location); |  396   return TestRegExp(mData.mRegexpId, location); | 
|  405 } |  397 } | 
| LEFT | RIGHT |