commit eb98dc9

0uppy  ·  2026-09-11 22:10:50 +0000 UTC
parent d8380d2
bug fix - fixed a bug where Cotton thought - was the number 0 and hence ruined all math :P
2 files changed,  +18, -1
+17, -0
 1@@ -0,0 +1,17 @@
 2+"Hallo from Cot this is a little test program to show off the syntax :D" 0 ->
 3+
 4+34 2 * 1 -
 5+
 6+dup
 7+
 8+30 > ? if
 9+
10+.n
11+
12+0 @ .s
13+
14+else
15+
16+drop
17+
18+end
+1, -1
1@@ -336,7 +336,7 @@ void cotton_compile
2                     
3                     for (int j = 0; tok[j]; j++) {
4                         
5-                        if (!isdigit(tok[j]) && !(j == 0 && tok[j] == '-')) {
6+                        if (!isdigit(tok[j]) && !(j == 0 && tok[j] == '-' && tok[1] != '\0')) {
7 
8                             is_num = 0;
9                             break;