浏览代码

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()
Idan Horowitz 4 年之前
父节点
当前提交
39a9cf4bb4
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      AK/GenericLexer.h

+ 6 - 0
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());