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 *
|
static char *
|
||||||
parse_rule_frag(char *s)
|
parse_rule_frag(char *s)
|
||||||
{
|
{
|
||||||
char *ss = walk(s), *d = dict_;
|
char *ss = walk(s);
|
||||||
if(*s == '(') s++, ss--;
|
if(*s == '(') s++, ss--;
|
||||||
while((s < ss)) *dict_++ = *s++;
|
while((s < ss)) *dict_++ = *s++;
|
||||||
*dict_++ = 0;
|
*dict_++ = 0;
|
||||||
return d;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
parse_rule(Rule *r, char *s){
|
parse_rule(Rule *r, char *s){
|
||||||
char c;
|
char c;
|
||||||
while((c = *s) && c <= ' ') s++;
|
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++;
|
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;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue