Commit Diff


commit - 0d5df857d4b85726b8c0bb272fc6fef0a727ac1c
commit + e0cdee61b211d1aaeb253a85a0095d624ce000f4
blob - 98493fda7f5c5faf20099c58dd58caa90463bff0
blob + 428485760a9d5dbb499b3c96a4d43745c3d06595
--- cc/irc/irc.c
+++ cc/irc/irc.c
@@ -70,6 +70,7 @@ enum {
 	TK_INT = 128,
 	TK_REG,
 	TK_IDENT,
+	TK_STRING,
 	TK_EOF,
 };
 
@@ -164,6 +165,25 @@ begin:
 		parse_int ();
 		lval.i = -lval.i;
 		return TK_INT;
+	case '"':
+		nextch ();
+		cap = 10;
+		len = 0;
+		s = alloc (cap + 1);
+
+		// TODO: implement escape sequences
+		while ((ch = nextch ()) != '"') {
+			if (len == cap) {
+				cap *= 2;
+				t = alloc (cap + 1);
+				memcpy (t, s, len);
+			}
+			s[len++] = ch;
+		}
+
+		s[len] = '\0';
+		lval.s = s;
+		return TK_STRING;
 	case '(':
 	case ')':
 	case '{':