aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/cc/lex.c')
-rw-r--r--sys/cmd/cc/lex.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/sys/cmd/cc/lex.c b/sys/cmd/cc/lex.c
index c1ee6a4..c84ea68 100644
--- a/sys/cmd/cc/lex.c
+++ b/sys/cmd/cc/lex.c
@@ -180,6 +180,7 @@ oct:
continue;
}
ungetbyte(lx);
+ break;
}
if (l > 255) errorat(lx->pos, "octal escape value > 255: %d", l);
@@ -253,7 +254,8 @@ Dispatch:
if (b >= RuneSelf || b == '_')
goto Talpha;
if (isalpha(b)) {
- goto Talpha;
+ if (b != 'L')
+ goto Talpha;
n = b;
b = getbyte(lx);
@@ -267,8 +269,12 @@ Dispatch:
tok.val.r = v;
goto Return;
}
+ if (b == '"')
+ goto TLstr;
ungetbyte(lx);
b = n;
+
+ goto Talpha;
}
if (isdigit(b))
goto Tnum;
@@ -321,7 +327,22 @@ Dispatch:
intern(&tok.val.s);
str·free(s);
- break;
+ goto Return;
+
+ TLstr:
+ s = str·makecap("", 0, 8);
+ // NOTE: this violates strict aliasing
+ for (;;) {
+ if (escapechar(lx, '"', 1, 0, &v))
+ break;
+ str·appendlen(&s, sizeof(wchar_t), (byte*)&v);
+ }
+ tok.kind = Alit | Vwstr;
+ tok.val.s = s;
+ intern(&tok.val.s);
+
+ str·free(s);
+ goto Return;
case '.':
tok.kind = Adot;