aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/lexer.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-02-21 22:14:48 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-02-26 17:40:31 +0300
commitc69d5dc7a81013647400e055d8c05b12eb545801 (patch)
treea2f14d52b9ff87e84b8cce07d6a36033bf774c8c /libbuild2/cc/lexer.cxx
parent003f56bf62433d6b009368e52855c766118468e1 (diff)
Adapt to adding validator to butl::char_scanner
Diffstat (limited to 'libbuild2/cc/lexer.cxx')
-rw-r--r--libbuild2/cc/lexer.cxx50
1 files changed, 30 insertions, 20 deletions
diff --git a/libbuild2/cc/lexer.cxx b/libbuild2/cc/lexer.cxx
index 36725e3..d57f5eb 100644
--- a/libbuild2/cc/lexer.cxx
+++ b/libbuild2/cc/lexer.cxx
@@ -32,7 +32,7 @@ static const uint8_t char_flags[256] =
namespace butl // ADL
{
inline build2::location
- get_location (const butl::char_scanner::xchar& c, const void* data)
+ get_location (const butl::char_scanner<>::xchar& c, const void* data)
{
using namespace build2;
@@ -702,7 +702,8 @@ namespace build2
const char* p (b);
for (char c;
- p != e && (c = *p) != '\"' && c != '\\' && c != '\n';
+ p != e &&
+ (c = *p) != '\"' && c != '\\' && c != '\n' && c != '\r';
++p) ;
size_t n (p - b);
@@ -885,7 +886,8 @@ namespace build2
const char* p (b);
for (char c;
- p != e && (c = *p) != '\"' && c != '\\' && c != '\n';
+ p != e &&
+ (c = *p) != '\"' && c != '\\' && c != '\n' && c != '\r';
++p) ;
size_t n (p - b);
@@ -1095,27 +1097,35 @@ namespace build2
break;
}
- // Direct buffer scan.
- //
- const char* b (gptr_);
- const char* e (egptr_);
- const char* p (b);
-
- for (char c;
- p != e && (c = *p) != '*' && c != '\\';
- ++p)
+ if (c != '*' && c != '\\')
{
- if (c == '\n')
+ // Direct buffer scan.
+ //
+ // Note that we should call get() prior to the direct buffer
+ // scan (see butl::char_scanner for details).
+ //
+ get (c);
+
+ const char* b (gptr_);
+ const char* e (egptr_);
+ const char* p (b);
+
+ for (char c;
+ p != e && (c = *p) != '*' && c != '\\';
+ ++p)
{
- if (log_line_) ++*log_line_;
- ++line;
- column = 1;
+ if (c == '\n')
+ {
+ if (log_line_) ++*log_line_;
+ ++line;
+ column = 1;
+ }
+ else
+ ++column;
}
- else
- ++column;
- }
- gptr_ = p; buf_->gbump (static_cast<int> (p - b));
+ gptr_ = p; buf_->gbump (static_cast<int> (p - b));
+ }
}
continue;
}