aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/lex.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 18:29:55 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 18:29:55 +0330
commite7fe081efaae893ed46548fdbc3bfa39b2879878 (patch)
treead2e3804bcbc6493d7152f68e91f17d4b357c73e /src/compiler/lex.zc
parentconstant expressions: c precedence and / % ^ (b.1.3); local const usable in c... (diff)
duplicate case labels are an error (b.2.15); unterminated string literal reported where it starts (b.2.11); an unreachable droppable cycle drops whole in one collection (6.15.3)
Diffstat (limited to 'src/compiler/lex.zc')
-rw-r--r--src/compiler/lex.zc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/lex.zc b/src/compiler/lex.zc
index 712eff8..95415a6 100644
--- a/src/compiler/lex.zc
+++ b/src/compiler/lex.zc
@@ -533,8 +533,9 @@ int lex1() {
while (isidc(ch)) { n = token_char(n, ch); nextch(); }
tbuf[n] = 0;
if (n == 1 && tbuf[0] == 'b' && ch == 34) {
- n = 0; nextch();
+ n = 0; dg = line; nextch();
while (ch >= 0 && ch != 34) { v = escch(); n = token_char(n, v); }
+ if (ch < 0) { tline = dg; serr("unterminated string literal"); } // spec 1.4.4
nextch();
tbuf[n] = 0;
tk = T_BSTR; tv = intern(tbuf); return 0;
@@ -556,8 +557,9 @@ int lex1() {
return 0;
}
if (ch == 34) {
- nextch();
+ dg = line; nextch();
while (ch >= 0 && ch != 34) { v = escch(); n = token_char(n, v); }
+ if (ch < 0) { tline = dg; serr("unterminated string literal"); } // spec 1.4.4
nextch();
tbuf[n] = 0;
tk = T_STR; tv = intern(tbuf); return 0;