fix backtick parse

This commit is contained in:
Mateo Feron 2021-10-14 15:21:30 +02:00
parent 516fbd5a01
commit 92d5f83b2f

View file

@ -420,6 +420,8 @@ std::pair<variable*, parse_context> parse_manipulation(parse_context ctx)
inline parse_context do_one_subarg_step(arg* ret, parse_context ctx, uint32_t& j, bool is_quoted) inline parse_context do_one_subarg_step(arg* ret, parse_context ctx, uint32_t& j, bool is_quoted)
{ {
if( ctx.i >= ctx.size)
return ctx;
if( ctx[ctx.i] == '`' ) if( ctx[ctx.i] == '`' )
{ {
// add previous subarg // add previous subarg
@ -440,10 +442,12 @@ inline parse_context do_one_subarg_step(arg* ret, parse_context ctx, uint32_t& j
} }
// get subshell // get subshell
parse_context newct = ctx; parse_context newct = ctx;
ctx.size=k; newct.size=k;
auto r=parse_list_until(newct); auto r=parse_list_until(newct);
ret->add(new subshell_subarg(new subshell(std::get<0>(r)), is_quoted)); ret->add(new subshell_subarg(new subshell(std::get<0>(r)), is_quoted));
uint64_t tsize=ctx.size;
ctx = std::get<1>(r); ctx = std::get<1>(r);
ctx.size = tsize;
ctx.i++; ctx.i++;
j = ctx.i; j = ctx.i;
} }