mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
Shell: Make <return> go to a new line when the command is incomplete
"incomplete" meaning that it has a syntax error that can be recovered from by continuing the input.
This commit is contained in:
parent
48d2545572
commit
5325d6871d
6 changed files with 61 additions and 50 deletions
10
Shell/AST.h
10
Shell/AST.h
|
@ -418,8 +418,10 @@ public:
|
|||
const Position& position() const { return m_position; }
|
||||
void set_is_syntax_error(const SyntaxError& error_node)
|
||||
{
|
||||
m_is_syntax_error = true;
|
||||
m_syntax_error_node = error_node;
|
||||
if (!m_is_syntax_error) {
|
||||
m_is_syntax_error = true;
|
||||
m_syntax_error_node = error_node;
|
||||
}
|
||||
}
|
||||
virtual const SyntaxError& syntax_error_node() const
|
||||
{
|
||||
|
@ -1174,11 +1176,12 @@ private:
|
|||
|
||||
class SyntaxError final : public Node {
|
||||
public:
|
||||
SyntaxError(Position, String);
|
||||
SyntaxError(Position, String, bool is_continuable = false);
|
||||
virtual ~SyntaxError();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const String& error_text() const { return m_syntax_error_text; }
|
||||
bool is_continuable() const { return m_is_continuable; }
|
||||
|
||||
private:
|
||||
NODE(SyntaxError);
|
||||
|
@ -1190,6 +1193,7 @@ private:
|
|||
virtual const SyntaxError& syntax_error_node() const override;
|
||||
|
||||
String m_syntax_error_text;
|
||||
bool m_is_continuable { false };
|
||||
};
|
||||
|
||||
class Tilde final : public Node {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue