Настройка проекта PABCCoreUtils (#3406)
* Rename Utils project to PABCCoreUtils * Move FormatTools from ParserTools project to PABCCoreUtils * Move SourceFilesProviders class and FileReader class to PABCCoreUtils
This commit is contained in:
parent
d588671441
commit
aa2b09dd3b
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -65,7 +65,7 @@
|
|||
**/TestPlugin.dll
|
||||
**/TreeConverter.dll
|
||||
**/VBNETParser.dll
|
||||
**/Utils.dll
|
||||
**/PABCCoreUtils.dll
|
||||
**/pabcnetc.exe
|
||||
**/pabcnetc.exe.config
|
||||
**/pabcnetcclear.exe
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\CoreUtils\Utils.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\Errors\Errors.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\LanguageIntegrator\LanguageIntegrator.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\Localization\Localization.csproj" />
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="..\Errors\Errors.csproj" />
|
||||
<ProjectReference Include="..\LanguageIntegrator\LanguageIntegrator.csproj" />
|
||||
<ProjectReference Include="..\Localization\Localization.csproj" />
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
186
CoreUtils/FileReader.cs
Normal file
186
CoreUtils/FileReader.cs
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace PascalABCCompiler.CoreUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that can open text files with auto-detection of the encoding.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
CoreUtils/FormatTools.cs
Normal file
23
CoreUtils/FormatTools.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
32
CoreUtils/SourceFileOperations.cs
Normal file
32
CoreUtils/SourceFileOperations.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||
// <version>$Revision: 2682 $</version>
|
||||
// </file>
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace PascalABCCompiler
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that can open text files with auto-detection of the encoding.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\CoreUtils\Utils.csproj" />
|
||||
<ProjectReference Include="..\..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="..\..\Errors\Errors.csproj" />
|
||||
<ProjectReference Include="..\..\LanguageIntegrator\LanguageIntegrator.csproj" />
|
||||
<ProjectReference Include="..\..\Localization\Localization.csproj" />
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\CompilerTools\CompilerTools.csproj" />
|
||||
<ProjectReference Include="..\Compiler\Compiler.csproj" />
|
||||
<ProjectReference Include="..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="..\Errors\Errors.csproj" />
|
||||
<ProjectReference Include="..\ParserTools\ParserTools.csproj" />
|
||||
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj" />
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\CompilerTools\CompilerTools.csproj" />
|
||||
<ProjectReference Include="..\Compiler\Compiler.csproj" />
|
||||
<ProjectReference Include="..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="..\Errors\Errors.csproj" />
|
||||
<ProjectReference Include="..\ICSharpCode.TextEditorLinux\ICSharpCode.TextEditorLinux.csproj" />
|
||||
<ProjectReference Include="..\ParserTools\ParserTools.csproj" />
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<ProjectReference Include="..\Errors\Errors.csproj" />
|
||||
<ProjectReference Include="..\Localization\Localization.csproj" />
|
||||
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj" />
|
||||
<ProjectReference Include="..\CoreUtils\Utils.csproj" />
|
||||
<ProjectReference Include="..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="..\ParserTools\ParserTools.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -22,6 +22,6 @@
|
|||
<ProjectReference Include="..\SemanticTree\SemanticTree.csproj" />
|
||||
<ProjectReference Include="..\StringConstants\StringConstants.csproj" />
|
||||
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj" />
|
||||
<ProjectReference Include="..\CoreUtils\Utils.csproj" />
|
||||
<ProjectReference Include="..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, представляющий список выражений. Используется для представления фактических параметров функции.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class expressions_list : extended_collection<expression_node>
|
||||
{
|
||||
public override string ToString() => string.Join(", ", this._elements);
|
||||
namespace PascalABCCompiler.TreeRealization
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, представляющий список выражений. Используется для представления фактических параметров функции.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class expressions_list : extended_collection<expression_node>
|
||||
{
|
||||
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<attribute_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список типов, определенных в программе.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_type_node_list : extended_collection<common_type_node>
|
||||
{
|
||||
}
|
||||
|
||||
//ssyy добавил
|
||||
/// <summary>
|
||||
/// Список шаблонных классов, определенных в программе.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class template_class_list : extended_collection<template_class>
|
||||
{
|
||||
}
|
||||
//\ssyy
|
||||
|
||||
/// <summary>
|
||||
/// Список runtime типов, определенных в программе.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class compiled_type_node_list : extended_collection<compiled_type_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список переменных, определенных в пространстве имен.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class namespace_variable_list : extendable_collection<namespace_variable>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class namespace_event_list : extendable_collection<common_namespace_event>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список функций, определенных в пространстве имен.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_namespace_function_node_list : extended_collection<common_namespace_function_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список вложенных пространств имен.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_namespace_node_list : extendable_collection<common_namespace_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список вложенных в пространство имен констант.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class namespace_constant_definition_list : extendable_collection<namespace_constant_definition>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список вложенных в класс.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class class_constant_definition_list : extendable_collection<class_constant_definition>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список констант, вложенных в класс.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class function_constant_definition_list : extendable_collection<function_constant_definition>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список модулей.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class unit_node_list : extended_collection<unit_node>
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class attributes_list : extended_collection<attribute_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список типов, определенных в программе.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_type_node_list : extended_collection<common_type_node>
|
||||
{
|
||||
}
|
||||
|
||||
//ssyy добавил
|
||||
/// <summary>
|
||||
/// Список шаблонных классов, определенных в программе.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class template_class_list : extended_collection<template_class>
|
||||
{
|
||||
}
|
||||
//\ssyy
|
||||
|
||||
/// <summary>
|
||||
/// Список runtime типов, определенных в программе.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class compiled_type_node_list : extended_collection<compiled_type_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список переменных, определенных в пространстве имен.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class namespace_variable_list : extendable_collection<namespace_variable>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class namespace_event_list : extendable_collection<common_namespace_event>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список функций, определенных в пространстве имен.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_namespace_function_node_list : extended_collection<common_namespace_function_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список вложенных пространств имен.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_namespace_node_list : extendable_collection<common_namespace_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список вложенных в пространство имен констант.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class namespace_constant_definition_list : extendable_collection<namespace_constant_definition>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список вложенных в класс.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class class_constant_definition_list : extendable_collection<class_constant_definition>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список констант, вложенных в класс.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class function_constant_definition_list : extendable_collection<function_constant_definition>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список модулей.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class unit_node_list : extended_collection<unit_node>
|
||||
{
|
||||
public Dictionary<unit_node, string> unit_uses_paths = new Dictionary<unit_node, string>();
|
||||
|
||||
|
|
@ -133,171 +133,171 @@ namespace PascalABCCompiler.TreeRealization
|
|||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список параметров.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class parameter_list : extended_collection<parameter>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список выражений.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class statement_node_list : extendable_collection<statement_node>
|
||||
{
|
||||
public new statement_node this[int num]
|
||||
{
|
||||
get
|
||||
{
|
||||
return _elements[num];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список параметров.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class parameter_list : extended_collection<parameter>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список выражений.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class statement_node_list : extendable_collection<statement_node>
|
||||
{
|
||||
public new statement_node this[int num]
|
||||
{
|
||||
get
|
||||
{
|
||||
return _elements[num];
|
||||
}
|
||||
set
|
||||
{
|
||||
_elements[num] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список методов.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_method_node_list : extended_collection<common_method_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список полей класса.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class class_field_list : extendable_collection<class_field>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список свойств класса.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_property_node_list : extendable_collection<common_property_node>
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class common_event_list : extendable_collection<common_event>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список локальных переменных.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class local_variable_list : extendable_collection<local_variable>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список функций, определенных в функции.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_in_function_function_node_list : extended_collection<common_in_function_function_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class statement_node_stack : stack<statement_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class possible_type_convertions_list : extended_collection<possible_type_convertions>
|
||||
{
|
||||
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<possible_type_convertions_list>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class function_node_list : extended_collection<function_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class using_namespace_list : extended_collection<using_namespace>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class type_node_list : extended_collection<type_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class common_unit_node_list : extended_collection<common_unit_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class constant_node_list : extendable_collection<constant_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class case_range_node_list : extendable_collection<case_range_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class case_variant_node_list : extendable_collection<case_variant_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class int_const_node_list : extendable_collection<int_const_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class base_function_call_list : extended_collection<base_function_call>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class exception_filters_list : extended_collection<exception_filter>
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список методов.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_method_node_list : extended_collection<common_method_node>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список полей класса.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class class_field_list : extendable_collection<class_field>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список свойств класса.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_property_node_list : extendable_collection<common_property_node>
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class common_event_list : extendable_collection<common_event>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список локальных переменных.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class local_variable_list : extendable_collection<local_variable>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Список функций, определенных в функции.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class common_in_function_function_node_list : extended_collection<common_in_function_function_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class statement_node_stack : stack<statement_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class possible_type_convertions_list : extended_collection<possible_type_convertions>
|
||||
{
|
||||
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<possible_type_convertions_list>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class function_node_list : extended_collection<function_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class using_namespace_list : extended_collection<using_namespace>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class type_node_list : extended_collection<type_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class common_unit_node_list : extended_collection<common_unit_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class constant_node_list : extendable_collection<constant_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class case_range_node_list : extendable_collection<case_range_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class case_variant_node_list : extendable_collection<case_variant_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class int_const_node_list : extendable_collection<int_const_node>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class base_function_call_list : extended_collection<base_function_call>
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class exception_filters_list : extended_collection<exception_filter>
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<ListViewItem> ListViewItems = new List<ListViewItem>();
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<Position> 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<Position> 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(
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -686,6 +686,7 @@
|
|||
<ProjectReference Include="../SyntaxTree/SyntaxTree.csproj" />
|
||||
<ProjectReference Include="../TreeConverter/TreeConverter.csproj" />
|
||||
<ProjectReference Include="../SyntaxVisitors/SyntaxVisitors.csproj" />
|
||||
<ProjectReference Include="..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="FormsDesignerBinding/Dependecies/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj" />
|
||||
<ProjectReference Include="FormsDesignerBinding/Dependecies/src/Main/Core/Project/ICSharpCode.Core.csproj" />
|
||||
<ProjectReference Include="FormsDesignerBinding/Dependecies/src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj" />
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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<ListViewItem> ListViewItems = new List<ListViewItem>();
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<Position> 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<Position> 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(
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -810,6 +810,7 @@
|
|||
<ProjectReference Include="../pabcnetc/PABCNETC.csproj">
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\CompilerTools\CompilerTools.csproj" />
|
||||
<ProjectReference Include="..\..\Compiler\Compiler.csproj" />
|
||||
<ProjectReference Include="..\..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="..\..\Errors\Errors.csproj" />
|
||||
<ProjectReference Include="..\..\LanguageIntegrator\LanguageIntegrator.csproj" />
|
||||
<ProjectReference Include="..\..\Localization\Localization.csproj" />
|
||||
|
|
|
|||
|
|
@ -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<Error> Errors=new List<Error>();
|
||||
List<CompilerWarning> Warnings = new List<CompilerWarning>();
|
||||
//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<Error> 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<CompilerWarning>(), 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using Languages.Facade;
|
||||
using PascalABCCompiler.CoreUtils;
|
||||
|
||||
namespace PascalABCCompiler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="..\Localization\Localization.csproj" />
|
||||
<ProjectReference Include="..\Compiler\Compiler.csproj" />
|
||||
<ProjectReference Include="..\CompilerTools\CompilerTools.csproj" />
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Compiler\Compiler.csproj" />
|
||||
<ProjectReference Include="..\CoreUtils\PABCCoreUtils.csproj" />
|
||||
<ProjectReference Include="..\LanguageIntegrator\LanguageIntegrator.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Reference in a new issue