Beispiel #1
0
        internal override string EvaluateString(TextProcessingContext context, TextObject parent)
        {
            bool           flag           = false;
            int            index          = 0;
            TextExpression textExpression = (TextExpression)null;

            while (!flag && index < this._conditionExpressions.Length)
            {
                TextExpression conditionExpression = this._conditionExpressions[index];
                string         str = conditionExpression.EvaluateString(context, parent);
                if (str.Length != 0)
                {
                    flag = conditionExpression.TokenType != TokenType.ParameterWithAttribute ? (uint)this.EvaluateAsNumber(conditionExpression, context, parent) > 0U : !str.IsStringNoneOrEmpty();
                }
                if (flag)
                {
                    if (index < this._resultExpressions.Length)
                    {
                        textExpression = this._resultExpressions[index];
                    }
                }
                else
                {
                    ++index;
                }
            }
            if (textExpression == null && index < this._resultExpressions.Length)
            {
                textExpression = this._resultExpressions[index];
            }
            return(textExpression?.EvaluateString(context, parent) ?? "");
        }
Beispiel #2
0
 internal int EvaluateAsNumber(
     TextExpression exp,
     TextProcessingContext context,
     TextObject parent)
 {
     if (exp is NumeralExpression numeralExpression)
     {
         return(numeralExpression.EvaluateNumber(context, parent));
     }
     string  s     = exp.EvaluateString(context, parent);
     int     num   = 0;
     ref int local = ref num;