Do not skip first token

This commit is contained in:
Devine Lu Linvega 2024-04-04 16:31:10 -07:00
parent 23e3fc2176
commit 6ad9490f45
3 changed files with 10 additions and 4 deletions

4
examples/hello.modal Normal file
View File

@ -0,0 +1,4 @@
<> (?x dup) (?x ?x)
<> (?x ?y swap) (?y ?x)
foo ((A B swap) dup)

View File

@ -1,4 +1,3 @@
<> (?x dup) (?x ?x) <> (duppre ?x) (?x ?x)
<> (?x ?y swap) (?y ?x)
foo ((A B swap) dup) what (duppre twice)

View File

@ -128,8 +128,11 @@ tokenize(char *t, FILE *f)
r->a = parse_rulefrag(f), r->b = parse_rulefrag(f); r->a = parse_rulefrag(f), r->b = parse_rulefrag(f);
return; return;
} }
while((c = *t++))
*prog_++ = c;
*prog_++ = ' ';
while(f && fread(&c, 1, 1, f) && c) while(f && fread(&c, 1, 1, f) && c)
*prog_++ = c == 0xa ? 0x20 : c; *prog_++ = c == 0xa ? ' ' : c;
} }
static int static int