From b0b048c03930b826ab3dbf88b56fd664fca26886 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 22 May 2020 15:32:31 +0300 Subject: Add script command redirect aliases --- libbuild2/cc/lexer.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'libbuild2/cc') diff --git a/libbuild2/cc/lexer.cxx b/libbuild2/cc/lexer.cxx index d57f5eb..d2be3d8 100644 --- a/libbuild2/cc/lexer.cxx +++ b/libbuild2/cc/lexer.cxx @@ -48,8 +48,8 @@ namespace build2 auto lexer:: peek (bool e) -> xchar { - if (unget_) - return ungetc_; + if (ungetn_ != 0) + return ungetb_[ungetn_ - 1]; if (unpeek_) return unpeekc_; @@ -98,11 +98,8 @@ namespace build2 inline auto lexer:: get (bool e) -> xchar { - if (unget_) - { - unget_ = false; - return ungetc_; - } + if (ungetn_ != 0) + return ungetb_[--ungetn_]; else { xchar c (peek (e)); @@ -117,7 +114,7 @@ namespace build2 // Increment the logical line similar to how base will increment the // physical (the column counts are the same). // - if (log_line_ && c == '\n' && !unget_) + if (log_line_ && c == '\n' && ungetn_ == 0) ++*log_line_; base::get (c); -- cgit v1.1