Shunting-yard algorithm and unary minus

I am attempting to implement a shunting-yard algorithm for a calculator following the rules laid out in https://en.wikipedia.org/wiki/Shunting-yard_algorithm .

When programming the unary minus, however, I do not know which precedence method to follow due to the ideas raised in following question https://math.stackexchange.com/questions/1299236/why-does-unary-minus-operator-sometimes-take-precedence-over-exponentiation-and

As this is a key component of a functioning calculator, which precedence is the 'industry standard' and is there an algorithm which would perform both of these precedence methods at the same time to solve this problem?

Bonus points if the algorithm (if it exists) retains the O(n) linear time increase.

• If I understand what you are saying, you want to parse the expression first according to a grammar that has unary - lower precedence than binary ^, and second, also parse the expression according to a grammar where unary - is higher precedence than binary ^, and still be O(n). Well, that is easy, you just parse it twice because O(2n) = O(n). – Erik Eidt Sep 4 '16 at 0:30