Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConstantRange"/> class.
        /// </summary>
        /// <param name="minimum">The minimum value in the range.</param>
        /// <param name="maximum">The maximum value in the range.</param>
        public ConstantRange(IOrderedLanguageConstant minimum, IOrderedLanguageConstant maximum)
        {
            Minimum = minimum;
            Maximum = maximum;

#if COVERAGE
            Debug.Assert(Minimum == minimum);
            Debug.Assert(Maximum == maximum);
#endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Tries to parse an expression as a constant number.
        /// </summary>
        /// <param name="expression">The expression to parse.</param>
        /// <param name="expressionConstant">The parsed constant upon return if successful.</param>
        /// <param name="error">Error found on failure.</param>
        /// <returns>True if the expression could be parsed as a constant; Otherwise, false.</returns>
        public static bool TryParseExpression(IExpression expression, out IOrderedLanguageConstant expressionConstant, out IError error)
        {
            expressionConstant = null;
            error = null;
            bool Result = false;

            if (expression.ExpressionConstant.IsAssigned && expression.ExpressionConstant.Item is IOrderedLanguageConstant AsOrderedLanguageConstant)
            {
                expressionConstant = AsOrderedLanguageConstant;
                Result             = true;
            }
            else
            {
                error = new ErrorNumberConstantExpected(expression);
            }

            return(Result);
        }
 /// <summary>
 /// Checks if this instance is greater than another constant.
 /// </summary>
 /// <param name="other">The other instance.</param>
 public virtual bool IsConstantGreater(IOrderedLanguageConstant other)
 {
     return(IsConstantGreater(other as INumberLanguageConstant));
 }