Faster parse frag

This commit is contained in:
Devine Lu Linvega 2024-05-10 09:45:58 -07:00
parent 318a5fddf5
commit 3cbd3d196d
1 changed files with 6 additions and 4 deletions

View File

@ -228,10 +228,12 @@ parse_frag(char **side, char *s)
if(c == ')' || (c == '<' || c == '>'))
*side = &empty;
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;
cap = walk(s), *side = dict_;
if(c == '(')
dict_ = copy(s + 1, dict_, cap - s - 2);
else
dict_ = copy(s, dict_, cap - s);
s = cap, *dict_++ = 0;
}
return s;
}