fCraft.SimpleParser.ProcessRightParenth C# (CSharp) Method

ProcessRightParenth() private static method

private static ProcessRightParenth ( Expression e, Stack tmpStack, int pos ) : void
e Expression
tmpStack Stack
pos int
return void
        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 );
        }