Shell: Correctly handle commands after heredoc contents

Previously we did not emit a newline after the ending heredoc key, which
wreaked havoc on the parser logic, leading to parse errors.
This commit is contained in:
Ali Mohammad Pur 2023-04-18 16:48:01 +03:30 committed by Ali Mohammad Pur
commit 7b031138fc
Notes: sideshowbarker 2024-07-17 07:43:44 +09:00
4 changed files with 11 additions and 1 deletions

View file

@ -581,9 +581,13 @@ ErrorOr<Lexer::ReductionResult> Lexer::reduce_start()
m_state.on_new_line = true;
m_state.buffer.clear();
m_state.position.start_offset = m_state.position.end_offset;
m_state.position.start_line = m_state.position.end_line;
Vector<Token> tokens { move(token), Token::newline() };
return ReductionResult {
.tokens = { move(token) },
.tokens = move(tokens),
.next_reduction = Reduction::Start,
};
}