mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-28 14:02:51 +00:00
JSSpecCompiler: Parse method headers
This commit is contained in:
parent
a35a751f9e
commit
4d8f74c149
Notes:
sideshowbarker
2024-07-17 06:20:50 +09:00
Author: https://github.com/DanShaders
Commit: 4d8f74c149
Pull-request: https://github.com/SerenityOS/serenity/pull/23123
Reviewed-by: https://github.com/ADKaster ✅
7 changed files with 85 additions and 12 deletions
|
@ -22,8 +22,13 @@ struct ClauseHeader {
|
|||
Vector<StringView> qualified_name;
|
||||
};
|
||||
|
||||
struct Method {
|
||||
Vector<StringView> qualified_name;
|
||||
Vector<FunctionArgument> arguments;
|
||||
};
|
||||
|
||||
StringView section_number;
|
||||
Variant<AK::Empty, AbstractOperation, Accessor> header;
|
||||
Variant<AK::Empty, AbstractOperation, Accessor, Method> header;
|
||||
};
|
||||
|
||||
struct TextParseError { };
|
||||
|
@ -38,6 +43,11 @@ using TextParseErrorOr = ErrorOr<T, TextParseError>;
|
|||
|
||||
class TextParser {
|
||||
public:
|
||||
enum class ClauseHasAoidAttribute {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
TextParser(SpecificationParsingContext& ctx, Vector<Token> const& tokens, XML::Node const* node)
|
||||
: m_ctx(ctx)
|
||||
, m_tokens(tokens)
|
||||
|
@ -45,7 +55,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
TextParseErrorOr<ClauseHeader> parse_clause_header();
|
||||
TextParseErrorOr<ClauseHeader> parse_clause_header(ClauseHasAoidAttribute clause_has_aoid_attribute);
|
||||
TextParseErrorOr<Tree> parse_step_without_substeps();
|
||||
TextParseErrorOr<Tree> parse_step_with_substeps(Tree substeps);
|
||||
|
||||
|
@ -95,6 +105,7 @@ private:
|
|||
TextParseErrorOr<Vector<StringView>> parse_qualified_name();
|
||||
TextParseErrorOr<Vector<FunctionArgument>> parse_function_arguments_in_declaration();
|
||||
TextParseErrorOr<ClauseHeader::AbstractOperation> parse_abstract_operation_declaration();
|
||||
TextParseErrorOr<ClauseHeader::Method> parse_method_declaration();
|
||||
TextParseErrorOr<ClauseHeader::Accessor> parse_accessor_declaration();
|
||||
|
||||
SpecificationParsingContext& m_ctx;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue