From: Mikko Rasa Date: Fri, 5 Mar 2021 22:33:44 +0000 (+0200) Subject: Ignore precedence for prefix operators X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e8542d921a07b7391d558cb3349a68f26675f797;p=libs%2Fgl.git Ignore precedence for prefix operators 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. --- diff --git a/source/glsl/parser.cpp b/source/glsl/parser.cpp index c924606f..d2261126 100644 --- a/source/glsl/parser.cpp +++ b/source/glsl/parser.cpp @@ -447,7 +447,8 @@ RefPtr Parser::parse_expression(unsigned precedence) 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;