From 5548b66b15742c872575b62884821352cfc7ba1a Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 23 Jan 2025 14:14:43 +0100 Subject: [PATCH] Recognize hexadecimal sequences in the characters --- source/lexer.ll | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/lexer.ll b/source/lexer.ll index 64c763a..2711b39 100644 --- a/source/lexer.ll +++ b/source/lexer.ll @@ -122,6 +122,11 @@ return { return yy::parser::make_CHARACTER(std::string(yytext, 1, 1), this->location); } } +'\\x[0-9a-fA-F]{2}' { + char character = static_cast(std::stoi(yytext + 3, nullptr, 16)); + + return yy::parser::make_CHARACTER(std::string(&character, 1), this->location); + } '\\[0nabtfrv\\'"?]' { switch (yytext[2]) {