1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

LibWeb: Allow creating a TokenStream from a single token

This is quite niche, but lets us convert parsing methods to accepting
TokenStream, while still being able to call them when we just have a
lone token. Specifically we'll use this in the next commit, but it's
likely to also be useful as a stop-gap measure when converting more
parsing methods.
This commit is contained in:
Sam Atkins 2023-12-28 17:21:00 +00:00 committed by Andreas Kling
parent 2f5379bc9b
commit a76f29e56b

View file

@ -66,6 +66,11 @@ public:
{
}
static TokenStream<T> of_single_token(T const& token)
{
return TokenStream(Span<T const> { &token, 1 });
}
TokenStream(TokenStream<T> const&) = delete;
TokenStream(TokenStream<T>&&) = default;