Recognize wide character literal

For now, L'' is equivalent to ''.
This commit is contained in:
Rui Ueyama 2020-07-20 19:24:56 +09:00
parent 5baa7091f2
commit ebf7b402ea
2 changed files with 10 additions and 0 deletions

View File

@ -95,6 +95,9 @@ int main() {
of(char), \
"sizeof(char)");
ASSERT(4, sizeof(L'\0'));
ASSERT(97, L'a');
printf("OK\n");
return 0;
}

View File

@ -432,6 +432,13 @@ Token *tokenize(File *file) {
continue;
}
// Wide character literal
if (startswith(p, "L'")) {
cur = read_char_literal(cur, p + 1);
p += cur->len + 1;
continue;
}
// Identifier or keyword
if (is_ident1(*p)) {
char *q = p++;