当前位置: 首页>>代码示例>>C#>>正文


C# Struct.FindVars方法代码示例

本文整理汇总了C#中Struct.FindVars方法的典型用法代码示例。如果您正苦于以下问题:C# Struct.FindVars方法的具体用法?C# Struct.FindVars怎么用?C# Struct.FindVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Struct的用法示例。


在下文中一共展示了Struct.FindVars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindUserFunctions

    public static void FindUserFunctions(string[] text)
    {
        Struct tempS;
        string name = "", type = "";
        for (int i = 0; i < text.Length; i++)
        {
            string temp = text[i].Replace("private ", "").Replace("static ", "").Replace("public ", "").Replace("operator ", "").Trim();
            if (temp.Length >= 9 && temp.Substring(0, 9) == "function " && temp.IndexOf("takes") != -1 && temp.IndexOf("returns") != -1)
            {
                temp = temp.Substring(9, temp.Length - 9);
                type = temp.Substring(temp.IndexOf("returns") + 8, temp.Length - temp.IndexOf("returns") - 8);
                if (type != "nothing" && type != "void")
                {
                    name = temp.Substring(0, temp.IndexOf(' '));
                    JData.Add(name, type);
                    //Types.AddFunc(name, type);
                }
            }
            else if (temp.Length >= 7 && temp.Substring(0, 7) == "method " && temp.IndexOf("takes") != -1 && temp.IndexOf("returns") != -1)
            {
                temp = temp.Substring(7, temp.Length - 7);
                type = temp.Substring(temp.IndexOf("returns") + 8, temp.Length - temp.IndexOf("returns") - 8);
                if (type != "nothing" && type != "void")
                {
                    name = temp.Substring(0, temp.IndexOf(' ')).Trim();
                    JData.Add(name, type);
                    //Types.AddFunc(name, type);
                }
            }
            else if (temp.Length >= 7 && temp.Substring(0, 7) == "struct ")
            {
                int close = i + 1;
                if (temp[temp.Length - 1] == '{' || text[i + 1].Trim() == "{")
                    close = Analyzer.FindBraces(text, i);
                else
                    for (int j = i; j < text.Length; j++)
                        if (text[j].Trim() == "endstruct")
                        {
                            close = j - 1;
                            break;
                        }
                tempS = new Struct();
                tempS.FindVars(text, i, close);
                tempS.FindMethods(text, i, close);
                Structs.Add(tempS);
            }
            else
            {
                int index = temp.IndexOf(' ');
                int bIndex = temp.IndexOf('(');
                if (index != -1 && index < bIndex && temp.Substring(0, index) != "define" &&
                    temp.Substring(0, index) != "callback" && temp.Substring(0, index) != "lambda" &&
                    temp.Substring(0, index) != "library" && temp.Substring(0, index) != "scope" &&
                    temp.Substring(0, index) != "enum" && temp.Substring(0, index) != "struct" &&
                    temp.Substring(0, index) != "loop" && temp.Substring(0, index) != "for" &&
                    temp.Substring(0, index) != "while" && temp.Substring(0, index) != "whilenot" &&
                    temp.Substring(0, index) != "until" && temp.Substring(0, 2) != "if" &&
                    temp.Substring(0, index) != "else" && temp.Substring(0, index) != "elseif" &&
                    temp.Substring(0, index) != "call" && temp.Substring(0, index) != "set" &&
                    temp.Substring(0, index) != "return" && temp.Substring(0, index) != "exitwhen" &&
                    temp.Substring(0, index) != "local" && temp.Substring(0, index) != "void" &&
                    temp.Substring(0, index) != "nothing" && temp.IndexOf('=') == -1 &&
                    Analyzer.CountSymbolsInText("(", temp) == 1 && Analyzer.CountSymbolsInText(")", temp) == 1 &&
                    temp.IndexOf(';') == -1)
                {
                    type = temp.Substring(0, index).Trim();
                    temp = temp.Replace(type, "");
                    JData.Add(temp.Substring(0, temp.IndexOf('(')).Trim(), type);
                    //Types.AddFunc(temp.Substring(0, temp.IndexOf('(')).Trim(), type);
                }
            }

        }
    }
开发者ID:Ty3uK,项目名称:JASP,代码行数:74,代码来源:Analyzer.cs


注:本文中的Struct.FindVars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。