From 6da438e9924d77dceebacfb94b2bdaaff9a5f321 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Thu, 16 Feb 2023 21:35:03 +0330 Subject: [PATCH] Shell: Clear expansions after committing a word in the POSIX parser --- Userland/Shell/PosixLexer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Shell/PosixLexer.cpp b/Userland/Shell/PosixLexer.cpp index aa25e05a91..a208fcab5d 100644 --- a/Userland/Shell/PosixLexer.cpp +++ b/Userland/Shell/PosixLexer.cpp @@ -533,6 +533,7 @@ Lexer::ReductionResult Lexer::reduce_start() if (m_lexer.is_eof()) { auto tokens = Token::maybe_from_state(m_state); m_state.buffer.clear(); + m_state.expansions.clear(); m_state.position.start_offset = m_state.position.end_offset; m_state.position.start_line = m_state.position.end_line; @@ -615,6 +616,7 @@ Lexer::ReductionResult Lexer::reduce_start() m_state.on_new_line = true; m_state.buffer.clear(); + m_state.expansions.clear(); m_state.position.start_offset = m_state.position.end_offset; m_state.position.start_line = m_state.position.end_line; @@ -637,6 +639,7 @@ Lexer::ReductionResult Lexer::reduce_start() auto tokens = Token::maybe_from_state(m_state); m_state.buffer.clear(); m_state.buffer.append(consume()); + m_state.expansions.clear(); m_state.position.start_offset = m_state.position.end_offset; m_state.position.start_line = m_state.position.end_line;