Esempio n. 1
0
        public bool DeclareVariables(VarDeclarationList List, VarDeclConvMode Mode = VarDeclConvMode.Nothing,
                                     GetIdMode IdMode = GetIdMode.Everywhere)
        {
            var Variables = List.ToVariables(GetPlugin(), BeginEndMode.Both, Mode);

            return(DeclareVariables(Variables, IdMode));
        }
Esempio n. 2
0
        public static VarDeclarationList Create(IdContainer Container, CodeString Code, List <Modifier> DefaultModifiers = null,
                                                VarDeclarationListFlags Flags = VarDeclarationListFlags.Default)
        {
            var Ret = new VarDeclarationList(DefaultModifiers);
            var Rec = Container.State.Language.VarDeclRecognizer;

            if (Rec != null)
            {
                var EnableMessages = (Flags & VarDeclarationListFlags.EnableMessages) != 0;
                if (!Rec.Recognize(Container, Code, EnableMessages, Ret))
                {
                    return(null);
                }
                if (!Ret.Process(Container, Flags))
                {
                    return(null);
                }
            }
            else
            {
                throw new ApplicationException("A variable declaration recognizer is not avaiable");
            }

            return(Ret);
        }
Esempio n. 3
0
        public bool DeclareVariables(CodeString Str, List <Modifier> Mods = null,
                                     VarDeclConvMode Mode = VarDeclConvMode.Nothing, GetIdMode IdMode = GetIdMode.Everywhere)
        {
            var List = VarDeclarationList.Create(this, Str, Mods);

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

            return(DeclareVariables(List, Mode, IdMode));
        }
Esempio n. 4
0
        public FunctionParameter[] GetParameters(IdContainer Container, CodeString Parameters)
        {
            var DeclList = VarDeclarationList.Create(Container, Parameters);

            if (DeclList == null)
            {
                return(null);
            }

            var RetValue = DeclList.ToFuncParams(new PluginForGlobals(Container), Mode: VarDeclConvMode.Normal);

            if (RetValue == null || RetValue.Contains(null))
            {
                return(null);
            }
            return(RetValue);
        }
Esempio n. 5
0
        static bool SameTypes(VarDeclarationList A, VarDeclarationList B)
        {
            if (A.Count != B.Count)
            {
                return(false);
            }

            for (var i = 0; i < A.Count; i++)
            {
                if (!A[i].Type.IsEquivalent(B[i].Type))
                {
                    return(false);
                }
            }

            return(true);
        }