Rename eval(_token)? to expand(_token)? and use a const Context
This commit is contained in:
parent
4e89cbfe83
commit
d3607bc773
|
@ -262,11 +262,11 @@ TokenList parse(StringView line)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
String eval_token(const Token& token, Context& context,
|
String expand_token(const Token& token, const Context& context,
|
||||||
ConstArrayView<String> shell_params,
|
ConstArrayView<String> shell_params,
|
||||||
const EnvVarMap& env_vars);
|
const EnvVarMap& env_vars);
|
||||||
|
|
||||||
String eval(StringView str, Context& context,
|
String expand(StringView str, const Context& context,
|
||||||
ConstArrayView<String> shell_params,
|
ConstArrayView<String> shell_params,
|
||||||
const EnvVarMap& env_vars)
|
const EnvVarMap& env_vars)
|
||||||
{
|
{
|
||||||
|
@ -286,7 +286,7 @@ String eval(StringView str, Context& context,
|
||||||
else if (str[pos] == '%')
|
else if (str[pos] == '%')
|
||||||
{
|
{
|
||||||
Token token = parse_percent_token<true>(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;
|
++pos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -295,7 +295,7 @@ String eval(StringView str, Context& context,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
String eval_token(const Token& token, Context& context,
|
String expand_token(const Token& token, const Context& context,
|
||||||
ConstArrayView<String> shell_params,
|
ConstArrayView<String> shell_params,
|
||||||
const EnvVarMap& env_vars)
|
const EnvVarMap& env_vars)
|
||||||
{
|
{
|
||||||
|
@ -317,7 +317,7 @@ String eval_token(const Token& token, Context& context,
|
||||||
return ShellManager::instance().get_val(content, context);
|
return ShellManager::instance().get_val(content, context);
|
||||||
}
|
}
|
||||||
case Token::Type::RawEval:
|
case Token::Type::RawEval:
|
||||||
return eval(content, context, shell_params, env_vars);
|
return expand(content, context, shell_params, env_vars);
|
||||||
case Token::Type::Raw:
|
case Token::Type::Raw:
|
||||||
return content;
|
return content;
|
||||||
default: kak_assert(false);
|
default: kak_assert(false);
|
||||||
|
@ -410,7 +410,7 @@ void CommandManager::execute(StringView command_line,
|
||||||
// Shell expand are retokenized
|
// Shell expand are retokenized
|
||||||
else if (it->type() == Token::Type::ShellExpand)
|
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,
|
shell_params,
|
||||||
env_vars));
|
env_vars));
|
||||||
it = tokens.erase(it);
|
it = tokens.erase(it);
|
||||||
|
@ -423,7 +423,7 @@ void CommandManager::execute(StringView command_line,
|
||||||
it -= shell_tokens.size() + 1;
|
it -= shell_tokens.size() + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
params.push_back(eval_token(*it, context, shell_params,
|
params.push_back(expand_token(*it, context, shell_params,
|
||||||
env_vars));
|
env_vars));
|
||||||
}
|
}
|
||||||
execute_single_command(params, context, command_coord);
|
execute_single_command(params, context, command_coord);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user