// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static FunctionParser() { FirstFunction = new TokenSet(TokenType.Sine | TokenType.Cosine | TokenType.Tangent); FirstFactor = FirstFunction + new TokenSet(TokenType.Variable | TokenType.OpenParen); FirstFactorPrefix = FirstFactor + TokenType.Constant; FirstUnaryExp = FirstFactorPrefix + TokenType.Minus; FirstExpExp = new TokenSet(FirstUnaryExp); FirstMultExp = new TokenSet(FirstUnaryExp); _firstAddExp = new TokenSet(FirstUnaryExp); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /// <summary> /// Check if the CurrentToken is a member of a set Token types /// </summary> /// <param name="tokens">The set of Token types to check against</param> /// <returns> /// true if the CurrentToken's type is in the set /// false if it is not /// </returns> private static bool Check(TokenSet tokens) => tokens.Contains(_currentToken.Type);