Exemplo n.º 1
0
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        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);
        }
Exemplo n.º 2
0
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        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);
        }
Exemplo n.º 3
0
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        /// <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);
Exemplo n.º 4
0
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        /// <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);