diff --git a/.gitignore b/.gitignore index 61b7e0520..cb5bfc8a1 100644 --- a/.gitignore +++ b/.gitignore @@ -65,7 +65,7 @@ **/TestPlugin.dll **/TreeConverter.dll **/VBNETParser.dll -**/Utils.dll +**/PABCCoreUtils.dll **/pabcnetc.exe **/pabcnetc.exe.config **/pabcnetcclear.exe diff --git a/AdditionalLanguages/SPython/SyntaxTreeConverters/SPythonStandardTreeConverter/SPythonStandardTreeConverter.csproj b/AdditionalLanguages/SPython/SyntaxTreeConverters/SPythonStandardTreeConverter/SPythonStandardTreeConverter.csproj index a11a33ca1..4c24c2d5d 100644 --- a/AdditionalLanguages/SPython/SyntaxTreeConverters/SPythonStandardTreeConverter/SPythonStandardTreeConverter.csproj +++ b/AdditionalLanguages/SPython/SyntaxTreeConverters/SPythonStandardTreeConverter/SPythonStandardTreeConverter.csproj @@ -11,7 +11,7 @@ false - + diff --git a/Compiler/Compiler.cs b/Compiler/Compiler.cs index eb68dca03..6339a619b 100644 --- a/Compiler/Compiler.cs +++ b/Compiler/Compiler.cs @@ -147,6 +147,7 @@ using PascalABCCompiler.PCU; using PascalABCCompiler.SemanticTreeConverters; using PascalABCCompiler.SyntaxTreeConverters; using PascalABCCompiler.TreeRealization; +using PascalABCCompiler.CoreUtils; using System; using System.CodeDom.Compiler; using System.Collections; diff --git a/Compiler/Compiler.csproj b/Compiler/Compiler.csproj index c67555ad9..00f2164c7 100644 --- a/Compiler/Compiler.csproj +++ b/Compiler/Compiler.csproj @@ -16,6 +16,7 @@ + diff --git a/Compiler/ICompiler.cs b/Compiler/ICompiler.cs index 7968a1bf9..fb9f827cd 100644 --- a/Compiler/ICompiler.cs +++ b/Compiler/ICompiler.cs @@ -1,10 +1,7 @@ // Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using System; using System.Collections.Generic; -using System.Text; using PascalABCCompiler.SemanticTreeConverters; -using PascalABCCompiler.SyntaxTreeConverters; using PascalABCCompiler.Errors; ///В разработке DarkStar @@ -82,7 +79,7 @@ namespace PascalABCCompiler get; } - SourceFilesProviderDelegate SourceFilesProvider + PascalABCCompiler.CoreUtils.SourceFilesProviderDelegate SourceFilesProvider { get; set; } diff --git a/Compiler/RemoteCompiler.cs b/Compiler/RemoteCompiler.cs index d94ced6f8..039bce067 100644 --- a/Compiler/RemoteCompiler.cs +++ b/Compiler/RemoteCompiler.cs @@ -8,9 +8,7 @@ using System.IO; using System.Threading; using PascalABCCompiler.Errors; using PascalABCCompiler.TreeRealization; -using System.Runtime.Serialization.Formatters; -using System.Runtime.Serialization.Formatters.Binary; -using System.Data; +using PascalABCCompiler.CoreUtils; namespace PascalABCCompiler { diff --git a/CoreUtils/FileReader.cs b/CoreUtils/FileReader.cs new file mode 100644 index 000000000..0ecb253b7 --- /dev/null +++ b/CoreUtils/FileReader.cs @@ -0,0 +1,186 @@ +using System; +using System.IO; +using System.Text; + +namespace PascalABCCompiler.CoreUtils +{ + /// + /// Class that can open text files with auto-detection of the encoding. + /// + public static class FileReader + { + public static bool IsUnicode(Encoding encoding) + { + int codepage = encoding.CodePage; + // return true if codepage is any UTF codepage + return codepage == 65001 || codepage == 65000 || codepage == 1200 || codepage == 1201; + } + + public static string ReadFileContent(Stream fs, ref Encoding encoding) + { + using (StreamReader reader = OpenStream(fs, encoding)) + { + reader.Peek(); + encoding = reader.CurrentEncoding; + return reader.ReadToEnd(); + } + } + + public static string ReadFileContent(string fileName, Encoding encoding) + { + if (encoding == null) + encoding = System.Text.Encoding.GetEncoding(1251); + using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + { + return ReadFileContent(fs, ref encoding); + } + } + + public static StreamReader OpenStream(Stream fs, Encoding defaultEncoding) + { + if (fs == null) + throw new ArgumentNullException("fs"); + + if (fs.Length >= 2) + { + // the autodetection of StreamReader is not capable of detecting the difference + // between ISO-8859-1 and UTF-8 without BOM. + int firstByte = fs.ReadByte(); + int secondByte = fs.ReadByte(); + switch ((firstByte << 8) | secondByte) + { + case 0x0000: // either UTF-32 Big Endian or a binary file; use StreamReader + case 0xfffe: // Unicode BOM (UTF-16 LE or UTF-32 LE) + case 0xfeff: // UTF-16 BE BOM + case 0xefbb: // start of UTF-8 BOM + // StreamReader autodetection works + fs.Position = 0; + return new StreamReader(fs); + default: + return AutoDetect(fs, (byte)firstByte, (byte)secondByte, defaultEncoding); + } + } + else + { + if (defaultEncoding != null) + { + return new StreamReader(fs, defaultEncoding); + } + else + { + return new StreamReader(fs); + } + } + } + + static StreamReader AutoDetect(Stream fs, byte firstByte, byte secondByte, Encoding defaultEncoding) + { + int max = (int)Math.Min(fs.Length, 500000); // look at max. 500 KB + const int ASCII = 0; + const int Error = 1; + const int UTF8 = 2; + const int UTF8Sequence = 3; + int state = ASCII; + int sequenceLength = 0; + byte b; + for (int i = 0; i < max; i++) + { + if (i == 0) + { + b = firstByte; + } + else if (i == 1) + { + b = secondByte; + } + else + { + b = (byte)fs.ReadByte(); + } + if (b < 0x80) + { + // normal ASCII character + if (state == UTF8Sequence) + { + state = Error; + break; + } + } + else if (b < 0xc0) + { + // 10xxxxxx : continues UTF8 byte sequence + if (state == UTF8Sequence) + { + --sequenceLength; + if (sequenceLength < 0) + { + state = Error; + break; + } + else if (sequenceLength == 0) + { + state = UTF8; + } + } + else + { + state = Error; + break; + } + } + else if (b >= 0xc2 && b < 0xf5) + { + // beginning of byte sequence + if (state == UTF8 || state == ASCII) + { + state = UTF8Sequence; + if (b < 0xe0) + { + sequenceLength = 1; // one more byte following + } + else if (b < 0xf0) + { + sequenceLength = 2; // two more bytes following + } + else + { + sequenceLength = 3; // three more bytes following + } + } + else + { + state = Error; + break; + } + } + else + { + // 0xc0, 0xc1, 0xf5 to 0xff are invalid in UTF-8 (see RFC 3629) + state = Error; + break; + } + } + fs.Position = 0; + switch (state) + { + case ASCII: + case Error: + // when the file seems to be ASCII or non-UTF8, + // we read it using the user-specified encoding so it is saved again + // using that encoding. + if (IsUnicode(defaultEncoding)) + { + // the file is not Unicode, so don't read it using Unicode even if the + // user has choosen Unicode as the default encoding. + + // If we don't do this, SD will end up always adding a Byte Order Mark + // to ASCII files. + defaultEncoding = Encoding.Default; // use system encoding instead + } + return new StreamReader(fs, defaultEncoding); + default: + return new StreamReader(fs); + } + } + } +} diff --git a/CoreUtils/FormatTools.cs b/CoreUtils/FormatTools.cs new file mode 100644 index 000000000..b7876df58 --- /dev/null +++ b/CoreUtils/FormatTools.cs @@ -0,0 +1,23 @@ +namespace PascalABCCompiler.CoreUtils +{ + public static class FormatTools + { + + public static string LanguageAndExtensionsFormatted(string languageName, string[] extensions) + { + return string.Format("{0} ({1})", languageName, ExtensionsToString(extensions, "*", ";")); + } + + public static string ExtensionsToString(string[] Extensions, string Mask, string Delimer) + { + string res = ""; + for (int i = 0; i < Extensions.Length; i++) + { + res += Mask + Extensions[i]; + if (i != Extensions.Length - 1) + res += Delimer; + } + return res; + } + } +} diff --git a/CoreUtils/GeneratedNamesManager.cs b/CoreUtils/GeneratedNamesManager.cs index 9bff2e2d8..b35906761 100644 --- a/CoreUtils/GeneratedNamesManager.cs +++ b/CoreUtils/GeneratedNamesManager.cs @@ -1,4 +1,8 @@ -using System.Collections.Generic; +// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) +// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) + +// Данный проект не зависит от других проектов +using System.Collections.Generic; namespace PascalABCCompiler.CoreUtils { diff --git a/CoreUtils/Utils.csproj b/CoreUtils/PABCCoreUtils.csproj similarity index 100% rename from CoreUtils/Utils.csproj rename to CoreUtils/PABCCoreUtils.csproj diff --git a/CoreUtils/SourceFileOperations.cs b/CoreUtils/SourceFileOperations.cs new file mode 100644 index 000000000..ba71c28bd --- /dev/null +++ b/CoreUtils/SourceFileOperations.cs @@ -0,0 +1,32 @@ +using System.IO; + +namespace PascalABCCompiler.CoreUtils +{ + public enum SourceFileOperation + { + GetText, GetLastWriteTime, Exists, FileEncoding + } + public delegate object SourceFilesProviderDelegate(string FileName, SourceFileOperation FileOperation); + public static class SourceFilesProviders + { + public static object DefaultSourceFilesProvider(string FileName, SourceFileOperation FileOperation) + { + switch (FileOperation) + { + case SourceFileOperation.GetText: + if (!File.Exists(FileName)) return null; + /*TextReader tr = new StreamReader(file_name, System.Text.Encoding.GetEncoding(1251)); + //TextReader tr = new StreamReader(file_name, System.Text.Encoding.); + string Text = tr.ReadToEnd(); + tr.Close();*/ + string Text = FileReader.ReadFileContent(FileName, null); + return Text; + case SourceFileOperation.Exists: + return File.Exists(FileName); + case SourceFileOperation.GetLastWriteTime: + return File.GetLastWriteTime(FileName); + } + return null; + } + } +} diff --git a/ParserTools/FileReader.cs b/ParserTools/FileReader.cs deleted file mode 100644 index a1a7aacce..000000000 --- a/ParserTools/FileReader.cs +++ /dev/null @@ -1,154 +0,0 @@ -// -// -// -// -// $Revision: 2682 $ -// - -using System; -using System.IO; -using System.Text; - -namespace PascalABCCompiler -{ - /// - /// Class that can open text files with auto-detection of the encoding. - /// - public static class FileReader - { - public static bool IsUnicode(Encoding encoding) - { - int codepage = encoding.CodePage; - // return true if codepage is any UTF codepage - return codepage == 65001 || codepage == 65000 || codepage == 1200 || codepage == 1201; - } - - public static string ReadFileContent(Stream fs, ref Encoding encoding) - { - using (StreamReader reader = OpenStream(fs, encoding)) { - reader.Peek(); - encoding = reader.CurrentEncoding; - return reader.ReadToEnd(); - } - } - - public static string ReadFileContent(string fileName, Encoding encoding) - { - if (encoding == null) - encoding = System.Text.Encoding.GetEncoding(1251); - using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { - return ReadFileContent(fs, ref encoding); - } - } - - public static StreamReader OpenStream(Stream fs, Encoding defaultEncoding) - { - if (fs == null) - throw new ArgumentNullException("fs"); - - if (fs.Length >= 2) { - // the autodetection of StreamReader is not capable of detecting the difference - // between ISO-8859-1 and UTF-8 without BOM. - int firstByte = fs.ReadByte(); - int secondByte = fs.ReadByte(); - switch ((firstByte << 8) | secondByte) { - case 0x0000: // either UTF-32 Big Endian or a binary file; use StreamReader - case 0xfffe: // Unicode BOM (UTF-16 LE or UTF-32 LE) - case 0xfeff: // UTF-16 BE BOM - case 0xefbb: // start of UTF-8 BOM - // StreamReader autodetection works - fs.Position = 0; - return new StreamReader(fs); - default: - return AutoDetect(fs, (byte)firstByte, (byte)secondByte, defaultEncoding); - } - } else { - if (defaultEncoding != null) { - return new StreamReader(fs, defaultEncoding); - } else { - return new StreamReader(fs); - } - } - } - - static StreamReader AutoDetect(Stream fs, byte firstByte, byte secondByte, Encoding defaultEncoding) - { - int max = (int)Math.Min(fs.Length, 500000); // look at max. 500 KB - const int ASCII = 0; - const int Error = 1; - const int UTF8 = 2; - const int UTF8Sequence = 3; - int state = ASCII; - int sequenceLength = 0; - byte b; - for (int i = 0; i < max; i++) { - if (i == 0) { - b = firstByte; - } else if (i == 1) { - b = secondByte; - } else { - b = (byte)fs.ReadByte(); - } - if (b < 0x80) { - // normal ASCII character - if (state == UTF8Sequence) { - state = Error; - break; - } - } else if (b < 0xc0) { - // 10xxxxxx : continues UTF8 byte sequence - if (state == UTF8Sequence) { - --sequenceLength; - if (sequenceLength < 0) { - state = Error; - break; - } else if (sequenceLength == 0) { - state = UTF8; - } - } else { - state = Error; - break; - } - } else if (b >= 0xc2 && b < 0xf5) { - // beginning of byte sequence - if (state == UTF8 || state == ASCII) { - state = UTF8Sequence; - if (b < 0xe0) { - sequenceLength = 1; // one more byte following - } else if (b < 0xf0) { - sequenceLength = 2; // two more bytes following - } else { - sequenceLength = 3; // three more bytes following - } - } else { - state = Error; - break; - } - } else { - // 0xc0, 0xc1, 0xf5 to 0xff are invalid in UTF-8 (see RFC 3629) - state = Error; - break; - } - } - fs.Position = 0; - switch (state) { - case ASCII: - case Error: - // when the file seems to be ASCII or non-UTF8, - // we read it using the user-specified encoding so it is saved again - // using that encoding. - if (IsUnicode(defaultEncoding)) { - // the file is not Unicode, so don't read it using Unicode even if the - // user has choosen Unicode as the default encoding. - - // If we don't do this, SD will end up always adding a Byte Order Mark - // to ASCII files. - defaultEncoding = Encoding.Default; // use system encoding instead - } - return new StreamReader(fs, defaultEncoding); - default: - return new StreamReader(fs); - } - } - } -} diff --git a/ParserTools/Tools.cs b/ParserTools/Tools.cs deleted file mode 100644 index 325b63edd..000000000 --- a/ParserTools/Tools.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using System.IO; - -namespace PascalABCCompiler -{ - - public enum SourceFileOperation - { - GetText, GetLastWriteTime, Exists, FileEncoding - } - public delegate object SourceFilesProviderDelegate(string FileName, SourceFileOperation FileOperation); - public static class SourceFilesProviders - { - public static object DefaultSourceFilesProvider(string FileName, SourceFileOperation FileOperation) - { - switch (FileOperation) - { - case SourceFileOperation.GetText: - if (!File.Exists(FileName)) return null; - /*TextReader tr = new StreamReader(file_name, System.Text.Encoding.GetEncoding(1251)); - //TextReader tr = new StreamReader(file_name, System.Text.Encoding.); - string Text = tr.ReadToEnd(); - tr.Close();*/ - string Text = FileReader.ReadFileContent(FileName, null); - return Text; - case SourceFileOperation.Exists: - return File.Exists(FileName); - case SourceFileOperation.GetLastWriteTime: - return File.GetLastWriteTime(FileName); - } - return null; - } - } - - public class FormatTools - { - - public static string LanguageAndExtensionsFormatted(string languageName, string[] extensions) - { - return string.Format("{0} ({1})", languageName, ExtensionsToString(extensions, "*", ";")); - } - - public static string ExtensionsToString(string[] Extensions,string Mask,string Delimer) - { - string res = ""; - for (int i = 0; i < Extensions.Length; i++) - { - res += Mask+Extensions[i]; - if (i != Extensions.Length - 1) - res += Delimer; - } - return res; - } - public static string ObjectsToString(object[] Objects, string Delimer) - { - string res = ""; - for (int i = 0; i < Objects.Length; i++) - { - res += Objects[i].ToString(); - if (i != Objects.Length - 1) - res += Delimer; - } - return res; - } - } -} - diff --git a/Parsers/PascalABCParserNewSaushkin/PascalABCSaushkinParser.csproj b/Parsers/PascalABCParserNewSaushkin/PascalABCSaushkinParser.csproj index 38fa3be3e..023788465 100644 --- a/Parsers/PascalABCParserNewSaushkin/PascalABCSaushkinParser.csproj +++ b/Parsers/PascalABCParserNewSaushkin/PascalABCSaushkinParser.csproj @@ -14,7 +14,7 @@ - + diff --git a/PascalABCNET.sln b/PascalABCNET.sln index f6b63d5f0..6d975170d 100644 --- a/PascalABCNET.sln +++ b/PascalABCNET.sln @@ -83,7 +83,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PABCNETCclear", "pabcnetc_c EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DA0402DA-D618-47B4-8BF0-2959D16F2160}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "CoreUtils\Utils.csproj", "{CE5C55C2-A11C-4E94-A9FA-3FC6CA3E4C09}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PABCCoreUtils", "CoreUtils\PABCCoreUtils.csproj", "{CE5C55C2-A11C-4E94-A9FA-3FC6CA3E4C09}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SyntaxVisitors", "SyntaxVisitors\SyntaxVisitors.csproj", "{A9AB4282-83B4-41A7-86C3-E5BF6A45E7E2}" EndProject diff --git a/PascalABCNETLinux.sln b/PascalABCNETLinux.sln index fd300e1d3..b518f4d52 100644 --- a/PascalABCNETLinux.sln +++ b/PascalABCNETLinux.sln @@ -77,7 +77,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPythonStandardTreeConverte EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPythonParser", "AdditionalLanguages\SPython\SPythonParserKrylovMovchan\SPythonParser.csproj", "{CEEEDB1E-B0E1-283E-13C3-BFE73FE8A446}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "CoreUtils\Utils.csproj", "{EB7AFD92-6376-05DF-B47D-0BF77A4EAC43}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PABCCoreUtils", "CoreUtils\PABCCoreUtils.csproj", "{EB7AFD92-6376-05DF-B47D-0BF77A4EAC43}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/PluginsSupport/Interfaces.cs b/PluginsSupport/Interfaces.cs index 345b6a2a0..e83db293f 100644 --- a/PluginsSupport/Interfaces.cs +++ b/PluginsSupport/Interfaces.cs @@ -141,7 +141,7 @@ namespace VisualPascalABCPlugins string Compile(PascalABCCompiler.CompilerOptions CompilerOptions); void StartCompile(PascalABCCompiler.CompilerOptions CompilerOptions); - object SourceFilesProvider(string FileName, PascalABCCompiler.SourceFileOperation FileOperation); + object SourceFilesProvider(string FileName, PascalABCCompiler.CoreUtils.SourceFileOperation FileOperation); InvokeDegegate BeginInvoke { get; diff --git a/PluginsSupport/PluginsSupport.csproj b/PluginsSupport/PluginsSupport.csproj index 39028e14a..a436142b2 100644 --- a/PluginsSupport/PluginsSupport.csproj +++ b/PluginsSupport/PluginsSupport.csproj @@ -14,6 +14,7 @@ + diff --git a/PluginsSupportLinux/Interfaces.cs b/PluginsSupportLinux/Interfaces.cs index 78b1eb106..9d3875af6 100644 --- a/PluginsSupportLinux/Interfaces.cs +++ b/PluginsSupportLinux/Interfaces.cs @@ -129,7 +129,7 @@ namespace VisualPascalABCPlugins string Compile(PascalABCCompiler.CompilerOptions CompilerOptions); void StartCompile(PascalABCCompiler.CompilerOptions CompilerOptions); - object SourceFilesProvider(string FileName, PascalABCCompiler.SourceFileOperation FileOperation); + object SourceFilesProvider(string FileName, PascalABCCompiler.CoreUtils.SourceFileOperation FileOperation); InvokeDegegate BeginInvoke { get; diff --git a/PluginsSupportLinux/PluginsSupportLinux.csproj b/PluginsSupportLinux/PluginsSupportLinux.csproj index df57439d6..deefafa11 100644 --- a/PluginsSupportLinux/PluginsSupportLinux.csproj +++ b/PluginsSupportLinux/PluginsSupportLinux.csproj @@ -14,6 +14,7 @@ + diff --git a/ReleaseGenerators/PascalABCNETConsoleZIP.bat b/ReleaseGenerators/PascalABCNETConsoleZIP.bat index 4b5883cff..1c3f86cf4 100644 --- a/ReleaseGenerators/PascalABCNETConsoleZIP.bat +++ b/ReleaseGenerators/PascalABCNETConsoleZIP.bat @@ -1,6 +1,6 @@ cd ..\bin del ..\Release\PACNETConsole.zip -..\utils\pkzipc\pkzipc.exe -add ..\Release\PABCNETC.zip pabcnetc.exe pabcnetcclear.exe Compiler.dll CompilerTools.dll Errors.dll Localization.dll NETGenerator.dll ParserTools.dll ICSharpCode.NRefactory.dll SemanticTree.dll SyntaxTree.dll TreeConverter.dll OptimizerConversion.dll PascalABCParser.dll PascalABCLanguageInfo.dll licence.txt PascalABCNET.chm System.Threading.dll SyntaxTreeConverters.dll Utils.dll SyntaxVisitors.dll LambdaAnySynToSemConverter.dll LanguageIntegrator.dll StringConstants.dll +..\utils\pkzipc\pkzipc.exe -add ..\Release\PABCNETC.zip pabcnetc.exe pabcnetcclear.exe Compiler.dll CompilerTools.dll Errors.dll Localization.dll NETGenerator.dll ParserTools.dll ICSharpCode.NRefactory.dll SemanticTree.dll SyntaxTree.dll TreeConverter.dll OptimizerConversion.dll PascalABCParser.dll PascalABCLanguageInfo.dll licence.txt PascalABCNET.chm System.Threading.dll SyntaxTreeConverters.dll PABCCoreUtils.dll SyntaxVisitors.dll LambdaAnySynToSemConverter.dll LanguageIntegrator.dll StringConstants.dll ..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PABCNETC.zip Lib\*.pcu ..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PABCNETC.zip Lib\SPython\*.pcu ..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PABCNETC.zip Lng\*.dat diff --git a/ReleaseGenerators/sect_Core.nsh b/ReleaseGenerators/sect_Core.nsh index 6e897bf72..36bb13974 100644 --- a/ReleaseGenerators/sect_Core.nsh +++ b/ReleaseGenerators/sect_Core.nsh @@ -14,7 +14,7 @@ File "..\bin\SyntaxTree.dll" File "..\bin\SyntaxTreeConverters.dll" File "..\bin\SyntaxVisitors.dll" - File "..\bin\Utils.dll" + File "..\bin\PABCCoreUtils.dll" File "..\bin\ICSharpCode.NRefactory.dll" File "..\bin\TreeConverter.dll" File "..\bin\OptimizerConversion.dll" @@ -81,7 +81,7 @@ ${AddFile} "SemanticTree.dll" ${AddFile} "SyntaxTree.dll" ${AddFile} "SyntaxTreeConverters.dll" - ${AddFile} "Utils.dll" + ${AddFile} "PABCCoreUtils.dll" ${AddFile} "SyntaxVisitors.dll" ${AddFile} "ICSharpCode.NRefactory.dll" ${AddFile} "TreeConverter.dll" diff --git a/SyntaxVisitors/SyntaxVisitors.csproj b/SyntaxVisitors/SyntaxVisitors.csproj index 0a0470b23..b2fae4020 100644 --- a/SyntaxVisitors/SyntaxVisitors.csproj +++ b/SyntaxVisitors/SyntaxVisitors.csproj @@ -13,7 +13,7 @@ - + \ No newline at end of file diff --git a/TreeConverter/TreeConverter.csproj b/TreeConverter/TreeConverter.csproj index 461858cfc..92b1ed2a6 100644 --- a/TreeConverter/TreeConverter.csproj +++ b/TreeConverter/TreeConverter.csproj @@ -22,6 +22,6 @@ - + \ No newline at end of file diff --git a/TreeConverter/TreeRealization/Collections.cs b/TreeConverter/TreeRealization/Collections.cs index 1830fb04c..5487cacf0 100644 --- a/TreeConverter/TreeRealization/Collections.cs +++ b/TreeConverter/TreeRealization/Collections.cs @@ -1,116 +1,116 @@ -// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using System; -using System.Collections.Generic; +// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) +// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) +using System; +using System.Collections.Generic; using PascalABCCompiler.Collections; -namespace PascalABCCompiler.TreeRealization -{ - /// - /// Класс, представляющий список выражений. Используется для представления фактических параметров функции. - /// - [Serializable] - public class expressions_list : extended_collection - { - public override string ToString() => string.Join(", ", this._elements); +namespace PascalABCCompiler.TreeRealization +{ + /// + /// Класс, представляющий список выражений. Используется для представления фактических параметров функции. + /// + [Serializable] + public class expressions_list : extended_collection + { + public override string ToString() => string.Join(", ", this._elements); public expressions_list Clone() { var exprl = new expressions_list(); foreach (var elem in this) exprl.AddElement(elem); return exprl; - } - } - - [Serializable] - public class attributes_list : extended_collection - { - } - - /// - /// Список типов, определенных в программе. - /// - [Serializable] - public class common_type_node_list : extended_collection - { - } - - //ssyy добавил - /// - /// Список шаблонных классов, определенных в программе. - /// - [Serializable] - public class template_class_list : extended_collection - { - } - //\ssyy - - /// - /// Список runtime типов, определенных в программе. - /// - [Serializable] - public class compiled_type_node_list : extended_collection - { - } - - /// - /// Список переменных, определенных в пространстве имен. - /// - [Serializable] - public class namespace_variable_list : extendable_collection - { - } - - [Serializable] - public class namespace_event_list : extendable_collection - { - } - - /// - /// Список функций, определенных в пространстве имен. - /// - [Serializable] - public class common_namespace_function_node_list : extended_collection - { - } - - /// - /// Список вложенных пространств имен. - /// - [Serializable] - public class common_namespace_node_list : extendable_collection - { - } - - /// - /// Список вложенных в пространство имен констант. - /// - [Serializable] - public class namespace_constant_definition_list : extendable_collection - { - } - - /// - /// Список вложенных в класс. - /// - [Serializable] - public class class_constant_definition_list : extendable_collection - { - } - - /// - /// Список констант, вложенных в класс. - /// - [Serializable] - public class function_constant_definition_list : extendable_collection - { - } - - /// - /// Список модулей. - /// - [Serializable] - public class unit_node_list : extended_collection + } + } + + [Serializable] + public class attributes_list : extended_collection + { + } + + /// + /// Список типов, определенных в программе. + /// + [Serializable] + public class common_type_node_list : extended_collection + { + } + + //ssyy добавил + /// + /// Список шаблонных классов, определенных в программе. + /// + [Serializable] + public class template_class_list : extended_collection + { + } + //\ssyy + + /// + /// Список runtime типов, определенных в программе. + /// + [Serializable] + public class compiled_type_node_list : extended_collection + { + } + + /// + /// Список переменных, определенных в пространстве имен. + /// + [Serializable] + public class namespace_variable_list : extendable_collection + { + } + + [Serializable] + public class namespace_event_list : extendable_collection + { + } + + /// + /// Список функций, определенных в пространстве имен. + /// + [Serializable] + public class common_namespace_function_node_list : extended_collection + { + } + + /// + /// Список вложенных пространств имен. + /// + [Serializable] + public class common_namespace_node_list : extendable_collection + { + } + + /// + /// Список вложенных в пространство имен констант. + /// + [Serializable] + public class namespace_constant_definition_list : extendable_collection + { + } + + /// + /// Список вложенных в класс. + /// + [Serializable] + public class class_constant_definition_list : extendable_collection + { + } + + /// + /// Список констант, вложенных в класс. + /// + [Serializable] + public class function_constant_definition_list : extendable_collection + { + } + + /// + /// Список модулей. + /// + [Serializable] + public class unit_node_list : extended_collection { public Dictionary unit_uses_paths = new Dictionary(); @@ -133,171 +133,171 @@ namespace PascalABCCompiler.TreeRealization return true; } - } - - /// - /// Список параметров. - /// - [Serializable] - public class parameter_list : extended_collection - { - } - - /// - /// Список выражений. - /// - [Serializable] - public class statement_node_list : extendable_collection - { - public new statement_node this[int num] - { - get - { - return _elements[num]; - } + } + + /// + /// Список параметров. + /// + [Serializable] + public class parameter_list : extended_collection + { + } + + /// + /// Список выражений. + /// + [Serializable] + public class statement_node_list : extendable_collection + { + public new statement_node this[int num] + { + get + { + return _elements[num]; + } set { _elements[num] = value; - } - } - } - - /// - /// Список методов. - /// - [Serializable] - public class common_method_node_list : extended_collection - { - } - - /// - /// Список полей класса. - /// - [Serializable] - public class class_field_list : extendable_collection - { - } - - /// - /// Список свойств класса. - /// - [Serializable] - public class common_property_node_list : extendable_collection - { - } - - - [Serializable] - public class common_event_list : extendable_collection - { - - } - - /// - /// Список локальных переменных. - /// - [Serializable] - public class local_variable_list : extendable_collection - { - } - - /// - /// Список функций, определенных в функции. - /// - [Serializable] - public class common_in_function_function_node_list : extended_collection - { - } - - [Serializable] - public class statement_node_stack : stack - { - } - - [Serializable] - public class possible_type_convertions_list : extended_collection - { - private statement_node_list _snl; - private expression_node _var_ref; - - public statement_node_list snl - { - get - { - return _snl; - } - set - { - _snl = value; - } - } - - public expression_node var_ref - { - get - { - return _var_ref; - } - set - { - _var_ref = value; - } - } - - } - - [Serializable] - public class possible_type_convertions_list_list : extended_collection - { - } - - [Serializable] - public class function_node_list : extended_collection - { - } - - [Serializable] - public class using_namespace_list : extended_collection - { - } - - [Serializable] - public class type_node_list : extended_collection - { - } - - [Serializable] - public class common_unit_node_list : extended_collection - { - } - - [Serializable] - public class constant_node_list : extendable_collection - { - } - - [Serializable] - public class case_range_node_list : extendable_collection - { - } - - [Serializable] - public class case_variant_node_list : extendable_collection - { - } - - [Serializable] - public class int_const_node_list : extendable_collection - { - } - - [Serializable] - public class base_function_call_list : extended_collection - { - } - - [Serializable] - public class exception_filters_list : extended_collection - { - } -} + } + } + } + + /// + /// Список методов. + /// + [Serializable] + public class common_method_node_list : extended_collection + { + } + + /// + /// Список полей класса. + /// + [Serializable] + public class class_field_list : extendable_collection + { + } + + /// + /// Список свойств класса. + /// + [Serializable] + public class common_property_node_list : extendable_collection + { + } + + + [Serializable] + public class common_event_list : extendable_collection + { + + } + + /// + /// Список локальных переменных. + /// + [Serializable] + public class local_variable_list : extendable_collection + { + } + + /// + /// Список функций, определенных в функции. + /// + [Serializable] + public class common_in_function_function_node_list : extended_collection + { + } + + [Serializable] + public class statement_node_stack : stack + { + } + + [Serializable] + public class possible_type_convertions_list : extended_collection + { + private statement_node_list _snl; + private expression_node _var_ref; + + public statement_node_list snl + { + get + { + return _snl; + } + set + { + _snl = value; + } + } + + public expression_node var_ref + { + get + { + return _var_ref; + } + set + { + _var_ref = value; + } + } + + } + + [Serializable] + public class possible_type_convertions_list_list : extended_collection + { + } + + [Serializable] + public class function_node_list : extended_collection + { + } + + [Serializable] + public class using_namespace_list : extended_collection + { + } + + [Serializable] + public class type_node_list : extended_collection + { + } + + [Serializable] + public class common_unit_node_list : extended_collection + { + } + + [Serializable] + public class constant_node_list : extendable_collection + { + } + + [Serializable] + public class case_range_node_list : extendable_collection + { + } + + [Serializable] + public class case_variant_node_list : extendable_collection + { + } + + [Serializable] + public class int_const_node_list : extendable_collection + { + } + + [Serializable] + public class base_function_call_list : extended_collection + { + } + + [Serializable] + public class exception_filters_list : extended_collection + { + } +} diff --git a/VisualPascalABCNET/DS/SymbolsViwer.cs b/VisualPascalABCNET/DS/SymbolsViwer.cs index 0c20fa13f..40e1ab81b 100644 --- a/VisualPascalABCNET/DS/SymbolsViwer.cs +++ b/VisualPascalABCNET/DS/SymbolsViwer.cs @@ -1,12 +1,10 @@ // Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using System; using System.Collections.Generic; -using System.Text; using System.Windows.Forms; -using VisualPascalABC; using PascalABCCompiler; -using System.Text.RegularExpressions; +using PascalABCCompiler.CoreUtils; + namespace VisualPascalABC { public class SymbolsViewerSymbol @@ -40,10 +38,10 @@ namespace VisualPascalABC ImageList imageList; public bool showInThread; VisualPascalABCPlugins.InvokeDegegate beginInvoke; - PascalABCCompiler.SourceFilesProviderDelegate sourceFilesProvider; + SourceFilesProviderDelegate sourceFilesProvider; VisualEnvironmentCompiler.ExecuteSourceLocationActionDelegate ExecuteSourceLocationAction; public SymbolsViwer(ListView listView, ImageList imageList, bool showInThread, VisualPascalABCPlugins.InvokeDegegate beginInvoke, - PascalABCCompiler.SourceFilesProviderDelegate sourceFilesProvider, VisualEnvironmentCompiler.ExecuteSourceLocationActionDelegate ExecuteSourceLocationAction) + SourceFilesProviderDelegate sourceFilesProvider, VisualEnvironmentCompiler.ExecuteSourceLocationActionDelegate ExecuteSourceLocationAction) { this.listView = listView; this.imageList = imageList; @@ -96,7 +94,7 @@ namespace VisualPascalABC List ListViewItems = new List(); foreach (SymbolsViewerSymbol sym in symbolList) { - string text = (string)sourceFilesProvider(sym.SourceLocation.FileName, PascalABCCompiler.SourceFileOperation.GetText); + string text = (string)sourceFilesProvider(sym.SourceLocation.FileName, SourceFileOperation.GetText); if (text == null) continue; string txt = string.Format(OutputFormat, sym.SourceLocation.FileName, sym.SourceLocation.BeginPosition.Line, sym.SourceLocation.BeginPosition.Column, GetTextLineFromNumber(sym.SourceLocation.BeginPosition.Line - 1, text)); diff --git a/VisualPascalABCNET/DS/Tools.cs b/VisualPascalABCNET/DS/Tools.cs index 18ec5210e..df224fee4 100644 --- a/VisualPascalABCNET/DS/Tools.cs +++ b/VisualPascalABCNET/DS/Tools.cs @@ -56,7 +56,7 @@ namespace VisualPascalABC public static string MakeFilter(string Filter, string Name, string[] Extensions) { - string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";"); + string sf = PascalABCCompiler.CoreUtils.FormatTools.ExtensionsToString(Extensions, "*", ";"); sf = string.Format(VECStringResources.Get("DIALOGS_FILTER_PART_{0}{1}|{1}|"), Name, sf); if (sf.IndexOf(StringConstants.pascalSourceFileExtension) >= 0) return sf + Filter; @@ -67,7 +67,7 @@ namespace VisualPascalABC public static string MakeProjectFilter(string Filter, string Name, string[] Extensions) { - string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";"); + string sf = PascalABCCompiler.CoreUtils.FormatTools.ExtensionsToString(Extensions, "*", ";"); sf = string.Format(VECStringResources.Get("DIALOGS_PROJECT_FILTER_PART_{0}{1}|{1}|"), Name, sf); if (sf.IndexOf(StringConstants.platformProjectExtension) >= 0) return sf + Filter; @@ -78,7 +78,7 @@ namespace VisualPascalABC public static string MakeAllFilter(string AllFilter, string Name, string[] Extensions) { - string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";"); + string sf = PascalABCCompiler.CoreUtils.FormatTools.ExtensionsToString(Extensions, "*", ";"); sf += ";"; if (sf.IndexOf(".pas;") >= 0) return sf + AllFilter; diff --git a/VisualPascalABCNET/DS/VisualEnvironmentCompiler.cs b/VisualPascalABCNET/DS/VisualEnvironmentCompiler.cs index 825b23112..3102df5c7 100644 --- a/VisualPascalABCNET/DS/VisualEnvironmentCompiler.cs +++ b/VisualPascalABCNET/DS/VisualEnvironmentCompiler.cs @@ -9,6 +9,7 @@ using VisualPascalABCPlugins; using System.Threading; using Languages.Integration; using Languages.Facade; +using PascalABCCompiler.CoreUtils; namespace VisualPascalABC { @@ -239,7 +240,7 @@ namespace VisualPascalABC } - public object SourceFilesProvider(string FileName, PascalABCCompiler.SourceFileOperation FileOperation) + public object SourceFilesProvider(string FileName, SourceFileOperation FileOperation) { @@ -251,7 +252,7 @@ namespace VisualPascalABC switch (FileOperation) { - case PascalABCCompiler.SourceFileOperation.GetText: + case SourceFileOperation.GetText: if (tp != null) { string Text1 = ed.Document.TextContent; @@ -265,19 +266,19 @@ namespace VisualPascalABC /*TextReader tr = new StreamReader(file_name, System.Text.Encoding.GetEncoding(1251)); string Text = tr.ReadToEnd(); tr.Close();*/ - string Text = PascalABCCompiler.FileReader.ReadFileContent(FileName, null); + string Text = FileReader.ReadFileContent(FileName, null); if (ConvertUnitTextProperty != null) Text = ConvertUnitTextProperty(FileName, Text); return Text; - case PascalABCCompiler.SourceFileOperation.Exists: + case SourceFileOperation.Exists: if (tp != null) return true; return File.Exists(FileName); - case PascalABCCompiler.SourceFileOperation.GetLastWriteTime: + case SourceFileOperation.GetLastWriteTime: if (tp != null) return tp.ModifyDateTime; return File.GetLastWriteTime(FileName); - case PascalABCCompiler.SourceFileOperation.FileEncoding: + case SourceFileOperation.FileEncoding: return DefaultFileEncoding; } return null; @@ -396,7 +397,7 @@ namespace VisualPascalABC AddCompilerTextToCompilerMessages(sender, VECStringResources.Get("SUPPORTED_LANGUAGES") + Environment.NewLine); foreach (ILanguage lang in LanguageProvider.Instance.Languages) AddCompilerTextToCompilerMessages(sender, string.Format(VECStringResources.Get("CM_LANGUAGE_{0}"), - PascalABCCompiler.FormatTools.LanguageAndExtensionsFormatted(lang.Name, lang.FilesExtensions) + Environment.NewLine)); + PascalABCCompiler.CoreUtils.FormatTools.LanguageAndExtensionsFormatted(lang.Name, lang.FilesExtensions) + Environment.NewLine)); if (StartingCompleted) { ChangeVisualEnvironmentState(VisualEnvironmentState.FinishCompilerLoading, standartCompiler); diff --git a/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionActions.cs b/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionActions.cs index 669eac58d..4da957a1f 100644 --- a/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionActions.cs +++ b/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionActions.cs @@ -10,6 +10,7 @@ using ICSharpCode.TextEditor.Document; using ICSharpCode.TextEditor.Gui.CompletionWindow; using PascalABCCompiler; using PascalABCCompiler.Parsers; +using PascalABCCompiler.CoreUtils; namespace VisualPascalABC { @@ -64,7 +65,7 @@ namespace VisualPascalABC ccp = new CodeCompletionProvider(); IDocument doc = null; CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController(); - string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(FileName, SourceFileOperation.GetText) as string; PascalABCCompiler.SyntaxTree.compilation_unit cu = controller.ParseOnlySyntaxTree(FileName, text); if (cu == null) return; @@ -211,7 +212,7 @@ namespace VisualPascalABC List poses = GetDefinitionPosition(textArea, true); if (poses == null || poses.Count == 0) return false; foreach (Position pos in poses) - if (pos.from_metadata || pos.file_name != null && (bool)WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(pos.file_name, PascalABCCompiler.SourceFileOperation.Exists)) + if (pos.from_metadata || pos.file_name != null && (bool)WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(pos.file_name, SourceFileOperation.Exists)) return true; return false; //string file_name = GetDefinitionPosition(textArea).file_name; @@ -224,7 +225,7 @@ namespace VisualPascalABC List poses = GetRealizationPosition(textArea); if (poses == null || poses.Count == 0) return false; foreach (Position pos in poses) - if (pos.file_name != null && (bool)WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(pos.file_name, PascalABCCompiler.SourceFileOperation.Exists)) + if (pos.file_name != null && (bool)WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(pos.file_name, SourceFileOperation.Exists)) return true; return false; // string file_name = GetRealizationPosition(textArea).file_name; @@ -693,7 +694,7 @@ namespace VisualPascalABC //PascalABCCompiler.SyntaxTree.syntax_tree_node sn = // MainForm.VisualEnvironmentCompiler.Compiler.ParsersController.Compile( // file_name, TextEditor.Text, null, Errors, PascalABCCompiler.Parsers.ParseMode.Normal); - string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName, SourceFileOperation.GetText) as string; PascalABCCompiler.SyntaxTree.compilation_unit cu = CodeCompletion.CodeCompletionController.CurrentLanguage.Parser.GetCompilationUnitForFormatter( diff --git a/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionParserController.cs b/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionParserController.cs index 50983776b..bc18190da 100644 --- a/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionParserController.cs +++ b/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionParserController.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; +using PascalABCCompiler.CoreUtils; namespace VisualPascalABC { @@ -151,7 +152,7 @@ namespace VisualPascalABC { is_comp = true; CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController(); - string text = visualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = visualEnvironmentCompiler.SourceFilesProvider(FileName, SourceFileOperation.GetText) as string; if (string.IsNullOrEmpty(text)) text = "begin end."; CodeCompletion.DomConverter tmp = CodeCompletion.CodeCompletionController.comp_modules[FileName] as CodeCompletion.DomConverter; @@ -208,7 +209,7 @@ namespace VisualPascalABC { is_comp = true; CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController(); - string text = visualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = visualEnvironmentCompiler.SourceFilesProvider(FileName, SourceFileOperation.GetText) as string; CodeCompletion.DomConverter tmp = CodeCompletion.CodeCompletionController.comp_modules[FileName] as CodeCompletion.DomConverter; long cur_mem = Environment.WorkingSet; dc = controller.Compile(FileName, text); diff --git a/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionProvider.cs b/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionProvider.cs index 2e480b86a..1fe73fd2a 100644 --- a/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionProvider.cs +++ b/VisualPascalABCNET/IB/CodeCompletion/CodeCompletionProvider.cs @@ -259,7 +259,7 @@ namespace VisualPascalABC foreach (string FileName in CodeCompletionParserController.filesToParse.Keys) { CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController(); - string text = VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.CoreUtils.SourceFileOperation.GetText) as string; PascalABCCompiler.SyntaxTree.compilation_unit cu = controller.ParseOnlySyntaxTree(FileName, text); if (cu != null) { diff --git a/VisualPascalABCNET/Projects/ProjectHelper.cs b/VisualPascalABCNET/Projects/ProjectHelper.cs index 3ab1b6c12..f539f197c 100644 --- a/VisualPascalABCNET/Projects/ProjectHelper.cs +++ b/VisualPascalABCNET/Projects/ProjectHelper.cs @@ -1,14 +1,9 @@ // Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; using System.IO; -using System.Text; using PascalABCCompiler; -using PascalABCCompiler.TreeConverter; +using PascalABCCompiler.CoreUtils; namespace VisualPascalABC { @@ -163,7 +158,7 @@ namespace VisualPascalABC public void AddNamespaceFileReference(string fileName) { - var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, PascalABCCompiler.SourceFileOperation.GetText) as string; + var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, SourceFileOperation.GetText) as string; text = "{$includenamespace " + Path.GetFileName(fileName) + "}"+Environment.NewLine + text; var doc = WorkbenchServiceFactory.DocumentService.GetDocument(currentProject.main_file); if (doc != null) @@ -178,13 +173,13 @@ namespace VisualPascalABC public bool hasNamespaceFileReference(string fileName) { - var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, PascalABCCompiler.SourceFileOperation.GetText) as string; + var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, SourceFileOperation.GetText) as string; return text.IndexOf("{$includenamespace " + Path.GetFileName(fileName) + "}") != -1; } public void RemoveNamespaceFileReference(string fileName) { - var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, PascalABCCompiler.SourceFileOperation.GetText) as string; + var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, SourceFileOperation.GetText) as string; text = text.Replace("{$includenamespace " + Path.GetFileName(fileName) + "}" + Environment.NewLine, ""); var doc = WorkbenchServiceFactory.DocumentService.GetDocument(currentProject.main_file); if (doc != null) diff --git a/VisualPascalABCNET/VisualPascalABCNET.csproj b/VisualPascalABCNET/VisualPascalABCNET.csproj index 9e3189523..dded0e999 100644 --- a/VisualPascalABCNET/VisualPascalABCNET.csproj +++ b/VisualPascalABCNET/VisualPascalABCNET.csproj @@ -686,6 +686,7 @@ + diff --git a/VisualPascalABCNET/Workbench/RunnerManagerHandlers.cs b/VisualPascalABCNET/Workbench/RunnerManagerHandlers.cs index 51a2f3336..c93cc90d7 100644 --- a/VisualPascalABCNET/Workbench/RunnerManagerHandlers.cs +++ b/VisualPascalABCNET/Workbench/RunnerManagerHandlers.cs @@ -123,7 +123,7 @@ namespace VisualPascalABC if (Workbench.UserOptions.SkipStakTraceItemIfSourceFileInSystemDirectory && StackTraceItem.SourceFileName.StartsWith(WorkbenchServiceFactory.BuildService.CompilerOptions.SystemDirectory)) continue; - if (!(bool)Workbench.VisualEnvironmentCompiler.SourceFilesProvider(StackTraceItem.SourceFileName, PascalABCCompiler.SourceFileOperation.Exists)) + if (!(bool)Workbench.VisualEnvironmentCompiler.SourceFilesProvider(StackTraceItem.SourceFileName, PascalABCCompiler.CoreUtils.SourceFileOperation.Exists)) { string fn = Path.Combine(WorkbenchStorage.LibSourceDirectory, Path.GetFileName(StackTraceItem.SourceFileName)); if (File.Exists(fn)) diff --git a/VisualPascalABCNETLinux/DS/SymbolsViwer.cs b/VisualPascalABCNETLinux/DS/SymbolsViwer.cs index 0c20fa13f..40e1ab81b 100644 --- a/VisualPascalABCNETLinux/DS/SymbolsViwer.cs +++ b/VisualPascalABCNETLinux/DS/SymbolsViwer.cs @@ -1,12 +1,10 @@ // Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using System; using System.Collections.Generic; -using System.Text; using System.Windows.Forms; -using VisualPascalABC; using PascalABCCompiler; -using System.Text.RegularExpressions; +using PascalABCCompiler.CoreUtils; + namespace VisualPascalABC { public class SymbolsViewerSymbol @@ -40,10 +38,10 @@ namespace VisualPascalABC ImageList imageList; public bool showInThread; VisualPascalABCPlugins.InvokeDegegate beginInvoke; - PascalABCCompiler.SourceFilesProviderDelegate sourceFilesProvider; + SourceFilesProviderDelegate sourceFilesProvider; VisualEnvironmentCompiler.ExecuteSourceLocationActionDelegate ExecuteSourceLocationAction; public SymbolsViwer(ListView listView, ImageList imageList, bool showInThread, VisualPascalABCPlugins.InvokeDegegate beginInvoke, - PascalABCCompiler.SourceFilesProviderDelegate sourceFilesProvider, VisualEnvironmentCompiler.ExecuteSourceLocationActionDelegate ExecuteSourceLocationAction) + SourceFilesProviderDelegate sourceFilesProvider, VisualEnvironmentCompiler.ExecuteSourceLocationActionDelegate ExecuteSourceLocationAction) { this.listView = listView; this.imageList = imageList; @@ -96,7 +94,7 @@ namespace VisualPascalABC List ListViewItems = new List(); foreach (SymbolsViewerSymbol sym in symbolList) { - string text = (string)sourceFilesProvider(sym.SourceLocation.FileName, PascalABCCompiler.SourceFileOperation.GetText); + string text = (string)sourceFilesProvider(sym.SourceLocation.FileName, SourceFileOperation.GetText); if (text == null) continue; string txt = string.Format(OutputFormat, sym.SourceLocation.FileName, sym.SourceLocation.BeginPosition.Line, sym.SourceLocation.BeginPosition.Column, GetTextLineFromNumber(sym.SourceLocation.BeginPosition.Line - 1, text)); diff --git a/VisualPascalABCNETLinux/DS/Tools.cs b/VisualPascalABCNETLinux/DS/Tools.cs index 5cd310eea..678722567 100644 --- a/VisualPascalABCNETLinux/DS/Tools.cs +++ b/VisualPascalABCNETLinux/DS/Tools.cs @@ -57,7 +57,7 @@ namespace VisualPascalABC public static string MakeFilter(string Filter, string Name, string[] Extensions) { - string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";"); + string sf = PascalABCCompiler.CoreUtils.FormatTools.ExtensionsToString(Extensions, "*", ";"); sf = string.Format(VECStringResources.Get("DIALOGS_FILTER_PART_{0}{1}|{1}|"), Name, sf); if (sf.IndexOf(".pas") >= 0) return sf + Filter; @@ -68,7 +68,7 @@ namespace VisualPascalABC public static string MakeProjectFilter(string Filter, string Name, string[] Extensions) { - string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";"); + string sf = PascalABCCompiler.CoreUtils.FormatTools.ExtensionsToString(Extensions, "*", ";"); sf = string.Format(VECStringResources.Get("DIALOGS_PROJECT_FILTER_PART_{0}{1}|{1}|"), Name, sf); if (sf.IndexOf(PascalABCCompiler.StringConstants.platformProjectExtension) >= 0) return sf + Filter; @@ -79,7 +79,7 @@ namespace VisualPascalABC public static string MakeAllFilter(string AllFilter, string Name, string[] Extensions) { - string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";"); + string sf = PascalABCCompiler.CoreUtils.FormatTools.ExtensionsToString(Extensions, "*", ";"); sf += ";"; if (sf.IndexOf(".pas;") >= 0) return sf + AllFilter; diff --git a/VisualPascalABCNETLinux/DS/VisualEnvironmentCompiler.cs b/VisualPascalABCNETLinux/DS/VisualEnvironmentCompiler.cs index ee2921ab3..1c005d35f 100644 --- a/VisualPascalABCNETLinux/DS/VisualEnvironmentCompiler.cs +++ b/VisualPascalABCNETLinux/DS/VisualEnvironmentCompiler.cs @@ -8,8 +8,7 @@ using System.IO; using System.Text; using System.Windows.Forms; using VisualPascalABCPlugins; -using Languages.Integration; -using Languages.Facade; +using PascalABCCompiler.CoreUtils; namespace VisualPascalABC { @@ -239,7 +238,7 @@ namespace VisualPascalABC } - public object SourceFilesProvider(string FileName, PascalABCCompiler.SourceFileOperation FileOperation) + public object SourceFilesProvider(string FileName, SourceFileOperation FileOperation) { @@ -251,22 +250,22 @@ namespace VisualPascalABC switch (FileOperation) { - case PascalABCCompiler.SourceFileOperation.GetText: + case SourceFileOperation.GetText: if (tp != null) return ed.Document.TextContent; if (!File.Exists(FileName)) return null; - string Text = PascalABCCompiler.FileReader.ReadFileContent(FileName, null); + string Text = FileReader.ReadFileContent(FileName, null); return Text; - case PascalABCCompiler.SourceFileOperation.Exists: + case SourceFileOperation.Exists: if (tp != null) return true; return File.Exists(FileName); - case PascalABCCompiler.SourceFileOperation.GetLastWriteTime: + case SourceFileOperation.GetLastWriteTime: if (tp != null) return tp.ModifyDateTime; return File.GetLastWriteTime(FileName); - case PascalABCCompiler.SourceFileOperation.FileEncoding: + case SourceFileOperation.FileEncoding: return DefaultFileEncoding; } return null; @@ -385,7 +384,7 @@ namespace VisualPascalABC AddCompilerTextToCompilerMessages(sender, VECStringResources.Get("SUPPORTED_LANGUAGES") + Environment.NewLine); foreach (ILanguage lang in LanguageProvider.Instance.Languages) AddCompilerTextToCompilerMessages(sender, string.Format(VECStringResources.Get("CM_LANGUAGE_{0}"), - PascalABCCompiler.FormatTools.LanguageAndExtensionsFormatted(lang.Name, lang.FilesExtensions) + Environment.NewLine)); + PascalABCCompiler.CoreUtils.FormatTools.LanguageAndExtensionsFormatted(lang.Name, lang.FilesExtensions) + Environment.NewLine)); if (StartingCompleted) { ChangeVisualEnvironmentState(VisualEnvironmentState.FinishCompilerLoading, standartCompiler); diff --git a/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionActions.cs b/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionActions.cs index 31e501e3e..3ca2f8fe2 100644 --- a/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionActions.cs +++ b/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionActions.cs @@ -10,6 +10,7 @@ using ICSharpCode.TextEditor.Document; using ICSharpCode.TextEditor.Gui.CompletionWindow; using PascalABCCompiler; using PascalABCCompiler.Parsers; +using PascalABCCompiler.CoreUtils; namespace VisualPascalABC { @@ -64,7 +65,7 @@ namespace VisualPascalABC ccp = new CodeCompletionProvider(); IDocument doc = null; CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController(); - string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(FileName, SourceFileOperation.GetText) as string; PascalABCCompiler.SyntaxTree.compilation_unit cu = controller.ParseOnlySyntaxTree(FileName, text); if (cu == null) return; @@ -210,7 +211,7 @@ namespace VisualPascalABC List poses = GetDefinitionPosition(textArea, true); if (poses == null || poses.Count == 0) return false; foreach (Position pos in poses) - if (pos.from_metadata || pos.file_name != null && (bool)WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(pos.file_name, PascalABCCompiler.SourceFileOperation.Exists)) + if (pos.from_metadata || pos.file_name != null && (bool)WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(pos.file_name, SourceFileOperation.Exists)) return true; return false; //string file_name = GetDefinitionPosition(textArea).file_name; @@ -223,7 +224,7 @@ namespace VisualPascalABC List poses = GetRealizationPosition(textArea); if (poses == null || poses.Count == 0) return false; foreach (Position pos in poses) - if (pos.file_name != null && (bool)WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(pos.file_name, PascalABCCompiler.SourceFileOperation.Exists)) + if (pos.file_name != null && (bool)WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(pos.file_name, SourceFileOperation.Exists)) return true; return false; // string file_name = GetRealizationPosition(textArea).file_name; @@ -611,7 +612,7 @@ namespace VisualPascalABC //PascalABCCompiler.SyntaxTree.syntax_tree_node sn = // MainForm.VisualEnvironmentCompiler.Compiler.ParsersController.Compile( // file_name, TextEditor.Text, null, Errors, PascalABCCompiler.Parsers.ParseMode.Normal); - string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName, SourceFileOperation.GetText) as string; PascalABCCompiler.SyntaxTree.compilation_unit cu = CodeCompletion.CodeCompletionController.CurrentLanguage.Parser.GetCompilationUnitForFormatter( diff --git a/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionParserController.cs b/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionParserController.cs index 70e5db106..d2961ebe1 100644 --- a/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionParserController.cs +++ b/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionParserController.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; +using PascalABCCompiler.CoreUtils; namespace VisualPascalABC { @@ -156,7 +157,7 @@ namespace VisualPascalABC { is_comp = true; CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController(); - string text = visualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = visualEnvironmentCompiler.SourceFilesProvider(FileName, SourceFileOperation.GetText) as string; if (string.IsNullOrEmpty(text)) text = "begin end."; CodeCompletion.DomConverter tmp = CodeCompletion.CodeCompletionController.comp_modules[FileName] as CodeCompletion.DomConverter; @@ -213,7 +214,7 @@ namespace VisualPascalABC { is_comp = true; CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController(); - string text = visualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = visualEnvironmentCompiler.SourceFilesProvider(FileName, SourceFileOperation.GetText) as string; CodeCompletion.DomConverter tmp = CodeCompletion.CodeCompletionController.comp_modules[FileName] as CodeCompletion.DomConverter; long cur_mem = Environment.WorkingSet; dc = controller.Compile(FileName, text); diff --git a/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionProvider.cs b/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionProvider.cs index fa06c7722..873b85a3a 100644 --- a/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionProvider.cs +++ b/VisualPascalABCNETLinux/IB/CodeCompletion/CodeCompletionProvider.cs @@ -260,7 +260,7 @@ namespace VisualPascalABC foreach (string FileName in CodeCompletionParserController.filesToParse.Keys) { CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController(); - string text = VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText) as string; + string text = VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.CoreUtils.SourceFileOperation.GetText) as string; PascalABCCompiler.SyntaxTree.compilation_unit cu = controller.ParseOnlySyntaxTree(FileName, text); if (cu != null) { diff --git a/VisualPascalABCNETLinux/Projects/ProjectHelper.cs b/VisualPascalABCNETLinux/Projects/ProjectHelper.cs index 65a565af9..62355527a 100644 --- a/VisualPascalABCNETLinux/Projects/ProjectHelper.cs +++ b/VisualPascalABCNETLinux/Projects/ProjectHelper.cs @@ -1,13 +1,9 @@ // Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; using System.IO; -using System.Text; -using PascalABCCompiler; + +using PascalABCCompiler.CoreUtils; namespace VisualPascalABC { @@ -162,7 +158,7 @@ namespace VisualPascalABC public void AddNamespaceFileReference(string fileName) { - var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, PascalABCCompiler.SourceFileOperation.GetText) as string; + var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, SourceFileOperation.GetText) as string; text = "{$includenamespace " + Path.GetFileName(fileName) + "}"+Environment.NewLine + text; var doc = WorkbenchServiceFactory.DocumentService.GetDocument(currentProject.main_file); if (doc != null) @@ -177,13 +173,13 @@ namespace VisualPascalABC public bool hasNamespaceFileReference(string fileName) { - var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, PascalABCCompiler.SourceFileOperation.GetText) as string; + var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, SourceFileOperation.GetText) as string; return text.IndexOf("{$includenamespace " + Path.GetFileName(fileName) + "}") != -1; } public void RemoveNamespaceFileReference(string fileName) { - var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, PascalABCCompiler.SourceFileOperation.GetText) as string; + var text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(currentProject.main_file, SourceFileOperation.GetText) as string; text = text.Replace("{$includenamespace " + Path.GetFileName(fileName) + "}" + Environment.NewLine, ""); var doc = WorkbenchServiceFactory.DocumentService.GetDocument(currentProject.main_file); if (doc != null) diff --git a/VisualPascalABCNETLinux/VisualPascalABCNETLinux.csproj b/VisualPascalABCNETLinux/VisualPascalABCNETLinux.csproj index a58e1ef2b..acbc578da 100644 --- a/VisualPascalABCNETLinux/VisualPascalABCNETLinux.csproj +++ b/VisualPascalABCNETLinux/VisualPascalABCNETLinux.csproj @@ -810,6 +810,7 @@ false + diff --git a/VisualPascalABCNETLinux/Workbench/RunnerManagerHandlers.cs b/VisualPascalABCNETLinux/Workbench/RunnerManagerHandlers.cs index 72b160c38..d66118ea7 100644 --- a/VisualPascalABCNETLinux/Workbench/RunnerManagerHandlers.cs +++ b/VisualPascalABCNETLinux/Workbench/RunnerManagerHandlers.cs @@ -123,7 +123,7 @@ namespace VisualPascalABC if (Workbench.UserOptions.SkipStakTraceItemIfSourceFileInSystemDirectory && StackTraceItem.SourceFileName.StartsWith(WorkbenchServiceFactory.BuildService.CompilerOptions.SystemDirectory)) continue; - if (!(bool)Workbench.VisualEnvironmentCompiler.SourceFilesProvider(StackTraceItem.SourceFileName, PascalABCCompiler.SourceFileOperation.Exists)) + if (!(bool)Workbench.VisualEnvironmentCompiler.SourceFilesProvider(StackTraceItem.SourceFileName, PascalABCCompiler.CoreUtils.SourceFileOperation.Exists)) { string fn = Path.Combine(WorkbenchStorage.LibSourceDirectory, Path.GetFileName(StackTraceItem.SourceFileName)); if (File.Exists(fn)) diff --git a/VisualPlugins/SyntaxTreeVisualisator/SyntaxTreeVisualisator.csproj b/VisualPlugins/SyntaxTreeVisualisator/SyntaxTreeVisualisator.csproj index 9e0f9d2b2..6d2f3a414 100644 --- a/VisualPlugins/SyntaxTreeVisualisator/SyntaxTreeVisualisator.csproj +++ b/VisualPlugins/SyntaxTreeVisualisator/SyntaxTreeVisualisator.csproj @@ -16,6 +16,7 @@ + diff --git a/VisualPlugins/SyntaxTreeVisualisator/SyntaxTreeVisualisatorForm.cs b/VisualPlugins/SyntaxTreeVisualisator/SyntaxTreeVisualisatorForm.cs index 7be8d7199..a51cdb004 100644 --- a/VisualPlugins/SyntaxTreeVisualisator/SyntaxTreeVisualisatorForm.cs +++ b/VisualPlugins/SyntaxTreeVisualisator/SyntaxTreeVisualisatorForm.cs @@ -4,6 +4,7 @@ using System.Windows.Forms; using PascalABCCompiler.Errors; using System.IO; using Languages.Facade; +using PascalABCCompiler.CoreUtils; namespace VisualPascalABCPlugins { @@ -200,7 +201,7 @@ namespace VisualPascalABCPlugins private void tsParse_Click(object sender, EventArgs e) { string FileName = (string)VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.GetCurrentSourceFileName, null); - string FileText = (string)VisualEnvironmentCompiler.Compiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText); + string FileText = (string)VisualEnvironmentCompiler.Compiler.SourceFilesProvider(FileName, SourceFileOperation.GetText); List Errors=new List(); List Warnings = new List(); //PascalABCCompiler.SyntaxTree.syntax_tree_node sn = VisualEnvironmentCompiler.Compiler.ParsersController.Compile(file_name, FileText, Errors, PascalABCCompiler.ParserTools.ParseMode.Expression); @@ -235,14 +236,14 @@ namespace VisualPascalABCPlugins PascalABCCompiler.SyntaxTree.syntax_tree_node ParseCurrent(List Errors) { string FileName = (string)VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.GetCurrentSourceFileName, null); - string FileText = (string)VisualEnvironmentCompiler.StandartCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText); + string FileText = (string)VisualEnvironmentCompiler.StandartCompiler.SourceFilesProvider(FileName, SourceFileOperation.GetText); return LanguageProvider.Instance.SelectLanguageByExtensionSafe(FileName)?.Parser.GetCompilationUnit(FileName, FileText, Errors, new List(), PascalABCCompiler.Parsers.ParseMode.Normal, false); } PascalABCCompiler.SyntaxTree.documentation_comment_list ParseCurrentDocs() { string FileName = (string)VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.GetCurrentSourceFileName, null); - string FileText = (string)VisualEnvironmentCompiler.StandartCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText); + string FileText = (string)VisualEnvironmentCompiler.StandartCompiler.SourceFilesProvider(FileName, SourceFileOperation.GetText); return LanguageProvider.Instance.SelectLanguageByExtensionSafe(FileName)?.DocParser.BuildTree(FileText); } diff --git a/_GenerateLinuxVersion.bat b/_GenerateLinuxVersion.bat index 79ef47fe7..2e19ad11c 100644 --- a/_GenerateLinuxVersion.bat +++ b/_GenerateLinuxVersion.bat @@ -66,7 +66,7 @@ copy bin\template.pct Release\PascalABCNETLinux\template.pct copy bin\TreeConverter.dll Release\PascalABCNETLinux\TreeConverter.dll copy bin\WeifenLuo.WinFormsUI.Docking.ThemeVS2005Linux.dll Release\PascalABCNETLinux\WeifenLuo.WinFormsUI.Docking.ThemeVS2005Linux.dll copy bin\WeifenLuo.WinFormsUI.DockingLinux.dll Release\PascalABCNETLinux\WeifenLuo.WinFormsUI.DockingLinux.dll -copy bin\Utils.dll Release\PascalABCNETLinux\Utils.dll +copy bin\PABCCoreUtils.dll Release\PascalABCNETLinux\PABCCoreUtils.dll copy bin\LambdaAnySynToSemConverter.dll Release\PascalABCNETLinux\LambdaAnySynToSemConverter.dll copy bin\TeacherControlPlugin.dll Release\PascalABCNETLinux\TeacherControlPlugin.dll copy bin\Highlighting\PascalABCNET.xshd Release\PascalABCNETLinux\Highlighting\PascalABCNET.xshd diff --git a/pabcnetc.sln b/pabcnetc.sln index a92b2ced4..f10a98a06 100644 --- a/pabcnetc.sln +++ b/pabcnetc.sln @@ -67,7 +67,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPythonLanguageInfo", "Addi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPythonParser", "AdditionalLanguages\SPython\SPythonParserKrylovMovchan\SPythonParser.csproj", "{CEEEDB1E-B0E1-283E-13C3-BFE73FE8A446}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "CoreUtils\Utils.csproj", "{EB7AFD92-6376-05DF-B47D-0BF77A4EAC43}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PABCCoreUtils", "CoreUtils\PABCCoreUtils.csproj", "{EB7AFD92-6376-05DF-B47D-0BF77A4EAC43}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/pabcnetc/CommandConsoleCompiler.cs b/pabcnetc/CommandConsoleCompiler.cs index bba362783..567872105 100644 --- a/pabcnetc/CommandConsoleCompiler.cs +++ b/pabcnetc/CommandConsoleCompiler.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Text; using System.IO; using System.Runtime.Serialization.Formatters.Binary; +using PascalABCCompiler.CoreUtils; namespace PascalABCCompiler { @@ -70,7 +71,7 @@ namespace PascalABCCompiler /*TextReader tr = new StreamReader(file_name, System.Text.Encoding.GetEncoding(1251)); text = tr.ReadToEnd(); tr.Close();*/ - text = PascalABCCompiler.FileReader.ReadFileContent(FileName, null); + text = FileReader.ReadFileContent(FileName, null); return text; case SourceFileOperation.Exists: if (SourceFiles.ContainsKey(fn)) diff --git a/pabcnetc/ConsoleCompiler.cs b/pabcnetc/ConsoleCompiler.cs index 49ee0572f..3ab06bbeb 100644 --- a/pabcnetc/ConsoleCompiler.cs +++ b/pabcnetc/ConsoleCompiler.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Linq; using System.Globalization; using Languages.Facade; +using PascalABCCompiler.CoreUtils; namespace PascalABCCompiler { diff --git a/pabcnetc/PABCNETC.csproj b/pabcnetc/PABCNETC.csproj index a0a67f215..b5c159862 100644 --- a/pabcnetc/PABCNETC.csproj +++ b/pabcnetc/PABCNETC.csproj @@ -23,6 +23,7 @@ + diff --git a/pabcnetc_clear/CommandConsoleCompiler.cs b/pabcnetc_clear/CommandConsoleCompiler.cs index a637978aa..1592d54ec 100644 --- a/pabcnetc_clear/CommandConsoleCompiler.cs +++ b/pabcnetc_clear/CommandConsoleCompiler.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Text; using System.IO; using System.Runtime.Serialization.Formatters.Binary; +using PascalABCCompiler.CoreUtils; namespace PascalABCCompiler { @@ -69,7 +70,7 @@ namespace PascalABCCompiler /*TextReader tr = new StreamReader(file_name, System.Text.Encoding.GetEncoding(1251)); text = tr.ReadToEnd(); tr.Close();*/ - text = PascalABCCompiler.FileReader.ReadFileContent(FileName, null); + text = FileReader.ReadFileContent(FileName, null); return text; case SourceFileOperation.Exists: if (SourceFiles.ContainsKey(fn)) diff --git a/pabcnetc_clear/PABCNETCclear.csproj b/pabcnetc_clear/PABCNETCclear.csproj index 554257f2d..0de280e20 100644 --- a/pabcnetc_clear/PABCNETCclear.csproj +++ b/pabcnetc_clear/PABCNETCclear.csproj @@ -23,6 +23,7 @@ + \ No newline at end of file