aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main.c b/main.c
index 873ebe6..39e6f31 100644
--- a/main.c
+++ b/main.c
@@ -215,6 +215,21 @@ struct Token* tokenize(char* src, int len) {
tok->kind = TK_GT;
tok = tok + 1;
}
+ } else if (c == '\'') {
+ pos = pos + 1;
+ int ch = src[pos];
+ if (ch == '\\') {
+ pos = pos + 1;
+ ch = src[pos];
+ if (ch == 'n') {
+ ch = '\n';
+ }
+ }
+ pos = pos + 2;
+ tok->kind = TK_L_INT;
+ tok->value = calloc(4, sizeof(char));
+ sprintf(tok->value, "%d", ch);
+ tok = tok + 1;
} else if (c == '"') {
pos = pos + 1;
int start = pos;