mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-19 14:14:41 +00:00
JSSpecCompiler: Parse "Perform <expression>." steps
This commit is contained in:
committed by
Andrew Kaster
parent
d1fc84c638
commit
ddf26a768c
@@ -463,6 +463,18 @@ TextParseErrorOr<Tree> TextParser::parse_assignment()
|
||||
return make_ref_counted<BinaryOperation>(op, lvalue, rvalue);
|
||||
}
|
||||
|
||||
// perform <expr>
|
||||
TextParseErrorOr<Tree> TextParser::parse_perform()
|
||||
{
|
||||
auto rollback = rollback_point();
|
||||
|
||||
TRY(consume_word("perform"sv));
|
||||
auto value = TRY(parse_expression());
|
||||
|
||||
rollback.disarm();
|
||||
return value;
|
||||
}
|
||||
|
||||
// <simple_step>
|
||||
TextParseErrorOr<Tree> TextParser::parse_simple_step_or_inline_if_branch()
|
||||
{
|
||||
@@ -493,6 +505,14 @@ TextParseErrorOr<Tree> TextParser::parse_simple_step_or_inline_if_branch()
|
||||
return result.release_value();
|
||||
}
|
||||
|
||||
// Perform <expr>.$
|
||||
if (auto result = parse_perform(); !result.is_error()) {
|
||||
TRY(consume_token_with_type(TokenType::Dot));
|
||||
TRY(expect_eof());
|
||||
rollback.disarm();
|
||||
return result.release_value();
|
||||
}
|
||||
|
||||
return TextParseError {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user