Recognize hexadecimal sequences in the characters

This commit is contained in:
Eugen Wissner 2025-01-23 14:14:43 +01:00
parent 0dc95d4466
commit 5548b66b15
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0

View File

@ -122,6 +122,11 @@ return {
return yy::parser::make_CHARACTER(std::string(yytext, 1, 1), this->location); return yy::parser::make_CHARACTER(std::string(yytext, 1, 1), this->location);
} }
} }
'\\x[0-9a-fA-F]{2}' {
char character = static_cast<char>(std::stoi(yytext + 3, nullptr, 16));
return yy::parser::make_CHARACTER(std::string(&character, 1), this->location);
}
'\\[0nabtfrv\\'"?]' { '\\[0nabtfrv\\'"?]' {
switch (yytext[2]) switch (yytext[2])
{ {