mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +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:
parent
2f5379bc9b
commit
a76f29e56b
1 changed files with 5 additions and 0 deletions
|
@ -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> const&) = delete;
|
||||||
TokenStream(TokenStream<T>&&) = default;
|
TokenStream(TokenStream<T>&&) = default;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue