コード例 #1
0
 public override bool IsMatch( Parser.Token tkn)
 {
     return (tkn.ToString() == ">");
 }
コード例 #2
0
        /// <summary>
        /// OpFactor(...): Reads the passed operator, identifies the associated implementation object
        ///		and requests an operation object to be used in evaluating the equation.
        /// </summary>
        /// <param name="oSourceOp">Parser.Token object representing the operator in question.</param>
        /// <param name="oValue1">The first value object to be operated on.</param>
        /// <param name="oValue2">The second value object to be operated on.</param>
        /// <returns>CValue object representing an operation.</returns>
        private CValue OpFactory( Parser.Token oSourceOp, CValue oValue1, CValue oValue2 )
        {
            foreach( COperator oOp in m_aOps )
            {

                if( oOp.IsMatch( oSourceOp ))
                    return oOp.Factory(oValue1, oValue2);
            }

            throw new ApplicationException("Invalid operator in equation.");
        }
コード例 #3
0
        /// <summary>
        /// Compile():  This function kicks off the process to tokenize the function
        ///		and compile the resulting token set into a runnable form.
        /// </summary>
        public void Compile()
        {
            Parser oParser = new Parser(m_sEquation );
            m_enumTokens = oParser.GetTokenEnumerator();

            PositionNextToken();

            m_Function = Relational();
        }
コード例 #4
0
 /// <summary>
 /// CheckParms( Parser.Token, CValue) - This method makes certain the single argument is non-null.
 ///		Raises an exception if it is.
 /// </summary>
 /// <param name="oToken">Parser.Token object</param>
 /// <param name="arg1">CValue argument</param>
 private void CheckParms( Parser.Token oToken, CValue arg1 )
 {
     if( arg1 == null )
         throw new ApplicationException("Argument not supplied near " + oToken.ToString() + " operation.");
 }
コード例 #5
0
 /// <summary>
 /// IsMatch(): accepts an operation token and identifies if the implemented
 ///		operator class is responsible for it.  This allows for multiple operators
 ///		to represent a given operation (i.e. != and <> both represent the "not-equal" case.
 /// </summary>
 /// <param name="tkn">Parser.Token containing the operator in question</param>
 /// <returns>bool returning true if the object is reponsible for implementing the operator at hand.</returns>
 public abstract bool IsMatch( Parser.Token tkn);