Fixed bug with lambda mismatch
This commit is contained in:
parent
927479bc44
commit
d43eec77f3
|
@ -148,6 +148,7 @@ apply_rule(Rule *r, char *s)
|
||||||
while(*s == ' ') s++;
|
while(*s == ' ') s++;
|
||||||
if(*s == ')' && *(dst_ - 1) == ' ') dst_--;
|
if(*s == ')' && *(dst_ - 1) == ' ') dst_--;
|
||||||
}
|
}
|
||||||
|
printf("[%s]\n", r->a);
|
||||||
return write_rule(r, s, 0);
|
return write_rule(r, s, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +217,7 @@ rewrite(void)
|
||||||
if(c == '?' && s[1] == '(') {
|
if(c == '?' && s[1] == '(') {
|
||||||
cap = walk(s + 1), compile_rule(&lambda, -1, s + 2), s = cap;
|
cap = walk(s + 1), compile_rule(&lambda, -1, s + 2), s = cap;
|
||||||
while(*s == ' ') s++;
|
while(*s == ' ') s++;
|
||||||
if(!apply_rule(&lambda, s)) write_rule(r, s, 0);
|
if(!apply_rule(&lambda, s)) write_rule(&lambda, s, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* phase: match */
|
/* phase: match */
|
||||||
|
@ -240,7 +241,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, 25 Apr 2024.\n");
|
case 'v': /* version */ return !printf("Modal Interpreter, 26 Apr 2024.\n");
|
||||||
case 'q': /* quiet */ quiet = 1; break;
|
case 'q': /* quiet */ quiet = 1; break;
|
||||||
case 'n': /* infinite */ cycles = 0xffffffff; break;
|
case 'n': /* infinite */ cycles = 0xffffffff; break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue