Exemple #1
0
        public ConstExpression(IFunctionRuntimeControl internalControl, Token token)
            : base(internalControl, token)
        {
            switch (Token.TokenType)
            {
            case TokenType.Numeric:
                string  tokenString = Token.TokenString.Replace(',', '.');
                decimal num;
                if (!decimal.TryParse(tokenString, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
                {
                    throw new ArgumentException($"Wrong numeric value '{Token.TokenString}'");
                }
                constValue = new SObject()
                {
                    NumValue = num
                };
                break;

            case TokenType.Text:
                constValue = new SObject()
                {
                    StringValue = Token.TokenString
                };
                break;

            default:
                throw new ScriptRuntimeException(Token, $"Const token type '{Token.TokenType}' not supported!");
            }
        }
 public ParserA(FunctionsRepository functions, IVariablesHeap vars, IFunctionRuntimeControl runtimeControl)
 {
     this.functions      = functions ?? throw new ArgumentNullException("Interpreter box can't be null!");
     this.vars           = vars ?? throw new ArgumentNullException("Vars can't be null!");
     this.runtimeControl = runtimeControl ?? throw new ArgumentNullException("Runtime control can't be null!");
 }
 public VariableExpression(IFunctionRuntimeControl internalControl, Token token, IVariablesHeap vars)
     : base(internalControl, token)
 {
     this.vars = vars ?? throw new ArgumentNullException("Vars can't be null!");
 }
Exemple #4
0
 public FunctionExpression(IFunctionRuntimeControl internalControl, Token token, FunctionBase function)
     : base(internalControl, token)
 {
     this.Function = function ?? throw new ArgumentNullException("Function can't be null!");
 }
Exemple #5
0
 public ArgumentsExpression(IFunctionRuntimeControl internalControl)
     : base(internalControl)
 {
 }
Exemple #6
0
 public Expression(IFunctionRuntimeControl internalControl, List <Expression> expressions)
     : this(internalControl)
 {
     SubExpressions = expressions ?? throw new ArgumentNullException("SubExpressions can'tbe null!");
 }
Exemple #7
0
 public Expression(IFunctionRuntimeControl internalControl, Token token)
     : this(internalControl)
 {
     this.Token = token ?? throw new ArgumentNullException("Token can'tbe null!");
 }
Exemple #8
0
 public Expression(IFunctionRuntimeControl internalControl)
 {
     this.InternalControl = internalControl ?? throw new ArgumentNullException("internalControl can't be null!");
 }