예제 #1
0
파일: VarExp.cs 프로젝트: marialzr/College
 public override int Eval(IMyDictionary <String, int> sym)
 {
     if (sym.ContainsKey(id))
     {
         int v;
         sym.TryGetValue(id, out v);
         return(v);
     }
     else
     {
         throw new Exception("The element does not exist in the symbol table");
     }
 }
예제 #2
0
        public PrgState Execute(PrgState p)
        {
            IMyDictionary <string, int> symbolt = p.SymTable;
            int id;

            symbolt.TryGetValue(expFileId, out id);
            FileData fd;

            p.FileTable.TryGetValue(id, out fd);
            StreamReader sr = fd.FileDescriptor;

            sr.Close();
            p.FileTable.Remove(id);
            return(p);
        }