Standardizing the add_rule funciton
This commit is contained in:
parent
9f7faa41b5
commit
37c92c4914
10
src/modal.c
10
src/modal.c
|
@ -133,20 +133,22 @@ commit_rule(Rule *r, char *s, int create)
|
|||
static char *
|
||||
parse_rule_frag(char *s)
|
||||
{
|
||||
char *ss = walk(s), *d = dict_;
|
||||
char *ss = walk(s);
|
||||
if(*s == '(') s++, ss--;
|
||||
while((s < ss)) *dict_++ = *s++;
|
||||
*dict_++ = 0;
|
||||
return d;
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *
|
||||
parse_rule(Rule *r, char *s){
|
||||
char c;
|
||||
while((c = *s) && c <= ' ') s++;
|
||||
r->a = parse_rule_frag(s), s = walk(s);
|
||||
r->a = dict_;
|
||||
s = parse_rule_frag(s), s++;
|
||||
while((c = *s) && c <= ' ') s++;
|
||||
r->b = parse_rule_frag(s), s = walk(s);
|
||||
r->b = dict_;
|
||||
s = parse_rule_frag(s), s++;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue