mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:08:10 +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
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