protected TokenImpl ApplyPrecedence(ExpressionCompiler compiler, BinaryToken lhs, LeftHandUnaryToken newToken) { // If the left-hand side is a binary token, and the new token has a higher precedence, // then take the right-hand side from the old left-hand side and use that as the left // hand side on the new token. The new token then becomes the right-hand side of the left // hand side. int lhsPrecedence = compiler.GetPrecedence(lhs.GetType()); int newPrecedence = compiler.GetPrecedence(newToken.GetType()); if (newPrecedence < lhsPrecedence) { newToken.Lhs = lhs.Rhs; lhs.Rhs = newToken; return(lhs); } else { return(newToken); } }