diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-07-28 16:27:45 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-31 00:18:11 +0200 |
commit | d6668dbc5620284e908ed604b93493b1e8e1315a (patch) | |
tree | f1cc2438f9de5ab5e94b9c7ee2fb1e634df21ba5 /Userland/Libraries/LibWeb | |
parent | 919eb7c0aac138d1b35a8f2194a440a4a9a35d3f (diff) | |
download | serenity-d6668dbc5620284e908ed604b93493b1e8e1315a.zip |
LibWeb: Allow peeking more than 1 token ahead in CSS Parser
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 4c5974c99a..5972f4335f 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -73,12 +73,12 @@ bool TokenStream<T>::has_next_token() } template<typename T> -T const& TokenStream<T>::peek_token() +T const& TokenStream<T>::peek_token(int offset) { if (!has_next_token()) return m_eof; - return m_tokens.at(m_iterator_offset + 1); + return m_tokens.at(m_iterator_offset + offset + 1); } template<typename T> diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h index 18c3fde58e..fa7d47f6b2 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h @@ -52,7 +52,7 @@ public: bool has_next_token(); T const& next_token(); - T const& peek_token(); + T const& peek_token(int offset = 0); T const& current_token(); void reconsume_current_input_token(); |