Since the operator appears at the start of an expression or after another
operator, there's no way for it to bind to anything but whatever follows.
This fixes a bug where chained prefix operators were not recognized.
if(token==i->token && (!left || i->type!=Operator::PREFIX) && (left || i->type!=Operator::POSTFIX))
oper = i;
- if(token==";" || token==")" || token=="]" || token=="," || (oper && precedence && oper->precedence>=precedence))
+ bool lower_precedence = (oper && oper->type!=Operator::PREFIX && precedence && oper->precedence>=precedence);
+ if(token==";" || token==")" || token=="]" || token=="," || lower_precedence)
{
if(left)
return left;