1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

JSSpecCompiler: Add functions for splitting node contents into tokens

This commit is contained in:
Dan Klishch 2023-08-17 22:29:05 -04:00 committed by Andrew Kaster
parent 8342361481
commit 9f29e04897
6 changed files with 378 additions and 0 deletions

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2023, Dan Klishch <danilklishch@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibXML/Forward.h>
#include "Parser/ParseError.h"
namespace JSSpecCompiler {
struct IgnoreComments {
ParseErrorOr<void> operator()(XML::Node::Comment const&) { return {}; }
};
inline constexpr IgnoreComments ignore_comments {};
bool contains_empty_text(XML::Node const* node);
ParseErrorOr<StringView> get_attribute_by_name(XML::Node const* node, StringView attribute_name);
ParseErrorOr<StringView> get_text_contents(XML::Node const* node);
ParseErrorOr<XML::Node const*> get_only_child(XML::Node const* element, StringView tag_name);
}