Skip to content

Commit 8187893

Browse files
committed
COMMON: Fix array access with embedded strings #136
1 parent b2e423d commit 8187893

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2022-02-23 (12.24)
2+
COMMON: Fix array access with embedded strings #136
3+
14
2022-02-23 (12.24)
25
CONSOLE: Added -i command switch for live mode
36

samples/distro-examples/tests/array.bas

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,88 @@ if (ubound(font["a"],1) != 2) then throw "err1"
342342
if (ubound(font["a"],2) != 2) then throw "err2"
343343
a = font["a"]
344344
if (a[2,2] != 999) then throw "err3"
345+
346+
'
347+
' test for compile errors (incorrect handling of quotes in comp_array_params)
348+
'
349+
dim p(256)
350+
p(asc("=")) = 1
351+
p(asc("[")) = 1
352+
p(asc("1")) = 1
353+
p(asc("2")) = 1
354+
p(asc("3")) = 1
355+
p(asc("4")) = 1
356+
p(asc("5")) = 1
357+
p(asc("6")) = 1
358+
p(asc("7")) = 1
359+
p(asc("8")) = 1
360+
p(asc("9")) = 1
361+
p(asc(":")) = 1
362+
p(asc(";")) = 1
363+
p(asc("<")) = 1
364+
p(asc(">")) = 1
365+
p(asc("?")) = 1
366+
p(asc("@")) = 1
367+
p(asc("A")) = 1
368+
p(asc("B")) = 1
369+
p(asc("C")) = 1
370+
p(asc("D")) = 1
371+
p(asc("E")) = 1
372+
p(asc("F")) = 1
373+
p(asc("G")) = 1
374+
p(asc("H")) = 1
375+
p(asc("I")) = 1
376+
p(asc("J")) = 1
377+
p(asc("K")) = 1
378+
p(asc("L")) = 1
379+
p(asc("M")) = 1
380+
p(asc("N")) = 1
381+
p(asc("O")) = 1
382+
p(asc("P")) = 1
383+
p(asc("Q")) = 1
384+
p(asc("R")) = 1
385+
p(asc("S")) = 1
386+
p(asc("T")) = 1
387+
p(asc("U")) = 1
388+
p(asc("V")) = 1
389+
p(asc("W")) = 1
390+
p(asc("X")) = 1
391+
p(asc("Y")) = 1
392+
p(asc("Z")) = 1
393+
p(asc("\\"))= 1
394+
p(asc("]")) = 1
395+
p(asc("^")) = 1
396+
p(asc("_")) = 1
397+
p(asc("`")) = 1
398+
p(asc("a")) = 1
399+
p(asc("b")) = 1
400+
p(asc("c")) = 1
401+
p(asc("d")) = 1
402+
p(asc("e")) = 1
403+
p(asc("f")) = 1
404+
p(asc("g")) = 1
405+
p(asc("h")) = 1
406+
p(asc("i")) = 1
407+
p(asc("j")) = 1
408+
p(asc("k")) = 1
409+
p(asc("l")) = 1
410+
p(asc("m")) = 1
411+
p(asc("n")) = 1
412+
p(asc("o")) = 1
413+
p(asc("p")) = 1
414+
p(asc("q")) = 1
415+
p(asc("r")) = 1
416+
p(asc("s")) = 1
417+
p(asc("t")) = 1
418+
p(asc("u")) = 1
419+
p(asc("v")) = 1
420+
p(asc("w")) = 1
421+
p(asc("x")) = 1
422+
p(asc("y")) = 1
423+
p(asc("z")) = 1
424+
p(asc("{")) = 1
425+
p(asc("|")) = 1
426+
p(asc("}")) = 1
427+
p(asc("~")) = 1
428+
429+

src/common/scan.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,13 @@ char *comp_array_params(char *src, char exitChar) {
18771877
}
18781878
}
18791879
break;
1880+
case '"':
1881+
// skip past the embedded string
1882+
p++;
1883+
while (*p && *p != '"') {
1884+
p++;
1885+
}
1886+
break;
18801887
};
18811888
if (*p != exitChar) {
18821889
p++;

0 commit comments

Comments
 (0)