Removed temporary pointers
This commit is contained in:
parent
3f5e099051
commit
ca76fdd9c3
73
src/modal.c
73
src/modal.c
|
@ -162,66 +162,51 @@ static char *
|
|||
compile_rule(Rule *r, int id, char *src)
|
||||
{
|
||||
int wrapped, reg;
|
||||
char c, *cap, *s2;
|
||||
char c, *cap;
|
||||
r->id = id, r->ptr = 0;
|
||||
|
||||
/* left ==================================== */
|
||||
|
||||
/* phase: left */
|
||||
r->a = r->b = dict_;
|
||||
s2 = src;
|
||||
|
||||
while((c = *s2) && c == ' ') s2++;
|
||||
if(c == ')' || (c == '<' && s2[1] == '>')) {
|
||||
while((c = *src) && c == ' ') src++;
|
||||
if(c == ')' || (c == '<' && src[1] == '>')) {
|
||||
*dict_++ = 0;
|
||||
return s2;
|
||||
return src;
|
||||
}
|
||||
|
||||
cap = walk(s2);
|
||||
cap = walk(src);
|
||||
wrapped = c == '(';
|
||||
if(wrapped) s2++, cap--;
|
||||
while(s2 < cap) {
|
||||
if(*s2 == '?') {
|
||||
*dict_++ = *s2++;
|
||||
reg = find_register(r, *s2);
|
||||
if(reg < 0 && *s2 != '(')
|
||||
r->key[r->ptr] = *s2, reg = r->ptr++;
|
||||
if(wrapped) src++, cap--;
|
||||
while(src < cap) {
|
||||
if(*src == '?') {
|
||||
*dict_++ = *src++;
|
||||
reg = find_register(r, *src);
|
||||
if(reg < 0 && *src != '(')
|
||||
r->key[r->ptr] = *src, reg = r->ptr++;
|
||||
*dict_++ = '0' + reg;
|
||||
} else
|
||||
*dict_++ = *s2++;
|
||||
*dict_++ = *src++;
|
||||
}
|
||||
s2 += wrapped;
|
||||
|
||||
src += wrapped;
|
||||
*dict_++ = 0;
|
||||
src = s2;
|
||||
|
||||
/* right ==================================== */
|
||||
|
||||
/* phase: right */
|
||||
r->b = dict_;
|
||||
s2 = src;
|
||||
|
||||
while((c = *s2) && c == ' ') s2++;
|
||||
if(c == ')' || (c == '<' && s2[1] == '>')) {
|
||||
while((c = *src) && c == ' ') src++;
|
||||
if(c == ')' || (c == '<' && src[1] == '>')) {
|
||||
*dict_++ = 0;
|
||||
return s2;
|
||||
return src;
|
||||
}
|
||||
|
||||
cap = walk(s2);
|
||||
cap = walk(src);
|
||||
wrapped = c == '(';
|
||||
if(wrapped) s2++, cap--;
|
||||
while(s2 < cap) {
|
||||
if(*s2 == '?') {
|
||||
*dict_++ = *s2++;
|
||||
reg = find_register(r, *s2);
|
||||
*dict_++ = reg >= 0 ? ('0' + reg) : *s2;
|
||||
s2++;
|
||||
if(wrapped) src++, cap--;
|
||||
while(src < cap) {
|
||||
if(*src == '?') {
|
||||
*dict_++ = *src++;
|
||||
reg = find_register(r, *src);
|
||||
*dict_++ = reg >= 0 ? ('0' + reg) : *src;
|
||||
src++;
|
||||
} else
|
||||
*dict_++ = *s2++;
|
||||
*dict_++ = *src++;
|
||||
}
|
||||
s2 += wrapped;
|
||||
|
||||
src += wrapped;
|
||||
*dict_++ = 0;
|
||||
src = s2;
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue