diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-07-11 20:58:38 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-12 19:05:17 +0100 |
commit | 39a9cf4bb49751b49c63fa8b1c65555afc73d0e7 (patch) | |
tree | ca9f2cedd6ebe0c03a8aafc553fb92eb8080bd12 /AK | |
parent | b2daaca5ee1b95067d0a8d810520b0e86fd3611a (diff) | |
download | serenity-39a9cf4bb49751b49c63fa8b1c65555afc73d0e7.zip |
AK: Add a retreat(count) method to GenericLexer
This method can be used to rewind a constant amount backwards in the
source instead of one by one with retract()
Diffstat (limited to 'AK')
-rw-r--r-- | AK/GenericLexer.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/AK/GenericLexer.h b/AK/GenericLexer.h index 131c0b24dd..e824f473a8 100644 --- a/AK/GenericLexer.h +++ b/AK/GenericLexer.h @@ -56,6 +56,12 @@ public: --m_index; } + constexpr void retreat(size_t count) + { + VERIFY(m_index >= count); + m_index -= count; + } + constexpr char consume() { VERIFY(!is_eof()); |