Skip to content

Commit f5f4773

Browse files
committed
COMMON: fix backslash escape regression
1 parent 60776ec commit f5f4773

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

samples/distro-examples/tests/strings.bas

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,8 @@ if expect != seq(0, 2*pi, 360/15+1) then throw "SEQ error"
176176

177177
s="Hello\033There"
178178
if (27 != asc(mid(s, 6, 1))) then throw "err"
179+
s="This\033T\ha\t\The\"Other"
180+
rem ThisnT\ha\t\The"Other - non escaping '\' should appear verbatim
181+
if len(s) != 21 then throw "escape error"
182+
s="Hello\03There"
183+
if len(s) != 13 then throw "escape error"

src/common/scan.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3924,18 +3924,21 @@ const char *format_numeric_text(const char *str, char **output) {
39243924
int value = 0;
39253925
int digits = 0;
39263926

3927-
while (isdigit(*str)) {
3928-
value = (value << 3) + (*str - '0');
3927+
while (isdigit(*result)) {
3928+
value = (value << 3) + (*result - '0');
39293929
digits++;
3930-
str++;
3930+
result++;
39313931
}
39323932

39333933
if (digits == 3 && value > V_JOIN_LINE && value < 256) {
39343934
**output = value;
3935-
(*output)++;
3935+
} else {
3936+
**output = *str;
39363937
result = str;
39373938
}
39383939

3940+
(*output)++;
3941+
39393942
return result;
39403943
}
39413944

src/platform/android/app/src/main/assets/main.bas

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ sub do_about()
102102
if (char_w * 45 < xmax) then
103103
print " ____ _______ ___ _____________"
104104
print " / ____ _ ___ _/ / / _ )/ _ | / __/ _/ ___/"
105-
print " _\\ \\/ ' / _ `/ / / _ / __ |_\\ \\_/ // /"
106-
print "/___/_/_/_\\_,_/_/_/____/_/ |_/___/___/\\___/"
105+
print " _\ \/ ' / _ `/ / / _ / __ |_\ \_/ // /__ "
106+
print "/___/_/_/_\_,_/_/_/____/_/ |_/___/___/\___/ "
107107
else
108-
print " __ _ ___ _ "
109-
print "(_ ._ _ _.|||_) /\\ (_ |/ "
110-
print "__)| | |(_||||_)/--\\__)|\\_"
108+
print " __ _ ___ _"
109+
print "(_ ._ _ _.|||_) /\ (_ |/ "
110+
print "__)| | |(_||||_)/--\__)|\_"
111111
endif
112112
print
113113
color 7,0

0 commit comments

Comments
 (0)