mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/CSS: Expose consumed tokens from TokenStream
In some situations we want to examine a sequence of tokens that have been already consumed from a TokenStream. These methods let us do so: - current_index() provides the current internal token index - tokens_since() provides a span from the given index to the current one
This commit is contained in:
parent
8d5eac28a4
commit
a8d0be4382
Notes:
github-actions[bot]
2025-12-02 09:50:56 +00:00
Author: https://github.com/AtkinsSJ
Commit: a8d0be4382
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6986
1 changed files with 9 additions and 0 deletions
|
|
@ -177,6 +177,15 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
size_t current_index() const { return m_index; }
|
||||
|
||||
ReadonlySpan<T> tokens_since(size_t start) const
|
||||
{
|
||||
if (start > m_index)
|
||||
return {};
|
||||
return m_tokens.slice(start, m_index - start);
|
||||
}
|
||||
|
||||
void dump_all_tokens()
|
||||
{
|
||||
dbgln("Dumping all tokens:");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue