示例#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) ?? "");
        }
 public ArithmeticExpression(ArithmeticOperation op, TextExpression exp1, TextExpression exp2)
 {
     this._op      = op;
     this._exp1    = exp1;
     this._exp2    = exp2;
     this.RawValue = exp1.RawValue + (object)op + exp2.RawValue;
 }
 public ComparisonExpression(ComparisonOperation op, TextExpression exp1, TextExpression exp2)
 {
     this._op      = op;
     this._exp1    = exp1;
     this._exp2    = exp2;
     this.RawValue = exp1.RawValue + (object)op + exp2.RawValue;
 }
示例#4
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;
示例#5
0
 public ConditionExpression(
     TextExpression condition,
     TextExpression part1,
     TextExpression part2)
 {
     this._conditionExpressions = new TextExpression[1]
     {
         condition
     };
     this._resultExpressions = new TextExpression[2]
     {
         part1,
         part2
     };
 }
示例#6
0
 public SelectionExpression(TextExpression selection, List <TextExpression> selectionExpressions)
 {
     this._selection            = selection;
     this._selectionExpressions = selectionExpressions;
 }
 public FieldExpression(TextExpression innerExpression, TextExpression part2)
     : this(innerExpression)
 {
     this.part2 = part2;
 }
 public FieldExpression(TextExpression innerExpression)
 {
     this._innerExpression = innerExpression;
     this.RawValue         = innerExpression.RawValue;
 }
示例#9
0
 public ParanthesisExpression(TextExpression innerExpression)
 {
     this._innerExp = innerExpression;
     this.RawValue  = "(" + innerExpression.RawValue + ")";
 }
 public ArrayReference(string rawValue, TextExpression indexExp)
 {
     this.RawValue  = rawValue;
     this._indexExp = indexExp;
 }
 public SimpleExpression(TextExpression innerExpression)
 {
     this._innerExpression = innerExpression;
     this.RawValue         = innerExpression.RawValue;
 }