コード例 #1
0
        public MathOperator GetMaxPrecedence(List <MathToken> tokens)
        {
            int       precedence         = 0;
            MathToken maxPrecedenceToken = null;
            int       index = -1;

            foreach (MathToken token in tokens)
            {
                index++;
                if (token.Precedence >= precedence)
                {
                    precedence               = token.Precedence;
                    maxPrecedenceToken       = token;
                    maxPrecedenceToken.Index = index;
                }
            }
            return((MathOperator)maxPrecedenceToken);
        }
コード例 #2
0
 public static MathOperator Create(MathToken token)
 {
     return Create(token.Token);
 }