Allow for unicode

This commit is contained in:
Devine Lu Linvega 2024-05-10 14:36:58 -07:00
parent 4a57c3c564
commit c89013f263
3 changed files with 6 additions and 2 deletions

4
examples/unicode.modal Normal file
View File

@ -0,0 +1,4 @@
<> (🯅 |) ()
<> (🯅 ?x) (?x 🯅)
🯅 _ _ _ |

View File

@ -10,7 +10,7 @@ dest:
run: all bin/modal run: all bin/modal
@ bin/modal -q examples/hello.modal @ bin/modal -q examples/hello.modal
debug: all bin/modal-debug debug: all bin/modal-debug
@ bin/modal-debug -a examples/hello.modal @ bin/modal-debug -a examples/unicode.modal
test: all bin/modal-debug bin/modal test: all bin/modal-debug bin/modal
@ bin/modal -v @ bin/modal -v
@ bin/modal-debug -q examples/fizzbuzz.modal @ bin/modal-debug -q examples/fizzbuzz.modal

View File

@ -105,7 +105,7 @@ file_import(char *path, char *ptr)
FILE *f; FILE *f;
int pr = 0; int pr = 0;
if((f = fopen(path, "r"))) { if((f = fopen(path, "r"))) {
char c; unsigned char c;
while(fread(&c, 1, 1, f)) { while(fread(&c, 1, 1, f)) {
c = c <= 0x20 ? 0x20 : c; c = c <= 0x20 ? 0x20 : c;
if(c == '(') pr++; if(c == '(') pr++;