diff options
Diffstat (limited to 'src/parser/lexer.h')
-rw-r--r-- | src/parser/lexer.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/parser/lexer.h b/src/parser/lexer.h index 83cbcfc53..37c3fe04a 100644 --- a/src/parser/lexer.h +++ b/src/parser/lexer.h @@ -25,6 +25,7 @@ #include "support/name.h" #include "support/result.h" +#include "support/string.h" #ifndef parser_lexer_h #define parser_lexer_h @@ -124,11 +125,11 @@ public: std::optional<std::string> takeString(); std::optional<Name> takeName() { - // TODO: Validate UTF. - if (auto str = takeString()) { - return Name(*str); + auto str = takeString(); + if (!str || !String::isUTF8(*str)) { + return std::nullopt; } - return std::nullopt; + return Name(*str); } bool takeSExprStart(std::string_view expected) { |