public static ParseInformation ParseProjectContents(string fileName, string Content, bool IsOpened) { if (projContentInfo.ContainsKey(fileName) == false) { projContentInfo[fileName] = new ProjectContentItem(fileName, Content, IsOpened); } projContentInfo[fileName].Contents = Content; IParser parser = GetParser(fileName); if (parser == null) { return(null); } ICompilationUnit parserOutput = null; parserOutput = parser.Parse(projectContent, fileName, Content); lastParserError = parser.LastErrors; if (projContentInfo.ContainsKey(fileName)) { ParseInformation parseInformation = projContentInfo[fileName].ParsedContents; if (parseInformation == null) { parseInformation = new ParseInformation(); projContentInfo[fileName].ParsedContents = parseInformation; } projectContent.UpdateCompilationUnit(parseInformation.MostRecentCompilationUnit, parserOutput, fileName); } else { projectContent.UpdateCompilationUnit(null, parserOutput, fileName); } return(UpdateParseInformation(parserOutput, fileName)); }
public static ParseInformation ParseProjectContents(string fileName, string Content, bool IsOpened) { //try // { lock (s_obs) { if (s_projContentInfo == null) { s_projContentInfo = new Dictionary <string, ProjectContentItem>(); } if (s_projContentInfo.ContainsKey(fileName) == false) { s_projContentInfo[fileName] = new ProjectContentItem(fileName, Content, IsOpened); } s_projContentInfo[fileName].Contents = Content; IParser parser = GetParser(fileName); if (parser == null) { MessageBox.Show("Parser errors.."); return(null); } ICompilationUnit parserOutput = null; parserOutput = parser.Parse(s_projectContent, fileName, Content); if (parserOutput == null) { MessageBox.Show("Parser errors.."); return(null); } s_lastParserError = parser.LastErrors; if (s_projContentInfo.ContainsKey(fileName)) { ParseInformation parseInformation = s_projContentInfo[fileName].ParsedContents; if (parseInformation == null) { parseInformation = new ParseInformation(); s_projContentInfo[fileName].ParsedContents = parseInformation; } s_projectContent.UpdateCompilationUnit(parseInformation.MostRecentCompilationUnit, parserOutput, fileName); } else { s_projectContent.UpdateCompilationUnit(null, parserOutput, fileName); } return(UpdateParseInformation(parserOutput, fileName)); // } //} //catch (Exception ex) //{ //} //finally //{ //} //return null; } }