aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/lexer.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-03-06 17:40:45 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-03-06 17:47:54 +0300
commit3f8ef886b1e2b17d8ba12a74355ab7e09aec5ed6 (patch)
tree276748745dcef6bf985ce7804e2874d61d2bd345 /libbuild2/lexer.hxx
parent66a782233011b662378c44a4c5a9ac4af78ce151 (diff)
Restrict buildfiles and testscripts with only Unicode graphic characters, '\t', '\r', and '\n'
Diffstat (limited to 'libbuild2/lexer.hxx')
-rw-r--r--libbuild2/lexer.hxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/libbuild2/lexer.hxx b/libbuild2/lexer.hxx
index 93992b4..e9a3149 100644
--- a/libbuild2/lexer.hxx
+++ b/libbuild2/lexer.hxx
@@ -7,6 +7,7 @@
#include <stack>
#include <libbutl/utf8.mxx>
+#include <libbutl/unicode.mxx>
#include <libbutl/char-scanner.mxx>
#include <libbuild2/types.hxx>
@@ -201,10 +202,14 @@ namespace build2
lexer (istream& is, const path_name& name, uint64_t line,
const char* escapes,
bool set_mode)
- : char_scanner (is, true /* crlf */, line),
- fail ("error", &name),
- name_ (name),
- sep_ (false)
+ : char_scanner (is,
+ butl::utf8_validator (butl::codepoint_types::graphic,
+ U"\n\r\t"),
+ true /* crlf */,
+ line),
+ fail ("error", &name),
+ name_ (name),
+ sep_ (false)
{
if (set_mode)
mode (lexer_mode::normal, '@', escapes);