Reformatted parse_frag
This commit is contained in:
parent
f6d0cc8ece
commit
318a5fddf5
12
src/modal.c
12
src/modal.c
|
@ -223,16 +223,16 @@ apply_rule(Rule *r, char *s)
|
||||||
static char *
|
static char *
|
||||||
parse_frag(char **side, char *s)
|
parse_frag(char **side, char *s)
|
||||||
{
|
{
|
||||||
int wrapped;
|
|
||||||
char c, *cap;
|
char c, *cap;
|
||||||
while((c = *s) && c == ' ') s++;
|
while((c = *s) && c == ' ') s++;
|
||||||
if(c == ')' || (c == '<' && s[1] == '>')) {
|
if(c == ')' || (c == '<' || c == '>'))
|
||||||
*side = ∅
|
*side = ∅
|
||||||
return s;
|
else {
|
||||||
|
int wrapped;
|
||||||
|
*side = dict_, cap = walk(s), wrapped = c == '(';
|
||||||
|
if(wrapped) s++, cap--;
|
||||||
|
dict_ = copy(s, dict_, cap - s), s = cap + wrapped, *dict_++ = 0;
|
||||||
}
|
}
|
||||||
*side = dict_, cap = walk(s), wrapped = c == '(';
|
|
||||||
if(wrapped) s++, cap--;
|
|
||||||
dict_ = copy(s, dict_, cap - s), s = cap + wrapped, *dict_++ = 0;
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue