Add support for the C++11 u and U encoding prefixes for char literals

"u" and "U" are new in C11 and C++11 for char literals.
This commit is contained in:
Zackery Spytz 2019-02-05 15:08:35 -07:00
commit 8c2cb4e604
2 changed files with 7 additions and 0 deletions

View file

@ -47,6 +47,9 @@ wstring aa = L"Wide string";
const char *bb = u8"UTF-8 string";
const char16_t *cc = u"UTF-16 string";
const char32_t *dd = U"UTF-32 string";
// New char literals
char16_t uchar = u'a';
char32_t Uchar = U'b';
%}
/* Raw string literals */

View file

@ -938,6 +938,10 @@ static int look(Scanner *s) {
retract(s, 1);
state = 1000;
}
else if (c == '\'') { /* Definitely u, U or L char */
retract(s, 1);
state = 77;
}
else if (c == 'R') { /* Possibly CUSTOM DELIMITER u, U, L string */
state = 73;
}