Ejemplo n.º 1
0
        public Variable FindVariable(string varName)
        {
            varName = varName.ToLower();

            Variable v = Variables.ContainsKey(varName) ? Variables[varName] : null;

            if (v == null && ParentContext != null)
            {
                v = ParentContext.FindVariable(varName);
            }

            if (v != null && Locks.ContainsKey(varName))
            {
                v.Value = Locks[varName].GetValue();
            }

            return(v);
        }
Ejemplo n.º 2
0
        // Check if this expression term represents a registered variable
        private bool TryParseVariable(String text)
        {
            if (this.Variable != null)
            {
                Value = this.Variable.Value;
                return(true);
            }
            else
            {
                bool     startsWithAtSign = text.StartsWith("@");
                Variable variable         = executionContext.FindVariable(startsWithAtSign ? text.Substring(1) : text);

                if (variable != null)
                {
                    IsStatic = startsWithAtSign;
                    Value    = variable.Value;
                    Variable = variable;
                    return(true);
                }

                return(false);
            }
        }