fix special variables in arithmetics
This commit is contained in:
parent
3b10ce9e52
commit
28e8503b86
1 changed files with 11 additions and 2 deletions
|
|
@ -416,9 +416,9 @@ std::string parenthesis_arithmetic::generate(int ind)
|
|||
std::string ret;
|
||||
ret += '(';
|
||||
if(!opt_minimize) ret += ' ';
|
||||
ret += val->generate(ind);
|
||||
ret += val->generate(ind);
|
||||
if(!opt_minimize) ret += ' ';
|
||||
ret += ')';
|
||||
ret += ')';
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -427,6 +427,14 @@ std::string subshell_arithmetic::generate(int ind)
|
|||
return '$' + sbsh->generate(ind);
|
||||
}
|
||||
|
||||
std::string variable_arithmetic::generate(int ind)
|
||||
{
|
||||
std::string ret=var->generate(ind);
|
||||
if(is_num(ret[0]) || is_in(ret[0], SPECIAL_VARS))
|
||||
return '$' + ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string variable::generate(int ind)
|
||||
{
|
||||
if(index!=nullptr)
|
||||
|
|
@ -437,6 +445,7 @@ std::string variable::generate(int ind)
|
|||
return varname;
|
||||
}
|
||||
|
||||
|
||||
// TEMPLATE
|
||||
|
||||
// std::string thing::generate(int ind)
|
||||
|
|
|
|||
Loading…
Reference in a new issue