diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2021-01-16 23:20:52 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-23 08:28:58 +0100 |
commit | 2bd77bc93bece47b791a8448db0f6b70003b7831 (patch) | |
tree | 272028f98826275b10f365b38b42319941e848c1 /Userland/Libraries/LibGUI | |
parent | 212c90d68f1a312cbda06a8822730bbffed9f9ec (diff) | |
download | serenity-2bd77bc93bece47b791a8448db0f6b70003b7831.zip |
Shell: Make the parser read consecutive sequences without recursing
This fixes (the easy) part of #4976.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/ShellSyntaxHighlighter.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Userland/Libraries/LibGUI/ShellSyntaxHighlighter.cpp b/Userland/Libraries/LibGUI/ShellSyntaxHighlighter.cpp index 8f3c27fa8e..a552764c09 100644 --- a/Userland/Libraries/LibGUI/ShellSyntaxHighlighter.cpp +++ b/Userland/Libraries/LibGUI/ShellSyntaxHighlighter.cpp @@ -380,21 +380,19 @@ private: } virtual void visit(const AST::Sequence* node) override { - { - ScopedValueRollback first_in_command { m_is_first_in_command }; - node->left()->visit(*this); - } - { + for (auto& entry : node->entries()) { ScopedValueRollback first_in_command { m_is_first_in_command }; - node->right()->visit(*this); + entry.visit(*this); } - auto& span = span_for_node(node); - span.range.set_start({ node->separator_position().start_line.line_number, node->separator_position().start_line.line_column }); - set_offset_range_end(span.range, node->separator_position().end_line); - span.attributes.color = m_palette.syntax_punctuation(); - span.attributes.bold = true; - span.is_skippable = true; + for (auto& position : node->separator_positions()) { + auto& span = span_for_node(node); + span.range.set_start({ position.start_line.line_number, position.start_line.line_column }); + set_offset_range_end(span.range, position.end_line); + span.attributes.color = m_palette.syntax_punctuation(); + span.attributes.bold = true; + span.is_skippable = true; + } } virtual void visit(const AST::Subshell* node) override { |