Commit 5b68b0f2 authored by Chris Müller's avatar Chris Müller
Browse files

Ignore UTF8-Encoding for simpler Bootstrapping

parent 63f7a1ed
......@@ -324,8 +324,7 @@ RETURN_TOKEN:
enum CharState {
CHAR_EAT,
CHAR_ESCAPE,
CHAR_UNICODE
CHAR_ESCAPE
};
static enum cherry_tok
......@@ -342,47 +341,13 @@ lex_character(struct cherry_context* context)
cherry_array_append(buffer, "\\", 1);
while(!cherry_unicode_isspace(ch) && ch != '\0') {
switch(state) {
case CHAR_EAT:
if(ch == 'u') {
state = CHAR_UNICODE;
unicount = 4;
} else if(ch == 'U') {
state = CHAR_UNICODE;
unicount = 6;
} else {
state = CHAR_ESCAPE;
}
break;
case CHAR_UNICODE:
if(unicount-- == 0)
goto RETURN_TOKEN;
if(('0' > ch || ch > '9') && ('A' > ch || ch > 'F')) {
cherry_error(context, "Unexpected hex sequence in unicode escape sequence");
cherry_array_append(buffer, "0", 1);
goto NO_BUFFER_APPEND;
}
break;
case CHAR_ESCAPE:
break;
}
cherry_array_append(buffer, p, cherry_utf8_codepoints(p));
NO_BUFFER_APPEND:
p = cherry_utf8_next(p);
ch = cherry_utf8_get(p);
}
RETURN_TOKEN:
if(state == CHAR_UNICODE && unicount > 0) {
cherry_error(context, "Improper unicode escape sequence found in character literal");
while(unicount-- > 0)
cherry_array_append(buffer, "0", 1);
} else if(cherry_array_size(buffer) == 1) {
if(cherry_array_size(buffer) == 1) {
cherry_error(context, "No character symbol is given in character literal");
cherry_array_append(buffer, "0", 1);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment