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)