Rename eval(_token)? to expand(_token)? and use a const Context

This commit is contained in:
Maxime Coste 2015-04-30 09:33:08 +01:00
parent 4e89cbfe83
commit d3607bc773

View File

@ -262,11 +262,11 @@ TokenList parse(StringView line)
return result;
}
String eval_token(const Token& token, Context& context,
String expand_token(const Token& token, const Context& context,
ConstArrayView<String> shell_params,
const EnvVarMap& env_vars);
String eval(StringView str, Context& context,
String expand(StringView str, const Context& context,
ConstArrayView<String> shell_params,
const EnvVarMap& env_vars)
{
@ -286,7 +286,7 @@ String eval(StringView str, Context& context,
else if (str[pos] == '%')
{
Token token = parse_percent_token<true>(str, pos);
res += eval_token(token, context, shell_params, env_vars);
res += expand_token(token, context, shell_params, env_vars);
++pos;
}
else
@ -295,7 +295,7 @@ String eval(StringView str, Context& context,
return res;
}
String eval_token(const Token& token, Context& context,
String expand_token(const Token& token, const Context& context,
ConstArrayView<String> shell_params,
const EnvVarMap& env_vars)
{
@ -317,7 +317,7 @@ String eval_token(const Token& token, Context& context,
return ShellManager::instance().get_val(content, context);
}
case Token::Type::RawEval:
return eval(content, context, shell_params, env_vars);
return expand(content, context, shell_params, env_vars);
case Token::Type::Raw:
return content;
default: kak_assert(false);
@ -410,7 +410,7 @@ void CommandManager::execute(StringView command_line,
// Shell expand are retokenized
else if (it->type() == Token::Type::ShellExpand)
{
auto shell_tokens = parse<true>(eval_token(*it, context,
auto shell_tokens = parse<true>(expand_token(*it, context,
shell_params,
env_vars));
it = tokens.erase(it);
@ -423,7 +423,7 @@ void CommandManager::execute(StringView command_line,
it -= shell_tokens.size() + 1;
}
else
params.push_back(eval_token(*it, context, shell_params,
params.push_back(expand_token(*it, context, shell_params,
env_vars));
}
execute_single_command(params, context, command_coord);