Index: shell/src/Main.cpp |
=================================================================== |
--- a/shell/src/Main.cpp |
+++ b/shell/src/Main.cpp |
@@ -60,34 +60,33 @@ |
LibFileReader fileReader; |
CerrErrorCallback errorCallback; |
AdblockPlus::JsEngine jsEngine(&fileReader, 0); |
- jsEngine.Load("adblockplus_compat.js"); |
- jsEngine.Load("adblockplus.js"); |
+ AdblockPlus::FilterEngine filterEngine(jsEngine); |
CommandMap commands; |
Add(commands, new GcCommand(jsEngine)); |
Add(commands, new HelpCommand(commands)); |
- Add(commands, new SubscriptionsCommand(jsEngine)); |
- Add(commands, new MatchesCommand()); |
+ Add(commands, new SubscriptionsCommand(filterEngine)); |
+ Add(commands, new MatchesCommand(filterEngine)); |
std::string commandLine; |
while (ReadCommandLine(commandLine)) |
+ { |
+ std::string commandName; |
+ std::string arguments; |
+ ParseCommandLine(commandLine, commandName, arguments); |
+ const CommandMap::const_iterator it = commands.find(commandName); |
+ try |
{ |
- std::string commandName; |
- std::string arguments; |
- ParseCommandLine(commandLine, commandName, arguments); |
- const CommandMap::const_iterator it = commands.find(commandName); |
- try |
- { |
- if (it != commands.end()) |
- (*it->second)(arguments); |
- else |
- throw NoSuchCommandError(commandName); |
- } |
- catch (NoSuchCommandError error) |
- { |
- std::cout << error.what() << std::endl; |
- } |
+ if (it != commands.end()) |
+ (*it->second)(arguments); |
+ else |
+ throw NoSuchCommandError(commandName); |
} |
+ catch (NoSuchCommandError error) |
+ { |
+ std::cout << error.what() << std::endl; |
+ } |
+ } |
} |
catch (const std::exception& e) |
{ |