Fixed issue with matching tokens of different length
This commit is contained in:
parent
6f89fb02bc
commit
0e6e963425
|
@ -35,7 +35,7 @@ set_reg(int r, char *b)
|
||||||
{
|
{
|
||||||
if(regs[r]) {
|
if(regs[r]) {
|
||||||
char *a = regs[r], *aa = walk(a), *bb = walk(b);
|
char *a = regs[r], *aa = walk(a), *bb = walk(b);
|
||||||
while(a < aa && b < bb)
|
while(a < aa || b < bb)
|
||||||
if(*a++ != *b++) return 0;
|
if(*a++ != *b++) return 0;
|
||||||
} else {
|
} else {
|
||||||
regs[r] = b;
|
regs[r] = b;
|
||||||
|
@ -222,7 +222,7 @@ main(int argc, char **argv)
|
||||||
return !printf("usage: modal [-vqn] source.modal\n");
|
return !printf("usage: modal [-vqn] source.modal\n");
|
||||||
for(i = 1; i < argc && *argv[i] == '-'; i++) {
|
for(i = 1; i < argc && *argv[i] == '-'; i++) {
|
||||||
switch(argv[i][1]) {
|
switch(argv[i][1]) {
|
||||||
case 'v': /* version */ return !printf("Modal Interpreter, 18 Apr 2024.\n");
|
case 'v': /* version */ return !printf("Modal Interpreter, 19 Apr 2024.\n");
|
||||||
case 'q': /* quiet */ fclose(stderr); break;
|
case 'q': /* quiet */ fclose(stderr); break;
|
||||||
case 'n': /* infinite */ cycles = 0xffffffff; break;
|
case 'n': /* infinite */ cycles = 0xffffffff; break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue