Housekeeping

This commit is contained in:
Devine Lu Linvega 2024-04-04 14:59:55 -07:00
parent c174832c8e
commit 81a995090f
1 changed files with 3 additions and 7 deletions

View File

@ -1,5 +1,4 @@
#include <stdio.h>
#include <string.h>
typedef struct {
char *a, *b;
@ -46,8 +45,7 @@ writereg(char r)
while((c = *s++)) {
if(c == '(') depth++;
if(c == ')') --depth;
if(c == ' ' && !depth)
break;
if(c == ' ' && !depth) break;
*outp_++ = c;
}
return 1;
@ -57,8 +55,7 @@ static void
save(void)
{
int i, end = outp_ - outp;
for(i = 0; i < end; i++)
prog[i] = outp[i];
for(i = 0; i < end; i++) prog[i] = outp[i];
prog[i] = 0;
prog_ = prog;
outp_ = outp;
@ -76,12 +73,11 @@ rewrite(void)
char *res = match(p, r);
if(res != NULL) {
char cc, *b = r->b;
while((cc = *b++)) {
while((cc = *b++))
if(cc == '?')
writereg(*b++);
else
*outp_++ = cc;
}
found = 1;
p = res;
}