Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet
Browse files Browse the repository at this point in the history
…into test
  • Loading branch information
BH_build_bot authored and BH_build_bot committed Aug 3, 2024
2 parents 25d069f + 47c61d8 commit 3dcb539
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 128 deletions.
236 changes: 159 additions & 77 deletions Compiler/Compiler.cs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions Compiler/Errors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ public AppTypeDllIsAllowedOnlyForLibraries(string FileName, SyntaxTree.SourceCon
}
}

/// <summary>
/// Бросается при обраружении директивы {$DisableStandardUnits} в подключенном модуле
/// </summary>
public class DisableStandardUnitsDirectiveDisallowedInUsedUnits : CompilerThrownError
{
public DisableStandardUnitsDirectiveDisallowedInUsedUnits(string FileName, SyntaxTree.SourceContext sc)
: base(StringResources.Get("COMPILATIONERROR_DISABLE_STANDARD_UNITS_DIRECTIVE_DISALLOWED_IN_USED_UNITS"), FileName)
{
this.source_context = sc;
}
}

/// <summary>
/// Бросается при компиляции библиотеки не первой
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions Parsers/PascalABCParserNewSaushkin/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ private void InitializeValidDirectives()
[StringConstants.compiler_directive_include] = new DirectiveInfo(quotesAreSpecialSymbols: true),
[StringConstants.compiler_directive_targetframework] = new DirectiveInfo(),
[StringConstants.compiler_directive_hidden_idents] = NoParamsDirectiveInfo(),
[StringConstants.compiler_directive_disable_standard_units] = NoParamsDirectiveInfo(),
[StringConstants.compiler_directive_version_string] = new DirectiveInfo(IsValidVersionCheck()),
[StringConstants.compiler_directive_product_string] = new DirectiveInfo(quotesAreSpecialSymbols: true),
[StringConstants.compiler_directive_company_string] = new DirectiveInfo(quotesAreSpecialSymbols: true),
Expand Down
13 changes: 0 additions & 13 deletions PascalABCNET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SyntaxTreeVisualisator", "V
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PT4Provider", "VisualPlugins\PT4Provider\PT4Provider.csproj", "{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelpBuilder", "VisualPlugins\HelpBuilder\HelpBuilder.csproj", "{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{F8CE2712-826B-450B-A72F-D32D80C99858}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compiler", "Compiler\Compiler.csproj", "{1E42361A-EDA3-4872-88AF-A3AAF600D36D}"
Expand Down Expand Up @@ -203,16 +201,6 @@ Global
{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}.Release|x86.ActiveCfg = Release|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|x86.ActiveCfg = Debug|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|Any CPU.Build.0 = Release|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|x86.ActiveCfg = Release|Any CPU
{1E42361A-EDA3-4872-88AF-A3AAF600D36D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E42361A-EDA3-4872-88AF-A3AAF600D36D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E42361A-EDA3-4872-88AF-A3AAF600D36D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -549,7 +537,6 @@ Global
{A36031B7-D3D1-4372-B478-07621069602E} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
{1437FD01-0741-4912-8035-6BDFEAA45626} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
{1E42361A-EDA3-4872-88AF-A3AAF600D36D} = {F8CE2712-826B-450B-A72F-D32D80C99858}
{A25D26FB-3043-4BCF-833E-E3F4C3BE795E} = {F8CE2712-826B-450B-A72F-D32D80C99858}
{7FE7173B-22EB-46E5-897B-02F422662E51} = {F8CE2712-826B-450B-A72F-D32D80C99858}
Expand Down
59 changes: 32 additions & 27 deletions StringConstants/StringConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,33 +317,34 @@ public static string GetSetTypeName(string elem_type_name)
public static string default_constructor_name = "create";

#region PASCAL COMPILER DIRECTIVES
public static string compiler_directive_apptype = "apptype";
public static string compiler_directive_reference = "reference";
public static string compiler_directive_include_namespace = "includenamespace";
public static string compiler_directive_savepcu = "savepcu";
public static string compiler_directive_zerobasedstrings = "zerobasedstrings";
public static string compiler_directive_zerobasedstrings_ON = "string_zerobased+";
public static string compiler_directive_zerobasedstrings_OFF = "string_zerobased-";
public static string compiler_directive_nullbasedstrings_ON = "string_nullbased+"; // для совместимости. Deprecated
public static string compiler_directive_nullbasedstrings_OFF = "string_nullbased-"; // для совместимости. Deprecated
public static string compiler_directive_initstring_as_empty_ON = "string_initempty+";
public static string compiler_directive_initstring_as_empty_OFF = "string_initempty-";
public static string compiler_directive_resource = "resource";
public static string compiler_directive_platformtarget = "platformtarget";
public static string compiler_directive_faststrings = "faststrings";
public static string compiler_directive_gendoc = "gendoc";
public static string compiler_directive_region = "region";
public static string compiler_directive_endregion = "endregion";
public static string compiler_directive_ifdef = "ifdef";
public static string compiler_directive_endif = "endif";
public static string compiler_directive_ifndef = "ifndef";
public static string compiler_directive_else = "else";
public static string compiler_directive_undef = "undef";
public static string compiler_directive_define = "define";
public static string compiler_directive_include = "include";
public static string compiler_directive_targetframework = "targetframework";
public static string compiler_directive_hidden_idents = "hiddenidents";
public static string compiler_directive_omp = "omp";
public const string compiler_directive_apptype = "apptype";
public const string compiler_directive_reference = "reference";
public const string compiler_directive_include_namespace = "includenamespace";
public const string compiler_directive_savepcu = "savepcu";
public const string compiler_directive_zerobasedstrings = "zerobasedstrings";
public const string compiler_directive_zerobasedstrings_ON = "string_zerobased+";
public const string compiler_directive_zerobasedstrings_OFF = "string_zerobased-";
public const string compiler_directive_nullbasedstrings_ON = "string_nullbased+"; // для совместимости. Deprecated
public const string compiler_directive_nullbasedstrings_OFF = "string_nullbased-"; // для совместимости. Deprecated
public const string compiler_directive_initstring_as_empty_ON = "string_initempty+";
public const string compiler_directive_initstring_as_empty_OFF = "string_initempty-";
public const string compiler_directive_resource = "resource";
public const string compiler_directive_platformtarget = "platformtarget";
public const string compiler_directive_faststrings = "faststrings";
public const string compiler_directive_gendoc = "gendoc";
public const string compiler_directive_region = "region";
public const string compiler_directive_endregion = "endregion";
public const string compiler_directive_ifdef = "ifdef";
public const string compiler_directive_endif = "endif";
public const string compiler_directive_ifndef = "ifndef";
public const string compiler_directive_else = "else";
public const string compiler_directive_undef = "undef";
public const string compiler_directive_define = "define";
public const string compiler_directive_include = "include";
public const string compiler_directive_targetframework = "targetframework";
public const string compiler_directive_hidden_idents = "hiddenidents";
public const string compiler_directive_disable_standard_units = "disablestandardunits";
public const string compiler_directive_omp = "omp";
public const string compiler_directive_version_string = "version";
public const string compiler_directive_product_string = "product";
public const string compiler_directive_company_string = "company";
Expand Down Expand Up @@ -372,6 +373,10 @@ public static string GetSetTypeName(string elem_type_name)
public const string pascalLanguageDllName = "PascalLanguage.dll";
#endregion

public static readonly string[] netSystemLibraries = new[] { "mscorlib.dll", "System.dll", "System.Core.dll", "System.Numerics.dll", "System.Windows.Forms.dll", "System.Drawing.dll" };

public static readonly string[] graph3DDependencies = new[] { "PresentationFramework.dll", "WindowsBase.dll", "PresentationCore.dll", "HelixToolkit.Wpf.dll", "HelixToolkit.dll" };

public static string get_array_type_name(string type_name, int rank)
{
if (rank == 1)
Expand Down
2 changes: 1 addition & 1 deletion TreeConverter/TreeRealization/programs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public void create_main_function(string[] used_stand_modules, Dictionary<string,
{
sl.statements.AddElementFirst(units[0].IsConsoleApplicationVariableAssignExpr);
}
else if (SystemLibrary.SystemLibInitializer.ConfigVariable.sym_info is compiled_variable_definition && units[0].IsConsoleApplicationVariableValue.constant_value)
else if (SystemLibrary.SystemLibInitializer.ConfigVariable?.sym_info is compiled_variable_definition && units[0].IsConsoleApplicationVariableValue.constant_value)
{
bool is_console = true;

Expand Down
8 changes: 3 additions & 5 deletions VisualPlugins/CompilerController/CompilerInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalAB
{
//CompilerConsole.Clear();
dt = DateTime.Now;
if (OnRebuld.Checked)
VisualEnvironmentCompiler.Compiler.CompilerOptions.Rebuild = true;
}
text = State.ToString();
if (FileName != null)
Expand All @@ -52,12 +50,12 @@ void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalAB
NoSavePCU.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate;
NoSemantic.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.SemanticAnalysis;
NoCodeGeneration.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.CodeGeneration;
NoAddStandartUnits.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.AddStandartUnits;
NoAddStandartUnits.Checked = VisualEnvironmentCompiler.Compiler.CompilerOptions.DisableStandardUnits;
NoSkipPCUErrors.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.SkipPCUErrors;
NoSkipInternalErrorsIfSyntaxTreeIsCorrupt.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.SkipInternalErrorsIfSyntaxTreeIsCorrupt;
NoIncludeDebugInfoInPCU.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.IncludeDebugInfoInPCU;
cbUseStandarParserForInellisense.Checked = VisualEnvironmentCompiler.Compiler.InternalDebug.UseStandarParserForIntellisense;
//OnRebuld.Checked = VisualEnvironmentCompiler.Compiler.CompilerOptions.Rebuild;
OnRebuld.Checked = VisualEnvironmentCompiler.Compiler.CompilerOptions.Rebuild;
}
text += Environment.NewLine;
if (sender.CompilerType == PascalABCCompiler.CompilerType.Remote)
Expand Down Expand Up @@ -121,7 +119,7 @@ private void NoCodeGeneration_CheckedChanged(object sender, EventArgs e)

private void NoAddStandartUnits_CheckedChanged(object sender, EventArgs e)
{
VisualEnvironmentCompiler.Compiler.InternalDebug.AddStandartUnits = !NoAddStandartUnits.Checked;
VisualEnvironmentCompiler.Compiler.CompilerOptions.DisableStandardUnits = NoAddStandartUnits.Checked;
}

private void OnRebuld_CheckedChanged(object sender, EventArgs e)
Expand Down
1 change: 0 additions & 1 deletion VisualPlugins/HelpBuilder/AssemblyHelpBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public string BuildHelp(Assembly a)
}
catch
{
vec.StandartCompiler.InternalDebug.DocumentedUnits.Clear();
throw;
}
}
Expand Down
1 change: 0 additions & 1 deletion VisualPlugins/HelpBuilder/FileParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public bool Parse(string FileName)
VisualEnvironmentCompiler.StandartCompiler.InternalDebug.AlwaysGenerateXMLDoc = true;
PascalABCCompiler.CompilerType ct = VisualEnvironmentCompiler.DefaultCompilerType;
VisualEnvironmentCompiler.DefaultCompilerType = PascalABCCompiler.CompilerType.Standart;
VisualEnvironmentCompiler.StandartCompiler.InternalDebug.DocumentedUnits.Add(FileName.ToLower());
try
{
VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.BuildUnit, FileName);
Expand Down
3 changes: 0 additions & 3 deletions VisualPlugins/HelpBuilder/HelpBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,9 @@ public string BuildHelp(string[] file_names)
CompilationProgress(string.Format(PascalABCCompiler.StringResources.Get(HelpBuilder_VisualPascalABCPlugin.StringsPrefix + "PARSING_{0}"), Path.GetFileName(s)));
if (!parser.Parse(s))
{
vec.StandartCompiler.InternalDebug.DocumentedUnits.Clear();
return null;
}
}
vec.StandartCompiler.InternalDebug.DocumentedUnits.Clear();
if (!Directory.Exists(output_dir))
Directory.CreateDirectory(output_dir);
copy_files();
Expand Down Expand Up @@ -319,7 +317,6 @@ public string BuildHelp(string[] file_names)
}
catch
{
vec.StandartCompiler.InternalDebug.DocumentedUnits.Clear();
throw;
}
}
Expand Down
1 change: 1 addition & 0 deletions bin/Lng/Eng/CompilerErrors.dat
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ FILE_{0}_NOT_FOUND=File '{0}' not found
NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Files with namespaces can be compiled only inside projects
NAMESPACE_CANNOT_HAVE_IN_SECTION=Namespace cannot have 'in' section
APPTYPE_DLL_IS_ALLOWED_ONLY_FOR_LIBRARIES=Parameter 'dll' in 'apptype' directive is allowed only for libraries
DISABLE_STANDARD_UNITS_DIRECTIVE_DISALLOWED_IN_USED_UNITS=Directive 'DisableStandardUnits' is disallowed in attached (by uses keyword) units
USES_IN_WRONG_NAME=Unit name in uses-in ({0}) must be same as file name ({1})
UNSUPPORTED_TARGETFRAMEWORK_{0}=TargetFramework '{0}' is not supported
UNSUPPORTED_TARGET_PLATFORM{0}=Platform '{0}' is not supported
Expand Down
1 change: 1 addition & 0 deletions bin/Lng/Rus/CompilerErrors.dat
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Компиляция файлов с
FILE_{0}_NOT_FOUND=Файл '{0}' не найден
NAMESPACE_CANNOT_HAVE_IN_SECTION=Для пространства имен не может указываться секция in
APPTYPE_DLL_IS_ALLOWED_ONLY_FOR_LIBRARIES=Параметр 'dll' директивы 'apptype' разрешается только для библиотек
DISABLE_STANDARD_UNITS_DIRECTIVE_DISALLOWED_IN_USED_UNITS=Указание директивы 'DisableStandardUnits' в подключенных модулях не разрешается
USES_IN_WRONG_NAME=Имя модуля в uses-in ({0}) должно совпадать с именем файла ({1})
UNSUPPORTED_TARGETFRAMEWORK_{0}=TargetFramework '{0}' не поддерживается
UNSUPPORTED_TARGET_PLATFORM{0}=Платформа '{0}' не поддерживается
Expand Down

0 comments on commit 3dcb539

Please sign in to comment.