mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 07:37:03 +00:00
LibWeb: Add TokenStream::rewind_to_position()
Parsing media queries sometimes requires significant back-tracking, so `reconsume_current_input_token()` was not good enough. `rewind_to_position()` lets you reconsume an erbitrary number of tokens to return to an earlier point in the stream, which you previously saved from `TokenStream::position()`.
This commit is contained in:
parent
c7cd489689
commit
2ed0f880ee
Notes:
sideshowbarker
2024-07-18 03:14:40 +09:00
Author: https://github.com/AtkinsSJ
Commit: 2ed0f880ee
Pull-request: https://github.com/SerenityOS/serenity/pull/10295
2 changed files with 10 additions and 0 deletions
|
@ -61,6 +61,9 @@ public:
|
|||
T const& current_token();
|
||||
void reconsume_current_input_token();
|
||||
|
||||
int position() const { return m_iterator_offset; }
|
||||
void rewind_to_position(int);
|
||||
|
||||
void skip_whitespace();
|
||||
|
||||
void dump_all_tokens();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue