diff --git a/src/modal.c b/src/modal.c index b8566df..32562fc 100644 --- a/src/modal.c +++ b/src/modal.c @@ -117,19 +117,16 @@ apply_rule(Rule *r, char *s) while((c = *a++)) { if(c == '?') { char *pcap = walk(s); - id = *a - '0'; + id = *a++ - '0'; if((reg = regs[id])) { /* reg cmp */ char *rcap = walk(reg), *pp = s; while(reg < rcap || pp < pcap) if(*reg++ != *pp++) return 0; } else /* reg set */ regs[id] = s; - c = *a++, s = pcap; - if(!spacer(c)) - while((c = *a) && !spacer(c)) a++; - continue; + c = *a, s = pcap; } - if(c != *s++) return 0; + else if(c != *s++) return 0; } c = *s; if(!spacer(c)) return 0; @@ -266,5 +263,6 @@ main(int argc, char **argv) if(!cycles--) return !fprintf(stdout, "Modal rewrites exceeded.\n"); while(rules_-- > rules && !quiet) if(!rules_->refs) printf("-- Unused rule: %d <> (%s) (%s)\n", rules_->refs, rules_->a, rules_->b); + if(!quiet) printf(".. %s\n", src_); return 0; } \ No newline at end of file