fixes bugs in parsing semtrex with nexted groups/parens