From 813c483a312e1b1b4fa5a02234009ec546a0cc8c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 23 May 2020 23:33:57 +0300 Subject: Add putback depth char_scanner template parameter --- libbutl/char-scanner.txx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'libbutl/char-scanner.txx') 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 - char_scanner:: + template + char_scanner:: char_scanner (std::istream& is, validator_type v, bool crlf, @@ -26,12 +26,12 @@ namespace butl { } - template - auto char_scanner:: + template + auto char_scanner:: 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 - void char_scanner:: + template + void char_scanner:: get (const xchar& c) { - if (unget_) - unget_ = false; + if (ungetn_ > 0) + --ungetn_; else { if (unpeek_) -- cgit v1.1