public void Assign(string variable, ProgNodeValue value, int index)
        {
            SymbolTableRec record = GetSymbolTableRec(variable);

            if (record != null)
            {
                record.Assign(value, index);
            }
        }
Example #2
0
        public SymbolTableRec GetSymbolTableRec(string variable)
        {
            SymbolTableRec symTableRec = null;

            if (scope.TryGetValue(variable, out SymbolTableRec record))
            {
                symTableRec = record;
            }

            return(symTableRec);
        }
        /// <summary>
        /// GetSymbolTableRec() - Starts at the top of the stack and searches <br/>
        /// for the first instance of the target variable within the scope.  <br/>
        /// If the variable is found a symbol table records is returned.  If <br/>
        /// the variable is not found a null is returned.
        /// </summary>
        /// <param name="variable"></param>
        /// <returns></returns>
        public SymbolTableRec GetSymbolTableRec(string variable)
        {
            int            scope       = activeScope;
            SymbolTableRec symTableRec = SymTable[scope].GetSymbolTableRec(variable);

            while ((symTableRec == null) && (--scope >= 0))
            {
                symTableRec = SymTable[scope].GetSymbolTableRec(variable);
            }

            return(symTableRec);
        }