private static void ProcessRightParenth( Expression e, Stack<FuncData> tmpStack, int pos )
{
if ( tmpStack.Count == 0 )
throw new ArgumentException( "unmatching right parenthesis at " + pos );
while ( tmpStack.Peek().SpecialKind != SpecialOperandKind.LeftParenthesis ) {
e.Append( tmpStack.Pop().Func );
if ( tmpStack.Count == 0 )
throw new ArgumentException( "unmatching right parenthesis at " + pos );
}
tmpStack.Pop(); //remove left parenthesis
while ( tmpStack.Count > 0 && tmpStack.Peek().IsFunctionOrUnary ) //append function/unary minus or both
e.Append( tmpStack.Pop().Func );
}