From 407782a7427818eb03ba060b87d324bd1ea8f490 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 2 Aug 2012 06:41:55 +0200 Subject: [PATCH] command_manager.cc: use anonymous namespace --- src/command_manager.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/command_manager.cc b/src/command_manager.cc index 494b9317..a0c8b61c 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -30,6 +30,9 @@ void CommandManager::register_commands(const memoryview& command_names, register_command(command_name, command, completer); } +namespace +{ + struct Token { enum class Type @@ -57,18 +60,18 @@ private: using TokenList = std::vector; using TokenPosList = std::vector>; -static bool is_command_separator(Character c) +bool is_command_separator(Character c) { return c == ';' or c == '\n'; } -static bool is_horizontal_blank(char c) +bool is_horizontal_blank(char c) { return c == ' ' or c == '\t'; } -static TokenList parse(const String& line, - TokenPosList* opt_token_pos_info = NULL) +TokenList parse(const String& line, + TokenPosList* opt_token_pos_info = NULL) { TokenList result; @@ -169,10 +172,8 @@ static TokenList parse(const String& line, return result; } -static void shell_eval(TokenList& params, - const String& cmdline, - const Context& context, - const EnvVarMap& env_vars) +void shell_eval(TokenList& params, const String& cmdline, + const Context& context, const EnvVarMap& env_vars) { String output = ShellManager::instance().eval(cmdline, context, env_vars); TokenList tokens = parse(output); @@ -181,6 +182,8 @@ static void shell_eval(TokenList& params, params.push_back(std::move(token)); } +} + struct command_not_found : runtime_error { command_not_found(const String& command)