aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/lexer.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-06-18 16:40:00 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-19 11:27:32 +0200
commit112a83c346a537f1a5eac6fc17ee2ce3143d625b (patch)
tree11ed26fb72a571299eba7e02a225eaf07e527c58 /libbuild2/lexer.ixx
parent78ac6aee6dff1b608bc312fe7ada442ba83710e8 (diff)
Fix lexer to fail on invalid UTF-8 sequences
Diffstat (limited to 'libbuild2/lexer.ixx')
-rw-r--r--libbuild2/lexer.ixx33
1 files changed, 33 insertions, 0 deletions
diff --git a/libbuild2/lexer.ixx b/libbuild2/lexer.ixx
new file mode 100644
index 0000000..04899f0
--- /dev/null
+++ b/libbuild2/lexer.ixx
@@ -0,0 +1,33 @@
+// file : libbuild2/lexer.ixx -*- C++ -*-
+// license : MIT; see accompanying LICENSE file
+
+namespace build2
+{
+ inline auto lexer::
+ get () -> xchar
+ {
+ xchar c (base::get (ebuf_));
+
+ if (invalid (c))
+ fail_char (c);
+
+ return c;
+ }
+
+ inline void lexer::
+ get (const xchar& peeked)
+ {
+ base::get (peeked);
+ }
+
+ inline auto lexer::
+ peek () -> xchar
+ {
+ xchar c (base::peek (ebuf_));
+
+ if (invalid (c))
+ fail_char (c);
+
+ return c;
+ }
+}