Esempio n. 1
0
 public ExcelExpressionPart(ExcelFormulaToken token, ExpressionScope scope)
 {
     this.originalToken = token;
     this.TokenType     = token.Type;
     this.scope         = scope;
     if (token.Type == ExcelFormulaTokenType.OperatorInfix ||
         token.Type == ExcelFormulaTokenType.OperatorPrefix ||
         token.Type == ExcelFormulaTokenType.OperatorPostfix
         )
     {
         this.Operator = token.Value;
     }
 }
Esempio n. 2
0
        internal static ExcelValue Create(ExcelFormulaToken token, ExpressionScope scope)
        {
            switch (token.Subtype)
            {
            case ExcelFormulaTokenSubtype.Text: return(new TextValue(token.Value, scope.OutLanguage));

            case ExcelFormulaTokenSubtype.Number: return(new DecimalValue(double.Parse(token.Value, CultureInfo.InvariantCulture), scope.OutLanguage));

            case ExcelFormulaTokenSubtype.Logical: return(BooleanValue.Create(bool.Parse(token.Value)));

            case ExcelFormulaTokenSubtype.Range: return(new RangeValue(token.Value));

            default: throw new InvalidOperationException($"ExcelValue.Create: invalid subtype {token.Subtype}");
            }
            ;
        }
Esempio n. 3
0
 public void Push(ExcelFormulaToken token)
 {
     stack.Push(token);
 }
Esempio n. 4
0
 public ExcelFormulaToken Add(ExcelFormulaToken token)
 {
     tokens.Add(token);
     return(token);
 }