pascalabcnet/VisualPascalABCNET/DS/VisualEnvironmentCompiler.cs

574 lines
28 KiB
C#
Raw Normal View History

// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
2015-06-02 23:06:57 +03:00
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
2015-05-14 22:35:07 +03:00
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
using VisualPascalABCPlugins;
using System.Threading;
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
using Languages.Integration;
using Languages.Facade;
2015-05-14 22:35:07 +03:00
namespace VisualPascalABC
{
public class VECStringResources
{
public static string Get(string key)
{
return PascalABCCompiler.StringResources.Get("VP_VEC_"+key);
}
}
public class VisualEnvironmentCompiler: IVisualEnvironmentCompiler
{
PascalABCCompiler.CompilerType defaultCompilerType = PascalABCCompiler.CompilerType.Remote;
2017-11-26 19:35:27 +03:00
public static Encoding DefaultFileEncoding = Encoding.UTF8;
2015-05-14 22:35:07 +03:00
private IWorkbench workbench;
private PascalABCCompiler.RemoteCompiler remoteCompiler;
private PascalABCCompiler.Compiler standartCompiler;
private System.Threading.Thread MainProgramThread = System.Threading.Thread.CurrentThread;
private System.Threading.Thread StartingThread;
public delegate void SetFlagDelegate(bool flag);
Деактивация кнопок, связанных с Intellisense, для языков без Intellisense + разделение ILanguageInformation на два интерфейса (#3378) * Refactor language information classes * Implement SimpleLanguageInformation abstract class * Move some properties to SimpleLanguageInformation * Implement format and debug buttons disabling if Intellisense is not supported for current language * Add Intellisense available check in FormsExtensions to deactivate menu items if needed * Change function interfaces in VisibilityService * Replace CodeCompletionController.CurrentParser null checks with IntellisenseAvailable method call * Refactor IParser and BaseParser to deduplicate code * Fix BuildTreeInSpecialMode in SPythonParser * Add SimpleParser class for new languages without Intellisense * Delete duplicate SetDebugButtonsEnabled function * Add Intellisense available check in RunService when attaching debugger * Delete inner check in SetDebugButtonsEnabled to improve architecture * Change CurrentParser property in CodeCompletion to be CurrentLanguage * Divide ILanguageInformation into two interfaces (creating new ILanguageIntellisenseSupport) * Fix LanguageIntellisenseSupport initialization in BaseLanguage * Fix RunService fictive_attach logic * Disable Intellisense parsing for languages without Intellisense support * Add DefaultLanguageInformation abstract class * Add default implementation for SetSemanticConstants in BaseLanguage * Simplify IParser interface * Update developer guide documentation
2026-01-27 22:25:28 +03:00
private SetFlagDelegate SetCompilingAndRunButtonsEnabled;
2015-05-14 22:35:07 +03:00
private SetFlagDelegate SetDebugButtonsEnabled;
public ConvertTextDelegate ConvertUnitTextProperty { get; set; }
2015-05-14 22:35:07 +03:00
public delegate void SetTextDelegate(string text);
private SetTextDelegate SetStateText;
private SetTextDelegate AddTextToCompilerMessages;
private bool Compilation = false;
public VisualPascalABCPlugins.PluginsController PluginsController;
private ToolStripMenuItem PluginsMenuItem;
private ToolStrip PluginsToolStrip;
public bool compilerLoaded=false;
InvokeDegegate beginInvoke;
public InvokeDegegate BeginInvoke
{
get
{
return beginInvoke;
}
}
public delegate void ExecuteSourceLocationActionDelegate(PascalABCCompiler.SourceLocation SourceLocation, SourceLocationAction Action);
private ExecuteSourceLocationActionDelegate ExecuteSLAction;
public delegate object ExecuteVisualEnvironmentCompilerActionDelegate(VisualEnvironmentCompilerAction Action, object obj);
private ExecuteVisualEnvironmentCompilerActionDelegate ExecuteVECAction;
private bool StartingCompleted = false;
public PascalABCCompiler.Errors.ErrorsStrategyManager ErrorsManager;
private RunManager RunnerManager;
private DebugHelper DebugHelper;
private CodeCompletionParserController CodeCompletionParserController;
public UserOptions UserOptions;
private Dictionary<string, string> StandartDirectories;
2015-05-14 22:35:07 +03:00
Dictionary<string, CodeFileDocumentControl> OpenDocuments;
public VisualEnvironmentCompiler(InvokeDegegate beginInvoke,
Деактивация кнопок, связанных с Intellisense, для языков без Intellisense + разделение ILanguageInformation на два интерфейса (#3378) * Refactor language information classes * Implement SimpleLanguageInformation abstract class * Move some properties to SimpleLanguageInformation * Implement format and debug buttons disabling if Intellisense is not supported for current language * Add Intellisense available check in FormsExtensions to deactivate menu items if needed * Change function interfaces in VisibilityService * Replace CodeCompletionController.CurrentParser null checks with IntellisenseAvailable method call * Refactor IParser and BaseParser to deduplicate code * Fix BuildTreeInSpecialMode in SPythonParser * Add SimpleParser class for new languages without Intellisense * Delete duplicate SetDebugButtonsEnabled function * Add Intellisense available check in RunService when attaching debugger * Delete inner check in SetDebugButtonsEnabled to improve architecture * Change CurrentParser property in CodeCompletion to be CurrentLanguage * Divide ILanguageInformation into two interfaces (creating new ILanguageIntellisenseSupport) * Fix LanguageIntellisenseSupport initialization in BaseLanguage * Fix RunService fictive_attach logic * Disable Intellisense parsing for languages without Intellisense support * Add DefaultLanguageInformation abstract class * Add default implementation for SetSemanticConstants in BaseLanguage * Simplify IParser interface * Update developer guide documentation
2026-01-27 22:25:28 +03:00
SetFlagDelegate setCompilingAndRunButtonsEnabled, SetFlagDelegate setCompilingDebugEnabled, SetTextDelegate setStateText,
2015-05-14 22:35:07 +03:00
SetTextDelegate addTextToCompilerMessages, ToolStripMenuItem pluginsMenuItem,
ToolStrip pluginsToolStrip, ExecuteSourceLocationActionDelegate ExecuteSLAction,
ExecuteVisualEnvironmentCompilerActionDelegate ExecuteVECAction,
PascalABCCompiler.Errors.ErrorsStrategyManager ErrorsManager, RunManager RunnerManager, DebugHelper DebugHelper,UserOptions UserOptions, Dictionary<string, string> StandartDirectories,
2015-05-14 22:35:07 +03:00
Dictionary<string, CodeFileDocumentControl> OpenDocuments, IWorkbench workbench)
{
this.StandartDirectories = StandartDirectories;
this.ErrorsManager = ErrorsManager;
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
this.ChangeVisualEnvironmentState += onChangeVisualEnvironmentState;
Деактивация кнопок, связанных с Intellisense, для языков без Intellisense + разделение ILanguageInformation на два интерфейса (#3378) * Refactor language information classes * Implement SimpleLanguageInformation abstract class * Move some properties to SimpleLanguageInformation * Implement format and debug buttons disabling if Intellisense is not supported for current language * Add Intellisense available check in FormsExtensions to deactivate menu items if needed * Change function interfaces in VisibilityService * Replace CodeCompletionController.CurrentParser null checks with IntellisenseAvailable method call * Refactor IParser and BaseParser to deduplicate code * Fix BuildTreeInSpecialMode in SPythonParser * Add SimpleParser class for new languages without Intellisense * Delete duplicate SetDebugButtonsEnabled function * Add Intellisense available check in RunService when attaching debugger * Delete inner check in SetDebugButtonsEnabled to improve architecture * Change CurrentParser property in CodeCompletion to be CurrentLanguage * Divide ILanguageInformation into two interfaces (creating new ILanguageIntellisenseSupport) * Fix LanguageIntellisenseSupport initialization in BaseLanguage * Fix RunService fictive_attach logic * Disable Intellisense parsing for languages without Intellisense support * Add DefaultLanguageInformation abstract class * Add default implementation for SetSemanticConstants in BaseLanguage * Simplify IParser interface * Update developer guide documentation
2026-01-27 22:25:28 +03:00
SetCompilingAndRunButtonsEnabled = setCompilingAndRunButtonsEnabled;
2015-05-14 22:35:07 +03:00
SetDebugButtonsEnabled = setCompilingDebugEnabled;
SetStateText = setStateText;
AddTextToCompilerMessages = addTextToCompilerMessages;
this.beginInvoke = beginInvoke;
this.ExecuteSLAction=ExecuteSLAction;
this.ExecuteVECAction = ExecuteVECAction;
PluginsMenuItem = pluginsMenuItem;
PluginsToolStrip = pluginsToolStrip;
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
PluginsController = new PluginsController(this, PluginsMenuItem, PluginsToolStrip, workbench);
2015-05-14 22:35:07 +03:00
this.RunnerManager = RunnerManager;
this.DebugHelper = DebugHelper;
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
DebugHelper.Starting += DebugHelper_Starting;
DebugHelper.Exited += DebugHelper_Exited;
RunnerManager.Starting += RunnerManager_Starting;
RunnerManager.Exited += RunnerManager_Exited;
2015-05-14 22:35:07 +03:00
this.CodeCompletionParserController = WorkbenchServiceFactory.CodeCompletionParserController;
this.CodeCompletionParserController.visualEnvironmentCompiler = this;
this.UserOptions = UserOptions;
this.OpenDocuments = OpenDocuments;
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
LanguageIntegrator.LanguageLoaded += OnLanguageLoaded;
LanguageIntegrator.LanguageLoadErrorOccured += OnLanguageLoadErrorOccured;
2015-05-14 22:35:07 +03:00
}
void RunnerManager_Exited(string fileName)
{
ChangeVisualEnvironmentState(VisualEnvironmentState.ProcessExited, fileName);
}
void RunnerManager_Starting(string fileName)
{
ChangeVisualEnvironmentState(VisualEnvironmentState.ProcessStarting, fileName);
}
void DebugHelper_Exited(string FileName)
{
ChangeVisualEnvironmentState(VisualEnvironmentState.ProcessExited, FileName);
}
void DebugHelper_Starting(string FileName)
{
ChangeVisualEnvironmentState(VisualEnvironmentState.ProcessStartingDebug, FileName);
}
public bool Starting()
{
return StartingThread.ThreadState == System.Threading.ThreadState.Running;
}
public bool Started
{
get { return StartingThread.ThreadState != System.Threading.ThreadState.Running; }
}
public void AbortStaring()
{
//для того чтобы отмена прошла быстрее увеличиваем приоритет потока
2015-05-14 22:35:07 +03:00
StartingThread.Priority = System.Threading.ThreadPriority.AboveNormal;
//даем команду на завершение и ждем завершения
2015-05-14 22:35:07 +03:00
StartingThread.Join();
}
private void CreateCompiler()
{
standartCompiler = new PascalABCCompiler.Compiler(SourceFilesProvider, OnChangeCompilerState);
CodeCompletion.CodeCompletionController.comp = new PascalABCCompiler.Compiler((PascalABCCompiler.Compiler)standartCompiler, SourceFilesProvider, OnChangeCompilerState);
2019-06-20 13:00:39 +03:00
if (ProjectFactory.Instance.CurrentProject != null)
{
CodeCompletion.CodeCompletionController.comp.CompilerOptions.CurrentProject = ProjectFactory.Instance.CurrentProject;
ProjectFactory.Instance.Dirty = true;
}
2015-05-14 22:35:07 +03:00
CodeCompletion.CodeCompletionController.StandartDirectories = StandartDirectories;
this.CodeCompletionParserController.Init();
if (defaultCompilerType == PascalABCCompiler.CompilerType.Remote && !Tools.IsUnix())
LoadRemoteCompiler();
else
defaultCompilerType = PascalABCCompiler.CompilerType.Standart;
}
public void LoadRemoteCompiler()
{
remoteCompiler = new PascalABCCompiler.RemoteCompiler(PascalABCCompiler.ConsoleCompilerConstants.MaxProcessMemoryMB, OnChangeCompilerState, SourceFilesProvider);
}
public void RunStartingThread()
{
StartingThread = new System.Threading.Thread(new System.Threading.ThreadStart(CreateCompiler));
StartingThread.Priority = System.Threading.ThreadPriority.BelowNormal;
ChangeVisualEnvironmentState(VisualEnvironmentState.StartCompilerLoading, StartingThread);
StartingThread.Start();
}
public string GetFilterForDialogs()
{
if (standartCompiler == null)
return null;
string Filter = "", AllFilter = "";
foreach (ILanguage lang in LanguageProvider.Instance.Languages)
2015-05-14 22:35:07 +03:00
{
Filter = Tools.MakeFilter(Filter, lang.Name, lang.FilesExtensions);
AllFilter = Tools.MakeAllFilter(AllFilter, lang.Name, lang.FilesExtensions);
2015-05-14 22:35:07 +03:00
}
Filter += "Программы на C# (*.cs)|*.cs|";
2015-05-14 22:35:07 +03:00
AllFilter += "*.cs;";
return Tools.FinishMakeFilter(Filter, AllFilter);
}
public string GetProjectFilterForDialogs()
{
if (standartCompiler == null)
2015-05-14 22:35:07 +03:00
return null;
string Filter = "", AllFilter = "";
foreach (ILanguage lang in LanguageProvider.Instance.Languages)
2015-05-14 22:35:07 +03:00
{
Filter = Tools.MakeProjectFilter(Filter, lang.Name,
new string[1] { PascalABCCompiler.StringConstants.platformProjectExtension });
2015-05-14 22:35:07 +03:00
}
AllFilter = Tools.MakeAllFilter(AllFilter, PascalABCCompiler.StringConstants.pascalLanguageName,
new string[1] { PascalABCCompiler.StringConstants.platformProjectExtension });
2015-05-14 22:35:07 +03:00
return Tools.FinishMakeFilter(Filter, AllFilter);
}
public string GetAssemblyFilterForDialogs()
{
if (standartCompiler == null)
return null;
string Filter = "";
string AllFilter = "";
Filter = Tools.MakeFilter(Filter, VECStringResources.Get("ASSEMBLIES"), new string[1]{".dll"});
AllFilter = Tools.MakeAllFilter(AllFilter, VECStringResources.Get("ASSEMBLIES"), new string[1]{".dll"});
return Tools.FinishMakeFilter(Filter, AllFilter);
}
private bool CurrentThreadIsMainThread()
{
return MainProgramThread == System.Threading.Thread.CurrentThread;
}
DateTime compilationStartTime;
public string Compile(PascalABCCompiler.CompilerOptions CompilerOptions)
{
compilationStartTime = DateTime.Now;
Compiler.CompilerOptions = CompilerOptions;
string fn=Compiler.Compile();
return fn;
}
public void StartCompile(PascalABCCompiler.CompilerOptions CompilerOptions)
{
compilationStartTime = DateTime.Now;
Compiler.CompilerOptions = CompilerOptions;
Compiler.StartCompile();
}
void onChangeVisualEnvironmentState(VisualEnvironmentState State, object obj)
{
}
public object SourceFilesProvider(string FileName, PascalABCCompiler.SourceFileOperation FileOperation)
{
CodeFileDocumentControl tp = null;
ICSharpCode.TextEditor.TextEditorControl ed = null;
if (OpenDocuments.TryGetValue(Tools.FileNameToLower(FileName), out tp))
ed = tp.TextEditor;
switch (FileOperation)
{
case PascalABCCompiler.SourceFileOperation.GetText:
if (tp != null)
{
string Text1 = ed.Document.TextContent;
if (ConvertUnitTextProperty != null)
Text1 = ConvertUnitTextProperty(FileName, Text1);
return Text1;
}
2015-05-14 22:35:07 +03:00
if (!File.Exists(FileName))
return null;
Refactoring of Compiler.cs (#2984) * Add first comments * Finish commenting for Compile and CompileUnit * Write TODO sections * Add a few clarifications * splitted some functions from compile * Written some methods from Compile to functions * Update variable names * Refactor - stage 1 Refactor GetUsesSection and IsPossibleNameSpace * Refactor - stage 2 Rename a few functions and variables * Correct an inaccuracy * Added comments, look through CompileUnit * Rename a few functions and add new comments * Split CompileUnit to Subfunctions Add IsUnitCompiled, IsUnitInPCU, InitializeNewUnit, GetSourceCode, GenSyntaxTree, GenUnitDocumentation, CheckDLLDirectiveOnlyForLibraries, MatchErrorsToBadNodes, CheckIfUnitModule, SetUseDLLForSystemUnits, CompileInterfaceDependencies, CompileCurrentUnitInterface, GetImplementationUsesSection, CompileImplementationDependencies, CompileCurrentUnitImplementation * Added some TODOs * Return uses_unit_in original name Renaming of syntax tree nodes leads to internal compiler errors * Extract GenerateILCode method * Add checking if recompilation needed method Needs to be discussed and revised * Add functions for catch blocks in Compile * Extract building semantic tree method Creating main function to be moved to another class * Rename UnitsSortedList * Edit CompileUnitsFromDelayedList method * Change a few variable names, make CreateRCFile function and add comments * Make code more "user-friendly" * Add TODOs 31.11.23 * Create PrebuildSemanticTreeActionsMethod * Refactor semantic checks section in initialize new unit method * Refactor Adding standard units to uses method * Return file_name and compiler_directives original names to avoid internal compilation errors * Refactor GetReferences Method * Initial refactoring of IncludeNamespaces function * Create three more methods and wrap important code in regions * Add TODO's * Resolve merge conflicts * Add returned value to ConstructSyntaxTree method * Fix UnitsSortedList NotFoundError in PCUWriter * Workaround commit * Update PABCSystem after tests' changes * Rename syntax trees in some methods * Delete CurrentSyntaxUnit variable * Revert unnecessary project files changes * Squashed commit of the following: commit f4d7599f1a39252feac97bd5391f46dfdc25f6f4 Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 22 11:43:29 2023 +0300 added links to identarranger commit 3bd5d33e2b2969884e61a3279ff9c353013b57fe Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 22 11:43:03 2023 +0300 Change extension for verybasic to yavb commit 61294c6e7d405e1c68516cc81d3a109e8a1ee295 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Tue Nov 21 09:33:57 2023 +0300 Change Program Example commit 86971488341ed6bf13c39e13a513d7ac0c51c285 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Tue Nov 21 09:28:59 2023 +0300 Add IndentArranger to Compile commit 2ce50bbbf9db22c4243b247b870f6935ce206d26 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Fri Nov 17 10:00:31 2023 +0300 Add Semicolon After Each Statement commit 796309d340e8d8ba730ff9418fa376f34fb7fd36 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Wed Nov 15 18:49:11 2023 +0300 Add Alpha Version of Python-style If-statement commit 5eb88f946fe8254b4f5c5a56ed0a567b3be51227 Merge: ab4ce5b0 0162b637 Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 15 16:54:26 2023 +0300 Merge branch 'IndentArranger' into VeryBasicLanguage commit ab4ce5b0e32d42004726e3dc45cc0d8a65e53f56 Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 15 16:53:51 2023 +0300 Fixes from seminar commit af74012289d0d08517c13499a2a66cb543fc06d2 Author: Владислав Крылов <krylov@sfedu.ru> Date: Sun Nov 12 18:57:29 2023 +0300 finally working! fully implemented compatibility commit 58a39c313324b468d1eec207ba3f5f6eddf74ef2 Author: Владислав Крылов <krylov@sfedu.ru> Date: Sun Nov 12 11:58:16 2023 +0300 more compatibility with pabc Now verybasic statements translate to pascal compiler added .bat script for autobuilding verybasic commit 0162b6376b8fe970704f26213bf9f0f670dfb12e Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Sun Nov 12 10:06:14 2023 +0300 Update test.txt commit 1b759ab1cd7ee2ffeb14afff0418ddf0f30b0399 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Sun Nov 12 10:05:36 2023 +0300 Add Indent and Unindent Keywords to Generated File commit cabda7f3985651cff2a8740f1a5bdea8fe7ac892 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Fri Nov 10 21:25:52 2023 +0300 Add Generation of Output File commit 306f033d0176ab559e3622b8505427dbe2e0e203 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Thu Nov 9 20:42:18 2023 +0300 Update IndentArranger.sln commit 60c0ceced1aa3a7d2e33de0facb1126e295f43b5 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Thu Nov 9 20:41:22 2023 +0300 Add IndentArranger commit 1f4556c4573dae154fcc167b41ff6ab9e8122136 Author: Владислав Крылов <krylov@sfedu.ru> Date: Mon Nov 6 22:48:36 2023 +0300 Made my own VeryBasicParser project Copied some code from SaushkinParser Tried to compile it and implement into Pascal Doesn't work due to grammatik issue * Squashed commit of the following: commit 4e73d9ac3ffef68312f06a74dc83afffcf3ccbee Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 22 15:08:10 2023 +0300 Fixed GPPG (i think so at least) commit e5cfc220828b37fb2f35e565683019716ec3f0ce Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 22 11:44:27 2023 +0300 Update Compiler.cs commit 4698e2e75a5f3b4f523a8bc7733a50e8abb4fca1 Merge: 22aaf2b2 f4d7599f Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 22 11:43:54 2023 +0300 Merge branch 'IndentArrangerTemp' into VeryBasicLanguage commit f4d7599f1a39252feac97bd5391f46dfdc25f6f4 Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 22 11:43:29 2023 +0300 added links to identarranger commit 3bd5d33e2b2969884e61a3279ff9c353013b57fe Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 22 11:43:03 2023 +0300 Change extension for verybasic to yavb commit 22aaf2b2508278a9ffce525ffed52419bf72c23f Merge: c326174f 61294c6e Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 22 11:26:36 2023 +0300 Merge branch 'IndentArrangerTemp' into VeryBasicLanguage commit 61294c6e7d405e1c68516cc81d3a109e8a1ee295 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Tue Nov 21 09:33:57 2023 +0300 Change Program Example commit 86971488341ed6bf13c39e13a513d7ac0c51c285 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Tue Nov 21 09:28:59 2023 +0300 Add IndentArranger to Compile commit c326174ff5ecccf9c4f76d58aea4653f047af049 Author: Владислав Крылов <krylov@sfedu.ru> Date: Sun Nov 19 15:03:19 2023 +0300 Added UniversalParserHelper and GPPG ShiftReduceParser moved to another project UniversalParserHelper project added, most of it copied from SaushkinParser commit 2ce50bbbf9db22c4243b247b870f6935ce206d26 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Fri Nov 17 10:00:31 2023 +0300 Add Semicolon After Each Statement commit 796309d340e8d8ba730ff9418fa376f34fb7fd36 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Wed Nov 15 18:49:11 2023 +0300 Add Alpha Version of Python-style If-statement commit 5eb88f946fe8254b4f5c5a56ed0a567b3be51227 Merge: ab4ce5b0 0162b637 Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 15 16:54:26 2023 +0300 Merge branch 'IndentArranger' into VeryBasicLanguage commit ab4ce5b0e32d42004726e3dc45cc0d8a65e53f56 Author: Владислав Крылов <krylov@sfedu.ru> Date: Wed Nov 15 16:53:51 2023 +0300 Fixes from seminar commit af74012289d0d08517c13499a2a66cb543fc06d2 Author: Владислав Крылов <krylov@sfedu.ru> Date: Sun Nov 12 18:57:29 2023 +0300 finally working! fully implemented compatibility commit 58a39c313324b468d1eec207ba3f5f6eddf74ef2 Author: Владислав Крылов <krylov@sfedu.ru> Date: Sun Nov 12 11:58:16 2023 +0300 more compatibility with pabc Now verybasic statements translate to pascal compiler added .bat script for autobuilding verybasic commit 0162b6376b8fe970704f26213bf9f0f670dfb12e Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Sun Nov 12 10:06:14 2023 +0300 Update test.txt commit 1b759ab1cd7ee2ffeb14afff0418ddf0f30b0399 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Sun Nov 12 10:05:36 2023 +0300 Add Indent and Unindent Keywords to Generated File commit cabda7f3985651cff2a8740f1a5bdea8fe7ac892 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Fri Nov 10 21:25:52 2023 +0300 Add Generation of Output File commit 306f033d0176ab559e3622b8505427dbe2e0e203 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Thu Nov 9 20:42:18 2023 +0300 Update IndentArranger.sln commit 60c0ceced1aa3a7d2e33de0facb1126e295f43b5 Author: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Date: Thu Nov 9 20:41:22 2023 +0300 Add IndentArranger commit 1f4556c4573dae154fcc167b41ff6ab9e8122136 Author: Владислав Крылов <krylov@sfedu.ru> Date: Mon Nov 6 22:48:36 2023 +0300 Made my own VeryBasicParser project Copied some code from SaushkinParser Tried to compile it and implement into Pascal Doesn't work due to grammatik issue * Changed GPPG project NET Framework version, added .dll to gitignore * Adding UniversalParserHelper to project, trying to include VeryBasic * Managed dependencies and got VeryBasicLanguage to work * Change extension of a test program * Rebuild changes What should be added to .gitignore? * Fix bug related to err0524_res_unit.pas * Rebuild Parser * Change Indent and Unindent tokens * Add Symbol Table to ParserABC.y * Change Indent Space Number to 2 * Add While Loop * Add Some Operations to Parser * Make Initialization Node at the Beginning of a program * Create Grammar.txt * Test program added * Add ELIF and SyntaxHighlight * Fix TableSymbol * Add Division * Add Method Call * Add For Loop * Rename SPython Parser Folder * Add documented comments for CompileUnit method * Added Errors to SPython Added Errors.cs Removed link to PABCSaushkinParser Minor fixes * Create default constructor for SourceContext * Move null check of currentUnit to upper level in CompileUnit * Move CreateMainFunction method from Compiler to TreeConverter class * Add gppg and parserhelper to visualpascalabcnet dependencies * Updated installer files to include GPPG and UniversalParserHelper * Rename GPPG to ShiftReduceParser * Fix ShiftReduceParser project dependencies * Fix ShiftReduceParserDependencies second iteration * Workaround commit * Update PABCSystem after tests' changes * Refactor ConvertDirectives method * Get rid of legacy standard modules code * Return varBeginOffset and beginOffset calculation to Compiler class Размещение метода в SyntaxTreeToSemanticTreeConverter не целесообразно. В комментарии видимо имелось в виду что-то другое. * Workaround commit * Update PABCSystem after tests' changes * Revert SPython changes Оставляем только изменения связанные с рефакторингом. * Update .gitignore Co-authored-by: Sun Serega <sunserega2@gmail.com> * Resolve a few Sun Serega treds * Delete comments in ParsersController.cs * Replace specific path with path variable in Studio.bat * Add comment in Studio.bat file and return FileName in CompilerError.cs * Fix TreeSubsidiary.cs encoding and sectCore.nsh indents * Return old version of TestRunner.exe * Rename some variables and polish a few methods * Uncomment accidentally commented code * Replace spaces with tabs * Changed dll name from GPPG * Revert "Changed dll name from GPPG" This reverts commit c485cc8cb787809b7e9dfa8a361e75f17ed39893. * Update .gitignore * Delete Libraries/ShiftReduceParser.dll * Delete bin\ShiftReduceParser.dll * Replace tabs with spaces * Update encoding in Studio.bat * Fix bug with PABCrtl excluded files * Refactor StandardModule class * Add null checks to make debuging easier * Delete unnecessary null checks in SymTable.cs --------- Co-authored-by: Владислав Крылов <krylov@sfedu.ru> Co-authored-by: MovchanGitHub <92666028+MovchanGitHub@users.noreply.github.com> Co-authored-by: Sun Serega <sunserega2@gmail.com>
2023-12-18 22:33:27 +03:00
/*TextReader tr = new StreamReader(file_name, System.Text.Encoding.GetEncoding(1251));
2015-05-14 22:35:07 +03:00
string Text = tr.ReadToEnd();
2015-12-29 15:30:02 +03:00
tr.Close();*/
string Text = PascalABCCompiler.FileReader.ReadFileContent(FileName, null);
if (ConvertUnitTextProperty != null)
Text = ConvertUnitTextProperty(FileName, Text);
2015-05-14 22:35:07 +03:00
return Text;
case PascalABCCompiler.SourceFileOperation.Exists:
if (tp != null)
return true;
return File.Exists(FileName);
case PascalABCCompiler.SourceFileOperation.GetLastWriteTime:
if (tp != null)
return tp.ModifyDateTime;
return File.GetLastWriteTime(FileName);
case PascalABCCompiler.SourceFileOperation.FileEncoding:
return DefaultFileEncoding;
}
return null;
}
private delegate void ChangeCompilerStateDelegate(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName);
private void OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName)
{
if (CurrentThreadIsMainThread())
OnChangeCompilerStateEx(sender, State, FileName);
else
BeginInvoke(new ChangeCompilerStateDelegate(OnChangeCompilerStateEx), sender, State, FileName);
}
private void CompileTestProgram(object state)
{
string fileName = @"C:\PABCWork.NET\Samples\test.pas";
if (File.Exists(fileName))
{
PascalABCCompiler.CompilerOptions co = new PascalABCCompiler.CompilerOptions();
co.SourceFileName = fileName;
Compile(co);
}
}
private void LoadPlugins(object state)
{
AddTextToCompilerMessages(VECStringResources.Get("LOAD_PLUGINS") + Environment.NewLine);
PluginsController.AddPlugins();
if (PluginsController.Plugins.Count == 0)
AddTextToCompilerMessages(VECStringResources.Get("PLUGINS_NOTFOUND") + Environment.NewLine);
else
foreach (VisualPascalABCPlugins.IVisualPascalABCPlugin Plugin in PluginsController.Plugins)
AddTextToCompilerMessages(Plugin.Name+" v"+Plugin.Version + Environment.NewLine);
if (PluginsController.ErrorList.Count > 0)
{
AddTextToCompilerMessages(VECStringResources.Get("PLUGINS_LOADING_ERRORS") + Environment.NewLine);
foreach (VisualPascalABCPlugins.PluginLoadingError Error in PluginsController.ErrorList)
AddTextToCompilerMessages(Error.ToString() + Environment.NewLine);
}
//VisualPABCSingleton.MainForm.codeCompletionParserController.ParseAllFiles();
}
void AddCompilerTextToCompilerMessages(PascalABCCompiler.ICompiler sender, string text)
{
if (sender.CompilerType == PascalABCCompiler.CompilerType.Standart)
AddTextToCompilerMessages(VECStringResources.Get("LOCAL_COMPILER_PREFIX") + text);
else
AddTextToCompilerMessages(VECStringResources.Get("REMOTE_COMPILER_PREFIX") + text);
}
List<string> ParsedFiles = new List<string>();
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
/// <summary>
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
/// Выводит сообщения о подключенных языках
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
/// </summary>
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
private void OnLanguageLoaded(Languages.Facade.ILanguage language)
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
{
string languageConnectedMessage = string.Format(VECStringResources.Get("LANGUAGE_LOADED{0}"), language.Name);
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
languageConnectedMessage += Environment.NewLine;
AddTextToCompilerMessages(languageConnectedMessage);
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
}
/// <summary>
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
/// Выводит сообщения об ошибках, возникших при загрузке языков
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
/// </summary>
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
private void OnLanguageLoadErrorOccured(string languageFileName)
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
{
New languages engine (#3120) * Implement first version of languages interfaces and classes ParsersController заменен на LanguageProvider. * Update ParserTools.csproj * Update RemoteCompiler.cs * Update TestRunner * Rename LanguageIntegrator project to Languages * Update TestRunner * Rename Parsers folder * Rename PascalABCParser.dll to PascalABCLanguage.dll * Reorganise LanguageIntegrator and rename DocTagsParser * Update Release Generators * Update language loading messages * Update linux version * Move BaseParser fields to ILanguage interface * Revert "Update Release Generators" This reverts commit 26a991c71b81e643d9fbd9a815ddca222768dda9. * Revert "Rename PascalABCParser.dll to PascalABCLanguage.dll" * Clean the mess in parser folders * Organize namespaces properly * Revert "Rename LanguageIntegrator project to Languages" * Add new enclosing folders for standard languages * Organize namespaces of LanguageIntegrator properly * Rename StandardLanguages to Languages * Comment the rest of Visual basic source code * Update OutputPath in pascal parser project * Move BaseParser methods to IParser * Restore Pascal parser project initial structure * Add PascalLanguage project * Move SyntaxTreeConverters project to Languages\Pascal folder * Rename SemanticRules in parser project * Rename Errors1 to Errors in parser project * Delete LambdaConverter dll from installer * Update language integrator to load *Language.dll files * Move lambda converter project to pascal lanuage dir * Revert "Delete LambdaConverter dll from installer" This reverts commit dd56f559ebe4f8c4c5c33752d44e6953001b96a5. * Switch off VBNETParser building * Delete syntax tree converters controller * Delete lambda converter dll from repository * Reorganize syntax tree to semantic tree conversion stage * Add BaseLanguage class to make language initialization more neat * Delete syntax tree post processors entity from ILanguage and refactor ABCStatistics calls * Add new IDocParser interface for documentation comments parser * Clean up folders * Add helper data structures to reduce parameters amount in CompileInterface and CompileImplementation * Add documentation to language classes * Move Union struct in global namespace and project (ParserTools) * Add more comments and a safe select language method * Rename SemanticRules class * Fix directives format null bug * Add System.Linq ref to LanguageIntegrator * Delete SyntaxToSemanticTreeConverter interface * Add BaseSyntaxTreeConverter * Call safe select language method in intellisence * Delete source files providers from parsers * Rename GetSyntaxTree method * Change Prebuild tree to be virtual - not abstract * Refresh documentation a bit * Add temporary language check for ABCHealth button * Add parser reference to parser tools * Move current compilation unit assigning higher to avoid bug with unit check * Delete null DirectiveInfo's and refactor directives' code * Add a few more comments
2024-05-25 12:26:32 +03:00
string languageLoadErrorMessage = string.Format(VECStringResources.Get("LANGUAGE_LOAD_ERROR{0}"), Path.GetFileName(languageFileName));
languageLoadErrorMessage += Environment.NewLine;
AddTextToCompilerMessages(languageLoadErrorMessage);
Implement programming languages integration functionality (#3001) * Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit 8f9dc7e5a0dbe2516a2af44d8ef843b7c30e2292 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit 90363ced454216ef44c4919bb694b1a2c786b4b5 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commit c9d7ba7758d1cb4f41348f5cc9095b0350e0c005 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit 6fbc0200bf4b413940a459f8b5d96c4597f561f4 Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commit e4d63bfef9ef22c3a21375b542d5540a593916e5 Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit 0d37232d21ce81d3443ad680b21b865a2b2fe017 Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit 9fd4c7f3388b7e9b5cd6dbae1d619fa11827e30d Merge: 3cca2a89 6027083b Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit 3cca2a894940cf585772464d55ac5f4bcf8e01ae Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
2024-03-13 22:16:40 +03:00
}
2015-05-14 22:35:07 +03:00
private void OnChangeCompilerStateEx(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FullFileName)
{
string RusName = null;
string FileName = null;
if (FullFileName != null)
FileName = Path.GetFileName(FullFileName);
switch (State)
{
case PascalABCCompiler.CompilerState.CompilationStarting:
RusName = VECStringResources.Get("STATE_START_COMPILING_ASSEMBLY{0}");
Деактивация кнопок, связанных с Intellisense, для языков без Intellisense + разделение ILanguageInformation на два интерфейса (#3378) * Refactor language information classes * Implement SimpleLanguageInformation abstract class * Move some properties to SimpleLanguageInformation * Implement format and debug buttons disabling if Intellisense is not supported for current language * Add Intellisense available check in FormsExtensions to deactivate menu items if needed * Change function interfaces in VisibilityService * Replace CodeCompletionController.CurrentParser null checks with IntellisenseAvailable method call * Refactor IParser and BaseParser to deduplicate code * Fix BuildTreeInSpecialMode in SPythonParser * Add SimpleParser class for new languages without Intellisense * Delete duplicate SetDebugButtonsEnabled function * Add Intellisense available check in RunService when attaching debugger * Delete inner check in SetDebugButtonsEnabled to improve architecture * Change CurrentParser property in CodeCompletion to be CurrentLanguage * Divide ILanguageInformation into two interfaces (creating new ILanguageIntellisenseSupport) * Fix LanguageIntellisenseSupport initialization in BaseLanguage * Fix RunService fictive_attach logic * Disable Intellisense parsing for languages without Intellisense support * Add DefaultLanguageInformation abstract class * Add default implementation for SetSemanticConstants in BaseLanguage * Simplify IParser interface * Update developer guide documentation
2026-01-27 22:25:28 +03:00
SetCompilingAndRunButtonsEnabled(false);
2015-05-14 22:35:07 +03:00
ParsedFiles.Clear();
break;
case PascalABCCompiler.CompilerState.BeginCompileFile: RusName = VECStringResources.Get("STATE_BEGINCOMPILEFILE{0}"); break;
case PascalABCCompiler.CompilerState.CompileInterface: RusName = VECStringResources.Get("STATE_COMPILEINTERFACE{0}"); break;
case PascalABCCompiler.CompilerState.CompileImplementation: RusName = VECStringResources.Get("STATE_COMPILEIMPLEMENTATION{0}"); break;
case PascalABCCompiler.CompilerState.EndCompileFile: RusName = VECStringResources.Get("STATE_ENDCOMPILEFILE{0}"); break;
case PascalABCCompiler.CompilerState.CodeGeneration: RusName = VECStringResources.Get("STATE_CODEGENERATION{0}"); break;
case PascalABCCompiler.CompilerState.ReadDLL: RusName = VECStringResources.Get("STATE_READDLL{0}"); break;
case PascalABCCompiler.CompilerState.SavePCUFile: RusName = VECStringResources.Get("STATE_SAVEPCUFILE{0}"); break;
case PascalABCCompiler.CompilerState.ReadPCUFile: RusName = VECStringResources.Get("STATE_READPCUFILE{0}"); break;
case PascalABCCompiler.CompilerState.PCUReadingError: RusName = VECStringResources.Get("STATE_PCUREADINGERROR{0}"); break;
case PascalABCCompiler.CompilerState.PCUWritingError: RusName = VECStringResources.Get("STATE_PCUWRITINGERROR{0}"); break;
case PascalABCCompiler.CompilerState.SemanticTreeConversion: RusName = VECStringResources.Get("STATE_SEMANTICTREECONVERSION{0}"); break;
case PascalABCCompiler.CompilerState.SemanticTreeConverterConnected: RusName = VECStringResources.Get("STATE_SEMANTICTREECONVERTERCONNECTED{0}"); break;
case PascalABCCompiler.CompilerState.SyntaxTreeConversion: RusName = VECStringResources.Get("STATE_SYNTAXTREECONVERSION{0}"); break;
2015-05-14 22:35:07 +03:00
case PascalABCCompiler.CompilerState.Ready:
RusName = VECStringResources.Get("STATE_READY");
if (!StartingCompleted)
{
switch (sender.CompilerType)
{
case PascalABCCompiler.CompilerType.Standart:
standartCompiler = (PascalABCCompiler.Compiler)sender;
break;
case PascalABCCompiler.CompilerType.Remote:
remoteCompiler = (PascalABCCompiler.RemoteCompiler)sender;
break;
}
if (!(defaultCompilerType == PascalABCCompiler.CompilerType.Remote) || (standartCompiler.State == PascalABCCompiler.CompilerState.Ready && (remoteCompiler != null && remoteCompiler.State == PascalABCCompiler.CompilerState.Ready)))
StartingCompleted = true;
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));
2015-05-14 22:35:07 +03:00
if (StartingCompleted)
{
ChangeVisualEnvironmentState(VisualEnvironmentState.FinishCompilerLoading, standartCompiler);
compilerLoaded = true;
VisualPABCSingleton.MainForm.StartTimer();
/*if (!ThreadPool.QueueUserWorkItem(new WaitCallback(CompileTestProgram)))
CompileTestProgram(null);*/
if (!ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPlugins)))
LoadPlugins(null);
Деактивация кнопок, связанных с Intellisense, для языков без Intellisense + разделение ILanguageInformation на два интерфейса (#3378) * Refactor language information classes * Implement SimpleLanguageInformation abstract class * Move some properties to SimpleLanguageInformation * Implement format and debug buttons disabling if Intellisense is not supported for current language * Add Intellisense available check in FormsExtensions to deactivate menu items if needed * Change function interfaces in VisibilityService * Replace CodeCompletionController.CurrentParser null checks with IntellisenseAvailable method call * Refactor IParser and BaseParser to deduplicate code * Fix BuildTreeInSpecialMode in SPythonParser * Add SimpleParser class for new languages without Intellisense * Delete duplicate SetDebugButtonsEnabled function * Add Intellisense available check in RunService when attaching debugger * Delete inner check in SetDebugButtonsEnabled to improve architecture * Change CurrentParser property in CodeCompletion to be CurrentLanguage * Divide ILanguageInformation into two interfaces (creating new ILanguageIntellisenseSupport) * Fix LanguageIntellisenseSupport initialization in BaseLanguage * Fix RunService fictive_attach logic * Disable Intellisense parsing for languages without Intellisense support * Add DefaultLanguageInformation abstract class * Add default implementation for SetSemanticConstants in BaseLanguage * Simplify IParser interface * Update developer guide documentation
2026-01-27 22:25:28 +03:00
SetCompilingAndRunButtonsEnabled(true);
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
SetDebugButtonsEnabled(true);
2015-05-14 22:35:07 +03:00
}
}
else
{
if (Compiler == sender)
{
Деактивация кнопок, связанных с Intellisense, для языков без Intellisense + разделение ILanguageInformation на два интерфейса (#3378) * Refactor language information classes * Implement SimpleLanguageInformation abstract class * Move some properties to SimpleLanguageInformation * Implement format and debug buttons disabling if Intellisense is not supported for current language * Add Intellisense available check in FormsExtensions to deactivate menu items if needed * Change function interfaces in VisibilityService * Replace CodeCompletionController.CurrentParser null checks with IntellisenseAvailable method call * Refactor IParser and BaseParser to deduplicate code * Fix BuildTreeInSpecialMode in SPythonParser * Add SimpleParser class for new languages without Intellisense * Delete duplicate SetDebugButtonsEnabled function * Add Intellisense available check in RunService when attaching debugger * Delete inner check in SetDebugButtonsEnabled to improve architecture * Change CurrentParser property in CodeCompletion to be CurrentLanguage * Divide ILanguageInformation into two interfaces (creating new ILanguageIntellisenseSupport) * Fix LanguageIntellisenseSupport initialization in BaseLanguage * Fix RunService fictive_attach logic * Disable Intellisense parsing for languages without Intellisense support * Add DefaultLanguageInformation abstract class * Add default implementation for SetSemanticConstants in BaseLanguage * Simplify IParser interface * Update developer guide documentation
2026-01-27 22:25:28 +03:00
SetCompilingAndRunButtonsEnabled(true);
2015-05-14 22:35:07 +03:00
}
}
break;
case PascalABCCompiler.CompilerState.Reloading:
if (Compiler == sender)
Деактивация кнопок, связанных с Intellisense, для языков без Intellisense + разделение ILanguageInformation на два интерфейса (#3378) * Refactor language information classes * Implement SimpleLanguageInformation abstract class * Move some properties to SimpleLanguageInformation * Implement format and debug buttons disabling if Intellisense is not supported for current language * Add Intellisense available check in FormsExtensions to deactivate menu items if needed * Change function interfaces in VisibilityService * Replace CodeCompletionController.CurrentParser null checks with IntellisenseAvailable method call * Refactor IParser and BaseParser to deduplicate code * Fix BuildTreeInSpecialMode in SPythonParser * Add SimpleParser class for new languages without Intellisense * Delete duplicate SetDebugButtonsEnabled function * Add Intellisense available check in RunService when attaching debugger * Delete inner check in SetDebugButtonsEnabled to improve architecture * Change CurrentParser property in CodeCompletion to be CurrentLanguage * Divide ILanguageInformation into two interfaces (creating new ILanguageIntellisenseSupport) * Fix LanguageIntellisenseSupport initialization in BaseLanguage * Fix RunService fictive_attach logic * Disable Intellisense parsing for languages without Intellisense support * Add DefaultLanguageInformation abstract class * Add default implementation for SetSemanticConstants in BaseLanguage * Simplify IParser interface * Update developer guide documentation
2026-01-27 22:25:28 +03:00
SetCompilingAndRunButtonsEnabled(false);
2015-05-14 22:35:07 +03:00
RusName = VECStringResources.Get("STATE_RELOADING");
break;
case PascalABCCompiler.CompilerState.CompilationFinished:
RusName = VECStringResources.Get("STATE_COMPILATIONFINISHED{0}");
if (Compiler.ErrorsList.Count == 0)
{
SaveSourceFilesIfCompilationOk();
AddTextToCompilerMessages(string.Format(VECStringResources.Get("CM_OK_{0}MS") + Environment.NewLine, (DateTime.Now - compilationStartTime).TotalMilliseconds) + Environment.NewLine);
}
else
{
List<PascalABCCompiler.Errors.Error> ErrorsList = ErrorsManager.CreateErrorsList(Compiler.ErrorsList);
AddTextToCompilerMessages(string.Format(VECStringResources.Get("CM_{0}_ERROS") + Environment.NewLine, ErrorsList.Count));
foreach (PascalABCCompiler.Errors.Error Err in ErrorsList)
AddTextToCompilerMessages(Err.ToString() + Environment.NewLine);
}
break;
default:
//RusName = State.ToString();
break;
}
if (RusName != null)
{
if (FileName != null)
RusName = string.Format(RusName, FileName);
else RusName = string.Format(RusName, "");
2015-05-14 22:35:07 +03:00
RusName += Environment.NewLine;
AddCompilerTextToCompilerMessages(sender, RusName);
}
RusName = null;
switch (State)
{
case PascalABCCompiler.CompilerState.BeginParsingFile:
ParsedFiles.Add(FullFileName);
break;
case PascalABCCompiler.CompilerState.BeginCompileFile: RusName = VECStringResources.Get("STATETEXT_BEGINCOMPILEFILE{0}"); break;
//case PascalABCCompiler.CompilerState.ReadPCUFile: RusName = "Чтение {0}..."; break;
2015-05-14 22:35:07 +03:00
case PascalABCCompiler.CompilerState.CodeGeneration: RusName = VECStringResources.Get("STATETEXT_CODEGENERATION{0}"); break;
//case PascalABCCompiler.CompilerState.ReadDLL:
//case PascalABCCompiler.CompilerState.ReadPCUFile: RusName = "Чтение {0}..."; break;
2015-05-14 22:35:07 +03:00
case PascalABCCompiler.CompilerState.Ready:
if (Compiler != null)
{
List<PascalABCCompiler.Errors.Error> ErrorsList = ErrorsManager.CreateErrorsList(Compiler.ErrorsList);
if (ErrorsList.Count > 0)
{
RusName = string.Format(VECStringResources.Get("STATETEXT_{0}_ERROS"), ErrorsList.Count);
}
else
if (Compilation)
{
if (Compiler.Warnings.Count > 0)
RusName = string.Format(VECStringResources.Get("STATETEXT_COMPILATION_SUCCESS_{0}LINES_{1}WARNINGS"), Compiler.LinesCompiled, Compiler.Warnings.Count);
else
RusName = string.Format(VECStringResources.Get("STATETEXT_COMPILATION_SUCCESS_{0}LINES"), Compiler.LinesCompiled);
}
else
RusName = VECStringResources.Get("STATETEXT_READY");
}
else
RusName = VECStringResources.Get("STATETEXT_READY");
break;
case PascalABCCompiler.CompilerState.Reloading: RusName = VECStringResources.Get("STATETEXT_RELOADING"); break;
}
if (RusName != null)
{
if (FileName != null)
RusName = string.Format(RusName, FileName);
SetStateText(RusName);
}
if (!Compilation && State == PascalABCCompiler.CompilerState.CompilationStarting)
Compilation = true;
if (Compilation && State == PascalABCCompiler.CompilerState.Ready)
Compilation = false;
}
void SaveSourceFilesIfCompilationOk()
{
if (!UserOptions.SaveSourceFilesIfComilationOk)
return;
foreach (string name in ParsedFiles)
ExecuteAction(VisualEnvironmentCompilerAction.SaveFile, name);
}
#region IVisualEnvironmentCompiler Members
public event ChangeVisualEnvironmentStateDelegate ChangeVisualEnvironmentState;
public PascalABCCompiler.ICompiler Compiler
{
get
{
if (defaultCompilerType == PascalABCCompiler.CompilerType.Remote)
return remoteCompiler;
return standartCompiler;
}
}
public PascalABCCompiler.Compiler StandartCompiler
{
get
{
return standartCompiler;
}
}
public PascalABCCompiler.RemoteCompiler RemoteCompiler
{
get
{
return remoteCompiler;
}
}
public void ExecuteSourceLocationAction(PascalABCCompiler.SourceLocation SourceLocation,SourceLocationAction Action)
{
ExecuteSLAction(SourceLocation,Action);
}
public object ExecuteAction(VisualEnvironmentCompilerAction Action, object obj)
{
return ExecuteVECAction(Action, obj);
}
public PascalABCCompiler.CompilerType DefaultCompilerType
{
get
{
return defaultCompilerType;
}
set
{
if (defaultCompilerType == value)
return;
defaultCompilerType=value;
if (defaultCompilerType == PascalABCCompiler.CompilerType.Remote && remoteCompiler == null)
{
LoadRemoteCompiler();
}
}
}
#endregion
}
}