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); }
public static MathOperator Create(MathToken token) { return Create(token.Token); }