コード例 #1
0
ファイル: IdContainer.cs プロジェクト: bencz/Zinnia-lang
        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));
        }
コード例 #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);
        }
コード例 #3
0
ファイル: IdContainer.cs プロジェクト: bencz/Zinnia-lang
        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));
        }
コード例 #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);
        }
コード例 #5
0
ファイル: IdContainer.cs プロジェクト: bencz/Zinnia-lang
        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);
        }