Пример #1
0
        static bool CreateAndDeclareRecursively(IdContainer Container, TypeDeclarationList Out)
        {
            var RetValue = true;
            var State    = Container.State;
            var Scope    = Container as NonCodeScope;

            if (Scope != null && Scope.Code.IsValid)
            {
                var NewList = new TypeDeclarationList();
                var Rec     = State.Language.TypeDeclRecognizer;
                if (!Rec.Recognize(Scope, NewList) || !NewList.Declare())
                {
                    RetValue = false;
                }

                Out.AddRange(NewList);
            }

            for (var i = 0; i < Container.Children.Count; i++)
            {
                var e = Container.Children[i];
                if (!CreateAndDeclareRecursively(e, Out))
                {
                    RetValue = false;
                }
            }

            return(RetValue);
        }
Пример #2
0
        public static TypeDeclarationList Create(NonCodeScope Scope)
        {
            var Ret = new TypeDeclarationList();
            var Rec = Scope.State.Language.TypeDeclRecognizer;

            return(Rec != null && !Rec.Recognize(Scope, Ret) ? null : Ret);
        }
Пример #3
0
        bool ProcessTypes(List <Identifier> Out)
        {
            var Aliases    = new AliasDeclarationList();
            var Namespaces = NamespaceDeclList.CreateAndDeclareRecursively(this);

            if (Namespaces == null)
            {
                return(false);
            }

            if (!Aliases.RecognizeRecursively(this))
            {
                return(false);
            }
            if (!Aliases.Declare(false))
            {
                return(false);
            }

            var Types = TypeDeclarationList.CreateAndDeclareRecursively(this);

            if (Types == null)
            {
                return(false);
            }

            SearchCommonIdentifiers();
            if (!Aliases.Recognize(Types))
            {
                return(false);
            }
            if (!Aliases.Declare(false))
            {
                return(false);
            }

            var Consts = ConstDeclarationList.CreateAndDeclareRecursively(this);

            if (Consts == null || !Aliases.Declare(false))
            {
                return(false);
            }

            if (!ProcessClassBases(this))
            {
                return(false);
            }
            if (!ProcessScopes(this, Out))
            {
                return(false);
            }

            Flags |= GlobalContainerFlags.StructureMembersParsed;
            if (!ProcessStructureIdentifiers(this))
            {
                return(false);
            }
            return(Aliases.Declare());
        }
Пример #4
0
        public static TypeDeclarationList CreateAndDeclareRecursively(IdContainer Container)
        {
            var Ret = new TypeDeclarationList();

            if (Container.State.Language.TypeDeclRecognizer != null)
            {
                if (!CreateAndDeclareRecursively(Container, Ret))
                {
                    return(null);
                }
            }

            return(Ret);
        }
Пример #5
0
        public bool Recognize(TypeDeclarationList List)
        {
            var RetValue = true;

            for (var i = 0; i < List.Count; i++)
            {
                var NewType = List[i].DeclaredType as StructuredType;
                if (NewType == null)
                {
                    continue;
                }

                if (!Recognize(NewType.StructuredScope))
                {
                    RetValue = false;
                }
            }

            return(RetValue);
        }