예제 #1
0
        private static List <FunctionArgument> ParseFuncArgs(string text)
        {
            List <FunctionArgument> res = new List <FunctionArgument>();
            var parts = text.Trim().Split(',');

            foreach (var part in parts)
            {
                var parts2 = part.Split(new char[] { ' ', '*' }, StringSplitOptions.RemoveEmptyEntries);
                if (parts2.Length < 2)
                {
                    continue;
                }
                bool isPointer = part.Contains("*");
                var  arg       = new FunctionArgument()
                {
                    name = parts2[parts2.Length - 1], type = CLType.Parse(parts2[parts2.Length - 2] + (isPointer ? "*" : ""))
                };
                res.Add(arg);
            }

            return(res);
        }
예제 #2
0
        public static List <ExplorerItem> BuildExplorerItems(Range range)
        {
            List <ExplorerItem> list = new List <ExplorerItem>();

            foreach (var r in range.GetRanges(FuncSignatureRegex))
            {
                var m = FuncSignatureParserRegex.Match(r.Text);
                if (!m.Success)
                {
                    continue;
                }
                var item = new ExplorerItem()
                {
                    type = ExplorerItemType.Method, line = r.Start.iLine, funcName = m.Groups["name"].Value, funcType = CLType.Parse(m.Groups["type"].Value)
                };
                item.args = ParseFuncArgs(m.Groups["args"].Value);
                list.Add(item);
            }

            list.Sort(new ExplorerItemComparer());

            return(list);
        }