public VHDL_CodeFile(string filePath, string libraryName, VHDLCompiler compiler) : base(filePath, libraryName, ModelingLanguage.VHDL) { this.compiler = compiler; libraryFileInfo = LibraryFileInfo.AnalyseText(text, filePath, LibraryName); }
/// <summary> /// Обновление служебной информации /// </summary> public void UpdateLibraryInfo() { libraryFileInfo = LibraryFileInfo.AnalyseText(text, filePath, LibraryName); }
/// <summary> /// Если обьект класса CodeFile является VHDL_CodeFile, /// то провести его обработку и встроить в общую библиотеку, /// новый поток не создается, /// ошибки выписываются в обьект file /// </summary> /// <param name="file"></param> public override void ProcessCodeFile(CodeFile file) { try { lock (this) { isBusy = true; if ((file is VHDL_CodeFile) && ((file as VHDL_CodeFile).LibraryName == "work")) { VHDL_CodeFile vhdlCode = (file as VHDL_CodeFile); vhdlCode.ParseException = null; vhdlCode.ParseSyntaxException = null; vhdlCode.ParseSemanticException = null; VhdlFile oldFile = null; foreach (VhdlFile f in currentLibrary.Files) { if (f.FilePath == file.FilePath) { oldFile = f; break; } } if (oldFile != null) { currentLibrary.Files.Remove(oldFile); } IParseTree tree; CommonTokenStream tokenStream; ICharStream stream = new CaseInsensitiveStringStream(file.Text, file.FilePath); VhdlFile ParsedFile = Parse(stream, currentLibrary, out tokenStream, out tree); if (ParsedFile != null) { ParsedFile.FilePath = file.FilePath; } vhdlCode.File = ParsedFile; vhdlCode.ParseSemanticException = parseSemanticException; vhdlCode.ParseSyntaxException = parseSyntaxException; vhdlCode.ParseException = parseException; vhdlCode.TokenStream = tokenStream; vhdlCode.Tree = tree; vhdlCode.LibraryFileInfo = LibraryFileInfo.AnalyseText(vhdlCode.Text, vhdlCode.FilePath, vhdlCode.LibraryName); foreach (CodeFile f in vhdlCode.Dependencies) { f.NeedForUpdate = true; } SetDependencies(); } base.ProcessCodeFile(file); isBusy = false; } } catch (Exception ex) { Messages.Add(new DiagnosticMessage(string.Format("Message: {0}\n Source: {1}\n StackTrace: {2}\n HelpLink: {3}", ex.Message, ex.Source, ex.StackTrace, ex.HelpLink))); NotifyCollectionChanged(); } }