Ejemplo n.º 1
0
        /// <summary>
        /// This method evaluates a symbol name and returns its value.
        /// </summary>
        /// <param name="name">Name of symbol</param>
        /// <param name="pos">Position at start of symbol</param>
        /// <returns></returns>
        protected double EvaluateSymbol(string name, int pos)
        {
            double result = default(double);

            // We found a symbol reference
            SymbolStatus status = SymbolStatus.UndefinedSymbol;

            if (ProcessSymbol != null)
            {
                SymbolEventArgs args = new SymbolEventArgs();
                args.Name   = name;
                args.Result = result;
                args.Status = SymbolStatus.OK;
                ProcessSymbol(this, args);
                result = args.Result;
                status = args.Status;
            }
            if (status == SymbolStatus.UndefinedSymbol)
            {
                throw new EvalException(String.Format(ErrUndefinedSymbol, name), pos);
            }
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method evaluates a symbol name and returns its value.
        /// </summary>
        /// <param name="name">Name of symbol</param>
        /// <param name="pos">Position at start of symbol</param>
        /// <returns></returns>
        protected double EvaluateSymbol(string name, int pos)
        {
            double result = default(double);

            // We found a symbol reference
            SymbolStatus status = SymbolStatus.UndefinedSymbol;
            if (ProcessSymbol != null)
            {
                SymbolEventArgs args = new SymbolEventArgs();
                args.Name = name;
                args.Result = result;
                args.Status = SymbolStatus.OK;
                ProcessSymbol(this, args);
                result = args.Result;
                status = args.Status;
            }
            if (status == SymbolStatus.UndefinedSymbol)
                throw new EvalException(String.Format(ErrUndefinedSymbol, name), pos);
            return result;
        }