コード例 #1
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 public override SymbolInfo FindOnlyInType(string name, Scope CurrentScope)
 {
     SymbolInfo si = SymbolTable.FindOnlyInType(this, name, CurrentScope);
     if (PartialScope != null)
     {
         if (si == null)
             si = SymbolTable.FindOnlyInType(PartialScope, name, CurrentScope);
         else
         {
             SymbolInfo tmp_si = si;
             while (tmp_si.Next != null)
                 tmp_si = tmp_si.Next;
             tmp_si.Next = SymbolTable.FindOnlyInType(PartialScope, name, CurrentScope);
         }
     }
     if (si == null) return si;
     PascalABCCompiler.TreeRealization.BasePCUReader.RestoreSymbols(si, name);
     return si;
 }
コード例 #2
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 public SymbolInfo Find(Scope scope, string Name, Scope FromScope)
 {
     return FindAll(scope, Name, false, false, FromScope);
 }
コード例 #3
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 public SymbolInfo FindOnlyInType(Scope scope, string Name, Scope FromScope)
 {
     return FindAll(scope, Name, true, false,FromScope);
 }
コード例 #4
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		private SymbolInfo AddToSymbolInfo(SymbolInfo to,SymbolInfo si,Scope scope)
		{
			if(si!=null)
				if(IsNormal(to,si))	
				{
					to.Next=si;si.Next=null;
					LastScope=scope;
					return si;
				}
			LastScope=scope;
			return to;	
		}
コード例 #5
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		private SymbolInfo FindAllInAreaList(SymbolInfo si,string name,Scope[] arr,AreaNodesList AreaNodes, bool StopIfFind, SymbolInfo FirstInfo)
		{
			if (arr==null) return si;
			int p;
            SymbolInfo sib=si;
            HashSet<Assembly> assm_cache = new HashSet<Assembly>();
			foreach(Scope sc in arr)
			{
                if (sc is DotNETScope)
                {
                    if (sc is PascalABCCompiler.NetHelper.NetScope)
                    {
                        PascalABCCompiler.NetHelper.NetScope netScope = sc as PascalABCCompiler.NetHelper.NetScope;
                        if (PascalABCCompiler.NetHelper.NetHelper.PABCSystemType == null || netScope.Assembly != PascalABCCompiler.NetHelper.NetHelper.PABCSystemType.Assembly)
                        {
                            if (!assm_cache.Contains(netScope.Assembly))
                                assm_cache.Add(netScope.Assembly);
                            else if (netScope.used_namespaces.Count == 0)
                                continue;
                        }
                    }
                    si = AddToSymbolInfo(si, (DotNETScope)sc, name);
                    if (sib.Next != null && StopIfFind)
                        return si;
                }
                else
                if (AreaNodes != null && sc != null)
                {
                    p = AreaNodes.IndexOf(sc.ScopeNum);
                    if (p >= 0)
                    {
                        si = AddToSymbolInfo(si, AreaNodes[p].InfoList, sc, FirstInfo);
                        if (sib.Next != null && StopIfFind)
                            return si;
                    }
                }
			}
			return si;
		}
コード例 #6
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 private bool IsInOneModule(Scope Scope1, Scope Scope2)
 {
     Scope1 = FindUnitInterfaceScope(Scope1);
     Scope2 = FindUnitInterfaceScope(Scope2);
     return (Scope1 != null) && (Scope2 != null) && (Scope1.ScopeNum == Scope2.ScopeNum);
 }
コード例 #7
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 private bool IsVisible(SymbolInfo ident, Scope fromScope)
 {
     if (fromScope == null) 
         return true;
     if (FindClassScope(ident.scope) == null)
         return true;
     switch (ident.access_level)
     {
         case access_level.al_public:
         case access_level.al_internal:
             return true;
         case access_level.al_protected:
             return IsInOneModule(ident.scope, fromScope) || IsInOneOrDerivedClass(ident.scope, fromScope);
         case access_level.al_private:
             return IsInOneModule(ident.scope, fromScope);
     }
     return true;
 }
コード例 #8
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		public ClassScope CreateClassScope(Scope TopScope,Scope BaseClass)
		{
            return new ClassScope(this, TopScope, BaseClass);	
		}
コード例 #9
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 public InterfaceScope CreateInterfaceScope(Scope TopScope, Scope BaseClass, Scope[] TopInterfaces)
 {
     return new InterfaceScope(this, TopScope, BaseClass, TopInterfaces);
 }
コード例 #10
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		public LambdaScope CreateLambdaScope(Scope TopScope) //lroman//
        {
            return new LambdaScope(this, TopScope);
        }
コード例 #11
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		public Scope CreateScope(Scope TopScope)
		{
			return new Scope(this,TopScope);
		}
コード例 #12
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		public ClassMethodScope(DSSymbolTable vSymbolTable,Scope TopScope,Scope MyClass):
			base(vSymbolTable,TopScope)
		{
			MyClassNum=-2;
			if (MyClass!=null) 
				MyClassNum=MyClass.ScopeNum;
		}
コード例 #13
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 public InterfaceScope(DSSymbolTable vSymbolTable, Scope TopScope, Scope BaseClassScope, Scope[] vTopInterfaceScopeArray)
     :
     base(vSymbolTable, TopScope, BaseClassScope)
 {
     _TopInterfaceScopeArray = vTopInterfaceScopeArray;
 }
コード例 #14
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 public InterfaceScope(DSSymbolTable vSymbolTable, Scope TopScope, Scope[] vTopInterfaceScopeArray)
     :
     base(vSymbolTable, TopScope, null)
 {
     _TopInterfaceScopeArray = vTopInterfaceScopeArray;
 }
コード例 #15
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 private Scope FindUnitInterfaceScope(Scope scope)
 {
     while (scope!=null && !(scope is UnitInterfaceScope))
         scope = scope.TopScope;
     return scope;
 }
コード例 #16
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
        //\ssyy
        public UnitInterfaceScope CreateUnitInterfaceScope(Scope[] UsedUnits)
		{
			return new UnitInterfaceScope(this,null,UsedUnits);
		}
コード例 #17
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 private Scope FindClassScope(Scope scope)
 {
     while (scope != null && !(scope is ClassScope))
         if(scope is ClassMethodScope)
             scope = ((ClassMethodScope)scope).MyClass;
         else
             scope = scope.TopScope;
     return scope;
 }
コード例 #18
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		public UnitImplementationScope CreateUnitImplementationScope(Scope InterfaceScope,Scope[] UsedUnits)
		{
			return new UnitImplementationScope(this,InterfaceScope,UsedUnits);
		}
コード例 #19
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 private bool IsInOneOrDerivedClass(Scope IdentScope, Scope FromScope)
 {
     IdentScope = FindClassScope(IdentScope);
     FromScope = FindClassScope(FromScope);
     while (FromScope != null)
     {
         if (IdentScope.ScopeNum == FromScope.ScopeNum)
             return true;
         if (FromScope is ClassScope)
             FromScope = ((ClassScope)FromScope).BaseClassScope;
         else
             FromScope = ((PascalABCCompiler.NetHelper.NetTypeScope)FromScope).TopScope;
     }
     return false;
     
 }
コード例 #20
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		public ClassMethodScope CreateClassMethodScope(Scope TopScope,Scope MyClass)
		{
			return new ClassMethodScope(this,TopScope,MyClass);
		}
コード例 #21
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		private SymbolInfo AddToSymbolInfo(SymbolInfo to, List<SymbolInfo> from, Scope scope, SymbolInfo FirstInfo)
		{
            bool CheckVisible = CurrentScope != null, NeedAdd = false;
            foreach (SymbolInfo si in from)
            {
                if (CheckVisible)
                    NeedAdd = IsVisible(si, CurrentScope) && IsNormal(to, si);
                else
                    NeedAdd = IsNormal(to, si);
                if (NeedAdd && !AlreadyAdded(si,FirstInfo))
                {
                    to.Next = si;
                    si.Next = null;
                    to = si;
                }
            }
			LastScope=scope;
			return to;
		}
コード例 #22
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		//возвращает номер верхней области видимости относительно
		//области Scope
		public Scope GetTopScope(Scope scope)
		{
			//DEBUG
#if (DEBUG)
			if ((scope.TopScopeNum>=ScopeTable.Count)|(scope.TopScopeNum<0)) throw new Exception("Ошибка при взятии верхней области видимости: область с номером "+scope.ScopeNum+" не существует");
#endif
            return ScopeTable[scope.TopScopeNum];
		}
コード例 #23
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
 private SymbolInfo FindAllInAreaList(SymbolInfo si, string name, Scope[] arr, AreaNodesList AreaNodes,SymbolInfo FirstInfo)
 {
     return FindAllInAreaList(si, name, arr, AreaNodes, false, FirstInfo);
 }
コード例 #24
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		//Возвращает количество уровней на которые надо поднятся начиная с Down чтобы очутиться в Up
		//Работает только для процедур. Модуль считает за одно Scope
		public int GetRelativeScopeDepth(Scope Up,Scope Down)
		{
			if (Up==Down) return 0;
			int depth=0;
			while(Down.TopScopeNum>=0)
			{
				if (Up==Down) return depth;
				if(!(Down is UnitImplementationScope))
					depth++;
				Down=Down.TopScope;
			}
			//throw new Exception("Can not execute st depth");
			return -1;
		}
コード例 #25
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		//поиск всех имен в ООВ.
		//  ищет наборы имен в ООВ, если находит то возвращает их список.
		//  иначе ищет в обьемлющем ООВ.
		//SymbolInfo возвращаются в поряде в котором они встретились при проходе областей
		public SymbolInfo Find(Scope scope,string Name)
		{
            return FindAll(scope, Name, false, false,  null);
		}
コード例 #26
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		//Добавление символа
		//если такой символ в пр-ве имен уже существует то symbol_info добавляется к AreaListNode[].InfoList[]
		public void Add(Scope InScope,string Name,SymbolInfo Inf)
		{
            //int.try
           //{
                Inf.scope = InScope;
                if (!InScope.CaseSensitive) Name = Name.ToLower();
                int hn = HashTable.Add(new HashTableNode(Name));//ЗДЕСь ВОЗНИКАЕТ НЕДЕТЕРМЕНИРОВАНЯ ОШИБКА
                HashTable.hash_arr[hn].NumAreaList.Add(new AreaListNode(InScope.ScopeNum, Inf));
            //}
           // catch (Exception e)
            //{
             //  throw e;
           // }
		}
コード例 #27
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
        public SymbolInfo FindOnlyInType(Scope scope, string Name)
		{
            //TODO: Почему ищет везде??? Только в типе и надтипах. А в юните он найдет?
            return FindAll(scope, Name, true, false, null);
		}
コード例 #28
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		//Этот метод ищет ТОЛЬКО В УКАЗАННОЙ ОВ, и не смотрит есть ли имя выше.
		//Если это ОВ типа UnitImplementationScope то имя ищется также и
		//в верней ОВ, которая типа UnitInterfaceScope
		public SymbolInfo FindOnlyInScope(Scope scope,string Name, bool FindInUpperBlocks)
		{
            if (!scope.CaseSensitive) Name = Name.ToLower();
            CurrentScope = null;
			LastScope=null;
            SymbolInfo FirstInfo = new SymbolInfo();
			SymbolInfo info=FirstInfo;
			int Area=scope.ScopeNum;
			int tn=HashTable.Find(Name);		//найдем имя в хеше
            if (tn < 0 || scope is DotNETScope)//если нет такого ищем в областях .NET
            {
                Scope an;
                an = ScopeTable[Area];
                if (an is DotNETScope)
                    info = AddToSymbolInfo(info, (DotNETScope)an, Name);
                return FirstInfo.Next;
            }
            
            AreaNodesList AreaList=HashTable.hash_arr[tn].NumAreaList;
			int CurrentArea=Area,ai,bs;
            do
            {
                if (ScopeTable[CurrentArea] is UnitPartScope) //мы очутились в модуле
                {

                    //мы в ImplementationPart?
                    if (ScopeTable[CurrentArea] is UnitImplementationScope)
                    {
                        ai = AreaList.IndexOf(CurrentArea);
                        if (ai >= 0) //что-то нашли!
                            info = AddToSymbolInfo(info, AreaList[ai].InfoList, ScopeTable[CurrentArea],FirstInfo);
                        CurrentArea = GetTopScopeNum(CurrentArea);
                    }
                    //сейча мы в InterfacePart
                    ai = AreaList.IndexOf(CurrentArea);
                    if (ai >= 0) //что-то нашли!
                        info = AddToSymbolInfo(info, AreaList[ai].InfoList, ScopeTable[CurrentArea],FirstInfo);
                    if(FirstInfo.Next!=null)
                        return FirstInfo.Next;
                }
                if (ScopeTable[CurrentArea] is WithScope)//мы очутились в Width
                {
                    ai = AreaList.IndexOf(CurrentArea);
                    if (ai >= 0) //что-то нашли!
                        info = AddToSymbolInfo(info, AreaList[ai].InfoList, ScopeTable[CurrentArea],FirstInfo);
                    if (FirstInfo.Next != null) //если что-то нашли то заканчиваем
                        return FirstInfo.Next;
                    info = FindAllInAreaList(info, Name, (ScopeTable[CurrentArea] as WithScope).WithScopes, AreaList, true,FirstInfo);
                    if (FirstInfo.Next != null) //если что-то нашли то заканчиваем
                        return FirstInfo.Next;
                }
                else
                {
                    ai = AreaList.IndexOf(CurrentArea);
                    if (ai >= 0) //что-то нашли!
                    {
                        info = AddToSymbolInfo(info, AreaList[ai].InfoList, ScopeTable[CurrentArea],FirstInfo);
                        return FirstInfo.Next;
                    }
                }
                bs = CurrentArea;
                CurrentArea = GetTopScopeNum(CurrentArea);
            } while (CurrentArea >= 0 && (FindInUpperBlocks && ScopeTable[bs] is BlockScope));
//            } while (CurrentArea >= 0 && ScopeTable[bs] is BlockScope);
            /*if (!CaseSensitive) Name=Name.ToLower();
            int Area=scope.ScopeNum;
            int tn=HashTable.Find(Name);
            if (tn<0) return null;
            int ai=HashTable.hash_arr[tn].NumAreaList.IndexOf(Area);
            CurrentScope = null;

            if (ScopeTable[Area] is UnitImplementationScope) 
            {
                int ai2=HashTable.hash_arr[tn].NumAreaList.IndexOf(ScopeTable[Area].TopScopeNum);
                if ((ai < 0) && (ai2 >= 0))
                //Kolay modified if.
                //return HashTable.hash_arr[tn].NumAreaList[ai2].InfoList[0];
                {
                    SymbolInfo si_init = HashTable.hash_arr[tn].NumAreaList[ai2].InfoList[0];
                    SymbolInfo si_next = si_init;
                    for (int iter = 1; iter < HashTable.hash_arr[tn].NumAreaList[ai2].InfoList.Count; iter++)
                    {
                        si_next.Next = HashTable.hash_arr[tn].NumAreaList[ai2].InfoList[iter];
                        si_next = si_next.Next;
                    }
                    return si_init;
                }
                if ((ai>=0)&&(ai2>=0))
                {
                    SymbolInfo si_int=HashTable.hash_arr[tn].NumAreaList[ai2].InfoList[0];
                    SymbolInfo si_impl=HashTable.hash_arr[tn].NumAreaList[ai].InfoList[0];

                    //Kolay modified. All methods searched.

                    //SymbolInfo si_init_interface = HashTable.hash_arr[tn].NumAreaList[ai].InfoList[0];
                    SymbolInfo si_next = si_int;
                    for (int iter = 1; iter < HashTable.hash_arr[tn].NumAreaList[ai].InfoList.Count; iter++)
                    {
                        si_next.Next = HashTable.hash_arr[tn].NumAreaList[ai].InfoList[iter];
                        si_next = si_next.Next;
                    }

                    si_next.Next=si_impl;
                    si_next = si_next.Next;
                    for (int iter = 1; iter < HashTable.hash_arr[tn].NumAreaList[ai2].InfoList.Count; iter++)
                    {
                        si_next.Next = HashTable.hash_arr[tn].NumAreaList[ai2].InfoList[iter];
                        si_next = si_next.Next;
                    }

                    return si_int;

                    
                    //return it;
                }
            }

            if (ai >= 0)
            //Kolay modifeds this if.
            //return HashTable.hash_arr[tn].NumAreaList[ai].InfoList[0];
            {
                SymbolInfo si_init = HashTable.hash_arr[tn].NumAreaList[ai].InfoList[0];
                SymbolInfo si_next = si_init;
                for (int iter = 1; iter < HashTable.hash_arr[tn].NumAreaList[ai].InfoList.Count;iter++ )
                {
                    si_next.Next = HashTable.hash_arr[tn].NumAreaList[ai].InfoList[iter];
                    si_next = si_next.Next;
                }
                //Проверить не чиго ли это не портит!
                PascalABCCompiler.TreeRealization.BasePCUReader.RestoreSymbolsImplementationMember(si_init, Name);
                return si_init;
            }
			
			
            * */
            return null;
             
		}
コード例 #29
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		private SymbolInfo FindAll(Scope scope,string Name,bool OnlyInType,bool OnlyInThisClass, Scope FromScope)
		{
			if(OnlyInType && !(scope is ClassScope) && !(scope is SymbolTable.DotNETScope)) return null;
			//if (!CaseSensitive) Name=Name.ToLower();
            if(!scope.CaseSensitive)
                Name = Name.ToLower();
            CurrentScope = FromScope; //глобальные переменные могут привести к ошибкам при поиске и поторном вызове!
            LastScope = null;         //глобальные переменные могут привести к ошибкам при поиске и поторном вызове!
            SymbolInfo FirstInfo = new SymbolInfo();
			SymbolInfo info=FirstInfo;
			int Area=scope.ScopeNum;
			Scope[] used_units=null;
			int tn=HashTable.Find(Name);		//найдем имя в хеше

            // SSM 21.01.16
            if (Name.StartsWith("?"))     // это значит, надо искать в областях .NET
                Name = Name.Substring(1); // съели ? и ищем т.к. tn<0
            // end SSM 

            if (tn<0 || scope is DotNETScope)//если нет такого ищем в областях .NET
			{
                //ssyy
                int NextUnitArea = -2;
                //\ssyy
				Scope an;
				while(Area>=0)
				{
					an=ScopeTable[Area];
                    if (an is DotNETScope)
                    {
                        if (tn < 0)
                            info = AddToSymbolInfo(info, (DotNETScope)an, Name);
                        else
                            info = FindAllInClass(info, Name, Area, HashTable.hash_arr[tn].NumAreaList, false, FirstInfo);
                    }
                    if (FirstInfo.Next != null) 
                        return FirstInfo.Next;
					if (an is UnitPartScope)
					{
						if (an is UnitImplementationScope)
						{
							info=FindAllInAreaList(info,Name,(an as UnitImplementationScope).TopScopeArray,null,FirstInfo);
							an=ScopeTable[an.TopScopeNum];
						}
						info=FindAllInAreaList(info,Name,(an as UnitInterfaceScope).TopScopeArray,null,FirstInfo);
						if (FirstInfo.Next!=null) 
                            return FirstInfo.Next;
					}
                    if (an is WithScope)//мы очутились в Width
                    {
                        info = FindAllInAreaList(info, Name, (an as WithScope).WithScopes, null, true,FirstInfo);
                        if (FirstInfo.Next != null) //если что-то нашли то заканчиваем
                            return FirstInfo.Next;
                    }
					if (an is ClassScope)
					{
						int unit_area=an.TopScopeNum;
                        InterfaceScope IntScope = an as InterfaceScope;
                        while (((ClassScope)an).BaseClassScopeNum >= 0)
						{
							an=ScopeTable[((ClassScope)an).BaseClassScopeNum];
							if(an is DotNETScope)
							{
								info=AddToSymbolInfo(info,(DotNETScope)an,Name);
                                if (FirstInfo.Next != null) // || OnlyInType) 
                                    return FirstInfo.Next;
								break;
							}
						}
                        //В предках ничего не нашли, ищем по интерфейсам...
                        if (IntScope != null)
                        {
                            info = FindAllInAreaList(info, Name, IntScope.TopInterfaceScopeArray, null,FirstInfo);
                            if (FirstInfo.Next != null) //если что-то нашли то заканчиваем
                                return FirstInfo.Next;
                        }
                        if (OnlyInType)
                            return FirstInfo.Next;
                        //ssyy
                        if (NextUnitArea > -1)
                        {
                            Area = NextUnitArea;
                            //NextUnitArea = -2;
                            continue;
                        }
                        else
                        //\ssyy
						    an=ScopeTable[unit_area];
					}
					if (info.Next!=null) return FirstInfo.Next;
	
					if (an is ClassMethodScope)
					{
                        //ssyy
                        NextUnitArea = an.TopScopeNum;
                        //\ssyy
						Area=(an as ClassMethodScope).MyClassNum;
					}
					else
					{
						Area=GetTopScopeNum(Area);
					}

					//Area=GetTopScopeNum(Area);
				}
				return null;				//если такого нет то поиск окончен
			} 
						
			AreaNodesList AreaList=HashTable.hash_arr[tn].NumAreaList;
			int CurrentArea=Area,ai;
			while (CurrentArea>=0)
			{
				if (ScopeTable[CurrentArea] is UnitPartScope) //мы очутились в модуле
				{
					
					//мы в ImplementationPart?
					if (ScopeTable[CurrentArea] is UnitImplementationScope)
					{
						used_units=(ScopeTable[CurrentArea] as UnitImplementationScope).TopScopeArray;
						ai=AreaList.IndexOf(CurrentArea);
						if (ai>=0) //что-то нашли!
							info=AddToSymbolInfo(info,AreaList[ai].InfoList,ScopeTable[CurrentArea],FirstInfo);
						CurrentArea=GetTopScopeNum(CurrentArea);
					}
					//сейча мы в InterfacePart
					ai=AreaList.IndexOf(CurrentArea);
					if (ai>=0) //что-то нашли!
						info=AddToSymbolInfo(info,AreaList[ai].InfoList,ScopeTable[CurrentArea],FirstInfo);
					//смотрим в модулях
					info=FindAllInAreaList(info,Name,used_units,AreaList,FirstInfo);
					info=FindAllInAreaList(info,Name,(ScopeTable[CurrentArea] as UnitInterfaceScope).TopScopeArray,AreaList,FirstInfo);
					return FirstInfo.Next;
				}
				else
                if (ScopeTable[CurrentArea] is IInterfaceScope)
                {
                    info = FindAllInClass(info, Name, CurrentArea, AreaList,OnlyInThisClass,FirstInfo);
                    if (FirstInfo.Next != null) //если что-то нашли то заканчиваем
                       return FirstInfo.Next; 
                    //Зачем искать в интерфейсах?
                    //(ssyy) Не понимаю вопрос. Спросившему подумать, зачем в компиляторе нужен поиск.
                    info = FindAllInAreaList(info, Name, (ScopeTable[CurrentArea] as IInterfaceScope).TopInterfaceScopeArray, AreaList, FirstInfo);
                    if (FirstInfo.Next != null || OnlyInType) //если что-то нашли то заканчиваем
                        return FirstInfo.Next;                    
                }
                else
				if(ScopeTable[CurrentArea] is ClassScope)//мы очутились в классе
				{	
					info=FindAllInClass(info,Name,CurrentArea,AreaList,OnlyInThisClass,FirstInfo);//надо сделать поиск по его предкам
                    if (FirstInfo.Next != null || OnlyInType) //если что-то нашли то заканчиваем
						return FirstInfo.Next; 
					//иначе ищем дальше
				}
                else
                if (ScopeTable[CurrentArea] is WithScope)//мы очутились в With
                {
                    ai = AreaList.IndexOf(CurrentArea);
                    if (ai >= 0) //что-то нашли!
                        info = AddToSymbolInfo(info, AreaList[ai].InfoList, ScopeTable[CurrentArea],FirstInfo);
                    if (FirstInfo.Next != null) //если что-то нашли то заканчиваем
                        return FirstInfo.Next;
                    Scope[] wscopes = (ScopeTable[CurrentArea] as WithScope).WithScopes;
                    if(wscopes!=null)
                        foreach (Scope wsc in wscopes)
                        {
                            info = FindAllInClass(info, Name, wsc.ScopeNum, AreaList, OnlyInThisClass,FirstInfo);//надо сделать поиск по его предкам                    
                            if (FirstInfo.Next != null) //если что-то нашли то заканчиваем
                                return FirstInfo.Next;
                        }
                    //info = FindAllInAreaList(info, Name, (ScopeTable[CurrentArea] as WithScope).WithScopes, AreaList, true);
                }
                else
                {
                    ai = AreaList.IndexOf(CurrentArea);
                    if (ai >= 0) //что-то нашли!
                    {
                        info = AddToSymbolInfo(info, AreaList[ai].InfoList, ScopeTable[CurrentArea],FirstInfo);
                        return FirstInfo.Next;
                    }
                    if (ScopeTable[CurrentArea] is ClassMethodScope)//мы очутились в методе класса
                    {
                        info = FindAllInClass(info, Name, (ScopeTable[CurrentArea] as ClassMethodScope).MyClassNum, AreaList, OnlyInThisClass,FirstInfo);//надо сделать поиск по его классу
                        if (FirstInfo.Next != null) //если что-то нашли то заканчиваем
                            return FirstInfo.Next;
                    }
                }
				CurrentArea=GetTopScopeNum(CurrentArea);//Пошли вверх
				
			}
			return null;
		}
コード例 #30
0
ファイル: SymbolTable.cs プロジェクト: Slav76/pascalabcnet
		public ClassScope(DSSymbolTable vSymbolTable,Scope TopScope,Scope BaseClassScope):
			base(vSymbolTable,TopScope)
		{
			BaseClassScopeNum=-2;
			if (BaseClassScope!=null) 
				BaseClassScopeNum=BaseClassScope.ScopeNum;
		}