mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
Shell: Correctly keep track of special parameter length
We were previously treating special expansions (e.g. $#) as zero-length expansions, which made the shell repeat them literally after expanding them.
This commit is contained in:
parent
6da438e992
commit
a6d77162f4
1 changed files with 3 additions and 1 deletions
|
@ -751,7 +751,9 @@ Lexer::ReductionResult Lexer::reduce_special_parameter_expansion()
|
||||||
.parameter = StringBuilder {},
|
.parameter = StringBuilder {},
|
||||||
.range = range(-1),
|
.range = range(-1),
|
||||||
};
|
};
|
||||||
m_state.expansions.last().get<ParameterExpansion>().parameter.append(ch);
|
auto& expansion = m_state.expansions.last().get<ParameterExpansion>();
|
||||||
|
expansion.parameter.append(ch);
|
||||||
|
expansion.range.length = m_state.position.end_offset - expansion.range.start - m_state.position.start_offset;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
.tokens = {},
|
.tokens = {},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue