Exemplo n.º 1
0
        internal Interpret(
            string expression, int argsCount,
            InterpretCreator <T> creator)
        {
            this.code  = creator.Codes;
            this.funcs = creator.Functions;
            this.numbs = creator.Numbers;

            this.expression = expression;
            this.stackMax   = creator.StackMax;
            this.argsCount  = argsCount;

            this.stackArray = new T[creator.StackMax];
            this.paramArray = new T[argsCount];
            this.syncRoot   = new object();

#if FULL_FW
            switch (argsCount)
            {
            case 1: this.asyncTab = (TabFunc1)Tab1Impl; break;

            case 2: this.asyncTab = (TabFunc2)Tab2Impl; break;

            default: this.asyncTab = (TabFuncN)TabNImpl; break;
            }
#endif
        }
Exemplo n.º 2
0
 internal static Interpret <T> Create(
     bool checks, string expr, int args,
     InterpretCreator <T> creator)
 {
     return(checks ?
            Checked(expr, args, creator) :
            Normal(expr, args, creator));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Generates the <see cref="Interpret{T}"/>
        /// object for evaluating the specified
        /// <paramref name="expression"/>.</summary>
        /// <param name="expression">Expression to create
        /// <see cref="Interpret{T}"/> from.</param>
        /// <exception cref="SyntaxException">
        /// <paramref name="expression"/> contains
        /// syntax error(s) and can't be used for the
        /// <see cref="Interpret{T}"/> creation.</exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="expression"/> is null.</exception>
        /// <returns><see cref="Interpret{T}"/> object
        /// for evaluating expression.</returns>
        public Interpret <T> CreateInterpret(string expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            var creator = new InterpretCreator <T>();

            ParseOptimized(expression, creator);

            return(Interpret <T> .Create(
                       OverflowCheck, expression, ArgsCount, creator));
        }
Exemplo n.º 4
0
 public InterpretImpl(
     string expr, int args, InterpretCreator <T> creator) :
     base(expr, args, creator)
 {
 }