public Hashtable MakeTokenListing(string code) { //System.Diagnostics.Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; //Regex rx = new Regex(@"^(\s*//\s*(.*)\n)*?^\s*function\s*(\b[A-Z_][A-Z0-9_]*\b)\s*\((.*?)\)(\s*//\s*(.*)\s*\n)?", RegexOptions.IgnoreCase | RegexOptions.Multiline);\ Regex rx = new Regex(@"(^(\s*///\s*(.*?)\n){0,5})?^\s*function\s*(\b[A-Z_][A-Z0-9_]+\b)\s*\((.*?)\)", RegexOptions.IgnoreCase | RegexOptions.Multiline); Hashtable ht = new Hashtable(); foreach (Match mt in rx.Matches(code)) { if (ht.ContainsKey(mt.Groups[4].Value.ToLower())) { continue; } CProject.TokenKey token = new CProject.TokenKey(); token.FuncName = mt.Groups[4].Value; token.LineNumber = mt.Groups[4].Index; if (mt.Groups[4].Value != "") { string[] token_params = mt.Groups[5].Value.Replace(" ", "").Split(','); token.FuncParams = token_params; } else { token.FuncParams = null; } //token.FuncDescr = mt.Groups[4].Value; string descr = mt.Groups[1].Value.Replace("///", "").Replace("\t", "").Replace("\r\n", "").Replace("\r", "").TrimStart('\n'); foreach (string line in descr.Split('\n')) { if (line.Trim() == "") { continue; } token.FuncDescr += line.Trim() + "<br />"; } if (token.FuncDescr != null) { token.FuncDescr = token.FuncDescr.Substring(0, token.FuncDescr.Length - 6); } ht.Add(token.FuncName.ToLower(), token); } //System.Diagnostics.Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; return(ht); }
public Hashtable MakeTokenListing(string code) { //System.Diagnostics.Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; //Regex rx = new Regex(@"^(\s*//\s*(.*)\n)*?^\s*function\s*(\b[A-Z_][A-Z0-9_]*\b)\s*\((.*?)\)(\s*//\s*(.*)\s*\n)?", RegexOptions.IgnoreCase | RegexOptions.Multiline);\ Regex rx = new Regex(@"(^(\s*///\s*(.*?)\n){0,5})?^\s*function\s*(\b[A-Z_][A-Z0-9_]+\b)\s*\((.*?)\)", RegexOptions.IgnoreCase | RegexOptions.Multiline); Hashtable ht = new Hashtable(); foreach(Match mt in rx.Matches(code)) { if (ht.ContainsKey(mt.Groups[4].Value.ToLower())) continue; CProject.TokenKey token = new CProject.TokenKey(); token.FuncName = mt.Groups[4].Value; token.LineNumber = mt.Groups[4].Index; if (mt.Groups[4].Value != "") { string[] token_params = mt.Groups[5].Value.Replace(" ", "").Split(','); token.FuncParams = token_params; } else { token.FuncParams = null; } //token.FuncDescr = mt.Groups[4].Value; string descr = mt.Groups[1].Value.Replace("///", "").Replace("\t", "").Replace("\r\n", "").Replace("\r", "").TrimStart('\n'); foreach(string line in descr.Split('\n')) { if (line.Trim() == "") continue; token.FuncDescr += line.Trim() + "<br />"; } if (token.FuncDescr != null) token.FuncDescr = token.FuncDescr.Substring(0, token.FuncDescr.Length - 6); ht.Add(token.FuncName.ToLower(), token); } //System.Diagnostics.Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; return ht; }