From ec7d50f052589e44da651c447f8c87ef5b4a41a2 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 6 Aug 2024 09:33:03 -0400 Subject: [PATCH] xo-tokenizer: feat: + span::operator+= --- include/xo/tokenizer/span.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/xo/tokenizer/span.hpp b/include/xo/tokenizer/span.hpp index 36353a63..00f8cf74 100644 --- a/include/xo/tokenizer/span.hpp +++ b/include/xo/tokenizer/span.hpp @@ -93,6 +93,16 @@ namespace xo { /** @brief report the number of elements (of type CharT) in this span. **/ size_type size() const { return hi_ - lo_; } + span & operator+=(const span & x) { + if (hi_ == x.lo_) { + hi_ = x.hi_; + } else { + assert(false); + } + + return *this; + } + /** print representation for this span on stream @p os **/ void print(std::ostream & os) const { os << "