1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:25:07 +00:00

Shell: Add runtime errors and implement break/continue

Such errors are raised when SyntaxError nodes are executed, and are also
used for internal control flow.
The 'break' and 'continue' commands are currently only allowed inside
for loops, and outside function bodies.

This also adds a 'loop' keyword for infinite loops.
This commit is contained in:
AnotherTest 2020-12-10 18:25:13 +03:30 committed by Andreas Kling
parent 9bd81f34a5
commit 5e5eb615ec
14 changed files with 384 additions and 62 deletions

View file

@ -190,6 +190,13 @@ private:
auto& span = span_for_node(node);
span.color = m_palette.syntax_comment();
}
virtual void visit(const AST::ContinuationControl* node) override
{
NodeVisitor::visit(node);
auto& span = span_for_node(node);
span.color = m_palette.syntax_control_keyword();
}
virtual void visit(const AST::DynamicEvaluate* node) override
{
NodeVisitor::visit(node);