diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-05-23 23:33:57 +0300 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-25 14:25:05 +0200 |
commit | 813c483a312e1b1b4fa5a02234009ec546a0cc8c (patch) | |
tree | 8cbe1568270f49fa13caf0ca92948695c8fac386 /libbutl/char-scanner.txx | |
parent | 095beb64a0752317a9a1d9777284a6c9343417cc (diff) |
Add putback depth char_scanner template parameter
Diffstat (limited to 'libbutl/char-scanner.txx')
-rw-r--r-- | libbutl/char-scanner.txx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libbutl/char-scanner.txx b/libbutl/char-scanner.txx index d4e2082..35edf42 100644 --- a/libbutl/char-scanner.txx +++ b/libbutl/char-scanner.txx @@ -7,8 +7,8 @@ namespace butl { - template <typename V> - char_scanner<V>:: + template <typename V, std::size_t N> + char_scanner<V, N>:: char_scanner (std::istream& is, validator_type v, bool crlf, @@ -26,12 +26,12 @@ namespace butl { } - template <typename V> - auto char_scanner<V>:: + template <typename V, std::size_t N> + auto char_scanner<V, N>:: peek (std::string* what) -> xchar { - if (unget_) - return ungetc_; + if (ungetn_ > 0) + return ungetb_[ungetn_ - 1]; if (unpeek_) return unpeekc_; @@ -108,12 +108,12 @@ namespace butl return xchar (v, line, column, position); } - template <typename V> - void char_scanner<V>:: + template <typename V, std::size_t N> + void char_scanner<V, N>:: get (const xchar& c) { - if (unget_) - unget_ = false; + if (ungetn_ > 0) + --ungetn_; else { if (unpeek_) |