New directive to disable linking pascal standard modules (#3186)
* Add new 'disable standard units' directive and it's processing * Refactor InitializeNewUnit function * Improve disable standard units directive checks * Add null check in programs.cs to avoid error * Rename error related to disable standard units directive * Add referencing standard net libraries * Add checks for duplicates when injecting references
This commit is contained in:
parent
fc3ab96cae
commit
47c61d8b14
|
|
@ -276,6 +276,7 @@ namespace PascalABCCompiler
|
|||
public bool ForIntellisense = false;
|
||||
public bool Rebuild = false;
|
||||
public bool Optimise = false;
|
||||
public bool DisableStandardUnits = false; // true устанавливается соответствующей директивой
|
||||
public bool SavePCUInThreadPull = false;
|
||||
public bool RunWithEnvironment = false;
|
||||
public string CompiledUnitExtension = StringConstants.pascalCompiledUnitExtension;
|
||||
|
|
@ -488,7 +489,6 @@ namespace PascalABCCompiler
|
|||
public bool CodeGeneration = true;
|
||||
public bool SemanticAnalysis = true;
|
||||
public bool PCUGenerate = true;
|
||||
public bool AddStandartUnits = true;
|
||||
public bool SkipPCUErrors = true;
|
||||
public bool IncludeDebugInfoInPCU = true;
|
||||
public bool AlwaysGenerateXMLDoc = false;
|
||||
|
|
@ -974,6 +974,9 @@ namespace PascalABCCompiler
|
|||
UnitsToCompileDelayedList.Clear();
|
||||
DLLCache.Clear();
|
||||
project = null;
|
||||
|
||||
// обнуляем здесь, чтобы значение не сохранялось между запусками EVA
|
||||
CompilerOptions.DisableStandardUnits = false;
|
||||
}
|
||||
|
||||
void CheckErrorsAndThrowTheFirstOne()
|
||||
|
|
@ -3054,8 +3057,14 @@ namespace PascalABCCompiler
|
|||
directives = (compilationUnit.SemanticTree as common_unit_node).compiler_directives;
|
||||
else
|
||||
directives = GetDirectivesAsSemanticNodes(compilationUnit.SyntaxTree.compiler_directives, compilationUnit.SyntaxTree.file_name);
|
||||
|
||||
DisablePABCRtlIfUsingDotnet5(directives);
|
||||
|
||||
AddReferencesToSystemUnits(compilationUnit, directives);
|
||||
if (CompilerOptions.UseDllForSystemUnits)
|
||||
{
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\PABCRtl.dll", null, "."));
|
||||
AddReferencesToNetSystemLibraries(compilationUnit, directives);
|
||||
}
|
||||
|
||||
var referenceDirectives = new List<compiler_directive>();
|
||||
foreach (compiler_directive directive in directives)
|
||||
|
|
@ -3095,15 +3104,15 @@ namespace PascalABCCompiler
|
|||
throw new CommonCompilerError(ex.Message, compilationUnit.SyntaxTree.file_name, reference.location.begin_line_num, reference.location.end_line_num);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var reference in referenceDirectives)
|
||||
CompileReference(dlls, reference);
|
||||
|
||||
return dlls;
|
||||
}
|
||||
|
||||
private void AddReferencesToSystemUnits(CompilationUnit compilationUnit, List<compiler_directive> directives)
|
||||
private void DisablePABCRtlIfUsingDotnet5(List<compiler_directive> directives)
|
||||
{
|
||||
foreach (compiler_directive cd in directives)
|
||||
{
|
||||
|
|
@ -3113,31 +3122,58 @@ namespace PascalABCCompiler
|
|||
CompilerOptions.UseDllForSystemUnits = false;
|
||||
}
|
||||
}
|
||||
if (CompilerOptions.UseDllForSystemUnits)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавляет ссылки на стандартные системные dll .NET - версия с директивами уровня семантики
|
||||
/// </summary>
|
||||
/// <param name="compilationUnit"></param>
|
||||
/// <param name="directives"></param>
|
||||
private void AddReferencesToNetSystemLibraries(CompilationUnit compilationUnit, List<TreeRealization.compiler_directive> directives)
|
||||
{
|
||||
IEnumerable<string> librariesToAdd = StringConstants.netSystemLibraries.Select(dll => $"%GAC%\\{dll}")
|
||||
.Except(directives.Where(directive => directive.name.Equals("reference", StringComparison.CurrentCultureIgnoreCase))
|
||||
.Select(directive => directive.directive), StringComparer.CurrentCultureIgnoreCase);
|
||||
|
||||
directives.AddRange(librariesToAdd.Select(dll => new compiler_directive("reference", dll, null, ".")));
|
||||
|
||||
if (compilationUnit.SyntaxTree is SyntaxTree.program_module program && program.used_units != null)
|
||||
{
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\PABCRtl.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\mscorlib.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\System.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\System.Core.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\System.Numerics.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\System.Windows.Forms.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\System.Drawing.dll", null, "."));
|
||||
|
||||
if (compilationUnit.SyntaxTree is SyntaxTree.program_module && (compilationUnit.SyntaxTree as SyntaxTree.program_module).used_units != null)
|
||||
var graph3DUnit = program.used_units.units.FirstOrDefault(u => u.name.ToString() == "Graph3D");
|
||||
if (graph3DUnit != null)
|
||||
{
|
||||
foreach (SyntaxTree.unit_or_namespace usedUnit in (compilationUnit.SyntaxTree as SyntaxTree.program_module).used_units.units)
|
||||
{
|
||||
if (usedUnit.name.ToString() == "Graph3D")
|
||||
{
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\PresentationFramework.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\WindowsBase.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\PresentationCore.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\HelixToolkit.Wpf.dll", null, "."));
|
||||
directives.Add(new compiler_directive("reference", "%GAC%\\HelixToolkit.dll", null, "."));
|
||||
IEnumerable<string> graphLibrariesToAdd = StringConstants.graph3DDependencies.Select(dll => $"%GAC%\\{dll}")
|
||||
.Except(directives.Where(directive => directive.name.Equals("reference", StringComparison.CurrentCultureIgnoreCase))
|
||||
.Select(directive => directive.directive), StringComparer.CurrentCultureIgnoreCase);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
directives.AddRange(graphLibrariesToAdd.Select(dll => new compiler_directive("reference", dll, null, ".")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавляет ссылки на стандартные системные dll .NET - версия с директивами уровня синтаксиса
|
||||
/// </summary>
|
||||
/// <param name="compilationUnit"></param>
|
||||
/// <param name="directives"></param>
|
||||
private void AddReferencesToNetSystemLibraries(CompilationUnit compilationUnit, List<SyntaxTree.compiler_directive> directives)
|
||||
{
|
||||
IEnumerable<string> librariesToAdd = StringConstants.netSystemLibraries.Select(dll => $"%GAC%\\{dll}")
|
||||
.Except(directives.Where(directive => directive.Name.text.Equals("reference", StringComparison.CurrentCultureIgnoreCase))
|
||||
.Select(directive => directive.Directive.text), StringComparer.CurrentCultureIgnoreCase);
|
||||
|
||||
directives.AddRange(librariesToAdd.Select(dll => new SyntaxTree.compiler_directive(new SyntaxTree.token_info("reference"), new SyntaxTree.token_info(dll))));
|
||||
|
||||
if (compilationUnit.SyntaxTree is SyntaxTree.program_module program && program.used_units != null)
|
||||
{
|
||||
var graph3DUnit = program.used_units.units.FirstOrDefault(u => u.name.ToString() == "Graph3D");
|
||||
if (graph3DUnit != null)
|
||||
{
|
||||
IEnumerable<string> graphLibrariesToAdd = StringConstants.graph3DDependencies.Select(dll => $"%GAC%\\{dll}")
|
||||
.Except(directives.Where(directive => directive.Name.text.Equals("reference", StringComparison.CurrentCultureIgnoreCase))
|
||||
.Select(directive => directive.Directive.text), StringComparer.CurrentCultureIgnoreCase);
|
||||
|
||||
directives.AddRange(graphLibrariesToAdd.Select(dll => new SyntaxTree.compiler_directive(new SyntaxTree.token_info("reference"), new SyntaxTree.token_info(dll))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3317,19 +3353,16 @@ namespace PascalABCCompiler
|
|||
/// </summary>
|
||||
public static bool IsDll(SyntaxTree.compilation_unit unitSyntaxTree, out SyntaxTree.compiler_directive dllDirective)
|
||||
{
|
||||
if (unitSyntaxTree != null)
|
||||
foreach (SyntaxTree.compiler_directive directive in unitSyntaxTree.compiler_directives)
|
||||
{
|
||||
foreach (SyntaxTree.compiler_directive directive in unitSyntaxTree.compiler_directives)
|
||||
if (string.Equals(directive.Name.text, StringConstants.compiler_directive_apptype, StringComparison.CurrentCultureIgnoreCase)
|
||||
&& string.Equals(directive.Directive.text, "dll", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
if (string.Equals(directive.Name.text, "apptype", StringComparison.CurrentCultureIgnoreCase)
|
||||
&& string.Equals(directive.Directive.text, "dll", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
dllDirective = directive;
|
||||
return true;
|
||||
}
|
||||
dllDirective = directive;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dllDirective = null;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -3382,7 +3415,7 @@ namespace PascalABCCompiler
|
|||
return currentUnit;
|
||||
|
||||
// нет pcu и модуль не откомпилирован => новый модуль EVA
|
||||
InitializeNewUnit(unitFileName, unitId, ref currentUnit, ref docs);
|
||||
InitializeNewUnit(unitFileName, unitId, ref currentUnit, out docs);
|
||||
}
|
||||
|
||||
// формирование списков зависимостей текущего модуля (uses list, dll, пространства имен)
|
||||
|
|
@ -3730,7 +3763,7 @@ namespace PascalABCCompiler
|
|||
/// генерация синтаксического дерева,
|
||||
/// обработка синтаксических ошибок
|
||||
/// </summary>
|
||||
private void InitializeNewUnit(string unitFileName, string UnitId, ref CompilationUnit currentUnit, ref Dictionary<SyntaxTree.syntax_tree_node, string> docs)
|
||||
private void InitializeNewUnit(string unitFileName, string UnitId, ref CompilationUnit currentUnit, out Dictionary<SyntaxTree.syntax_tree_node, string> docs)
|
||||
{
|
||||
currentUnit = new CompilationUnit();
|
||||
if (firstCompilationUnit == null)
|
||||
|
|
@ -3741,28 +3774,76 @@ namespace PascalABCCompiler
|
|||
// запоминание языка
|
||||
currentUnit.Language = LanguageProvider.SelectLanguageByExtension(unitFileName);
|
||||
|
||||
OnChangeCompilerState(this, CompilerState.BeginCompileFile, unitFileName); // начало компиляции модуля
|
||||
currentUnit.CaseSensitive = currentUnit.Language.CaseSensitive;
|
||||
|
||||
// получение итогового синтаксического дерева после сахарных преобразований
|
||||
ConstructSyntaxTreeAndRunSugarConversions(unitFileName, currentUnit, out docs);
|
||||
|
||||
#region SYNTAX TREE CONSTRUCTING
|
||||
InitializeCompilerOptionsRelatedToStandardUnits(currentUnit.SyntaxTree);
|
||||
|
||||
RunSemanticChecks(unitFileName, currentUnit);
|
||||
|
||||
// местоположение этой строчки важно, потому что проверяется UnitTable.Count > 0 выше EVA
|
||||
UnitTable[UnitId] = currentUnit;
|
||||
|
||||
// здесь добавляем стандартные модули в секцию uses интерфейса
|
||||
if (!CompilerOptions.DisableStandardUnits)
|
||||
AddStandardUnitsToInterfaceUsesSection(currentUnit);
|
||||
else
|
||||
{
|
||||
AddReferencesToNetSystemLibraries(currentUnit, currentUnit.SyntaxTree.compiler_directives);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Строит синтаксическое дерево, бросает первую из найденных ошибок (если они есть) и запускает сахарные преобразования
|
||||
/// </summary>
|
||||
private void ConstructSyntaxTreeAndRunSugarConversions(string unitFileName, CompilationUnit currentUnit, out Dictionary<SyntaxTree.syntax_tree_node, string> docs)
|
||||
{
|
||||
OnChangeCompilerState(this, CompilerState.BeginCompileFile, unitFileName); // начало компиляции модуля
|
||||
|
||||
// получение синтаксического дерева
|
||||
string sourceText = GetSourceCode(unitFileName, currentUnit);
|
||||
|
||||
currentUnit.SyntaxTree = ConstructSyntaxTree(unitFileName, currentUnit, sourceText);
|
||||
#endregion
|
||||
|
||||
if (currentUnit.SyntaxTree is SyntaxTree.unit_module)
|
||||
CompilerOptions.UseDllForSystemUnits = false;
|
||||
// сопоставление нодам ошибок EVA
|
||||
MatchSyntaxErrorsToBadNodes(currentUnit);
|
||||
|
||||
if (errorsList.Count == 0) // SSM 2/05/16 - для преобразования синтаксических деревьев извне (синтаксический сахар)
|
||||
{
|
||||
currentUnit.SyntaxTree = ConvertSyntaxTree(currentUnit.SyntaxTree, currentUnit.Language.SyntaxTreeConverters);
|
||||
}
|
||||
CheckErrorsAndThrowTheFirstOne();
|
||||
|
||||
// SSM 2/05/16 - для преобразования синтаксических деревьев извне (синтаксический сахар)
|
||||
currentUnit.SyntaxTree = ConvertSyntaxTree(currentUnit.SyntaxTree, currentUnit.Language.SyntaxTreeConverters);
|
||||
|
||||
// генерация документации к узлам синтаксического дерева EVA
|
||||
docs = GenUnitDocumentation(currentUnit, sourceText);
|
||||
}
|
||||
|
||||
#region SEMANTIC CHECKS : DIRECTIVES AND OUTPUT FILE TYPE
|
||||
/// <summary>
|
||||
/// Устанавливает значения опций DisableStandardUnits и UseDllForSystemUnits
|
||||
/// </summary>
|
||||
private void InitializeCompilerOptionsRelatedToStandardUnits(SyntaxTree.compilation_unit unitSyntaxTree)
|
||||
{
|
||||
// проверяем только для основной программы или dll
|
||||
if (UnitTable.Count == 0)
|
||||
{
|
||||
var disableStandardUnitsDirective = unitSyntaxTree.compiler_directives.Find(directive =>
|
||||
directive.Name.text.Equals(StringConstants.compiler_directive_disable_standard_units, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
if (disableStandardUnitsDirective != null)
|
||||
CompilerOptions.DisableStandardUnits = true;
|
||||
}
|
||||
|
||||
if (unitSyntaxTree is SyntaxTree.unit_module)
|
||||
CompilerOptions.UseDllForSystemUnits = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Семантические проверки по директивам и по типу файла
|
||||
/// </summary>
|
||||
private void RunSemanticChecks(string unitFileName, CompilationUnit currentUnit)
|
||||
{
|
||||
// SSM 21/05/20 Проверка, что мы не записали apptype dll в небиблиотеку
|
||||
bool isDll = IsDll(currentUnit.SyntaxTree, out var dllDirective);
|
||||
SemanticCheckDLLDirectiveOnlyForLibraries(currentUnit.SyntaxTree, isDll, dllDirective);
|
||||
|
|
@ -3772,30 +3853,10 @@ namespace PascalABCCompiler
|
|||
|
||||
// ошибка директива include в паскалевском юните
|
||||
SemanticCheckNoIncludeNamespaceDirectivesInUnit(currentUnit);
|
||||
#endregion
|
||||
|
||||
if (isDll)
|
||||
CompilerOptions.OutputFileType = CompilerOptions.OutputType.ClassLibrary; // есть также в конце Compile
|
||||
|
||||
currentUnit.CaseSensitive = currentUnit.Language.CaseSensitive;
|
||||
|
||||
// currentUnit.SyntaxUnitName = currentUnitNode;
|
||||
|
||||
// сопоставление нодам ошибок EVA
|
||||
MatchErrorsToBadNodes(currentUnit);
|
||||
SemanticCheckDisableStandardUnitsDirectiveInUnit(currentUnit.SyntaxTree);
|
||||
|
||||
CheckErrorsAndThrowTheFirstOne();
|
||||
|
||||
// местоположение этой строчки важно, потому что проверяется UnitTable.Count > 0 выше EVA
|
||||
UnitTable[UnitId] = currentUnit;
|
||||
|
||||
// здесь добавляем стандартные модули в секцию uses интерфейса
|
||||
#if DEBUG
|
||||
if (InternalDebug.AddStandartUnits)
|
||||
#endif
|
||||
AddStandardUnitsToInterfaceUsesSection(currentUnit);
|
||||
|
||||
currentUnit.possibleNamespaces.Clear();
|
||||
}
|
||||
|
||||
private SyntaxTree.compilation_unit ConvertSyntaxTree(SyntaxTree.compilation_unit syntaxTree, List<ISyntaxTreeConverter> converters)
|
||||
|
|
@ -3833,7 +3894,7 @@ namespace PascalABCCompiler
|
|||
}
|
||||
}
|
||||
|
||||
private void MatchErrorsToBadNodes(CompilationUnit currentUnit)
|
||||
private void MatchSyntaxErrorsToBadNodes(CompilationUnit currentUnit)
|
||||
{
|
||||
if (errorsList.Count > 0)
|
||||
{
|
||||
|
|
@ -3851,7 +3912,7 @@ namespace PascalABCCompiler
|
|||
private void SemanticCheckDLLDirectiveOnlyForLibraries(SyntaxTree.compilation_unit unitSyntaxTree, bool isDll, SyntaxTree.compiler_directive dllDirective)
|
||||
{
|
||||
// Если Library и apptype dll не указано, то никакой ошибки нет EVA
|
||||
if (unitSyntaxTree != null && isDll)
|
||||
if (isDll)
|
||||
{
|
||||
if (!(unitSyntaxTree is SyntaxTree.unit_module) ||
|
||||
(unitSyntaxTree is SyntaxTree.unit_module unitNode && unitNode.unit_name.HeaderKeyword != SyntaxTree.UnitHeaderKeyword.Library))
|
||||
|
|
@ -3862,6 +3923,25 @@ namespace PascalABCCompiler
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ошибка указания директивы DisableStandardUnits в подключенном модулей
|
||||
/// </summary>
|
||||
///
|
||||
private void SemanticCheckDisableStandardUnitsDirectiveInUnit(SyntaxTree.compilation_unit unitSyntaxTree)
|
||||
{
|
||||
// проверяем для используемых модулей
|
||||
if (UnitTable.Count > 0)
|
||||
{
|
||||
var foundDirective = unitSyntaxTree.compiler_directives.Find(directive =>
|
||||
directive.Name.text.Equals(StringConstants.compiler_directive_disable_standard_units, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
if (foundDirective != null)
|
||||
{
|
||||
ErrorsList.Add(new DisableStandardUnitsDirectiveDisallowedInUsedUnits(unitSyntaxTree.file_name, foundDirective.source_context));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SyntaxTree.compilation_unit ConstructSyntaxTree(string unitFileName, CompilationUnit currentUnit, string sourceText)
|
||||
{
|
||||
List<string> DefinesList = new List<string> { "PASCALABC" };
|
||||
|
|
@ -3919,7 +3999,7 @@ namespace PascalABCCompiler
|
|||
{
|
||||
Dictionary<SyntaxTree.syntax_tree_node, string> docs = null;
|
||||
|
||||
if (errorsList.Count == 0 && IsDocumentationNeeded(currentUnit.SyntaxTree))
|
||||
if (IsDocumentationNeeded(currentUnit.SyntaxTree))
|
||||
{
|
||||
if (SourceText != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,6 +85,18 @@ namespace PascalABCCompiler.Errors
|
|||
}
|
||||
}
|
||||
|
||||
/// <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>
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ namespace Languages.Pascal.Frontend.Wrapping
|
|||
[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),
|
||||
|
|
|
|||
|
|
@ -317,33 +317,34 @@ namespace PascalABCCompiler
|
|||
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";
|
||||
|
|
@ -372,6 +373,10 @@ namespace PascalABCCompiler
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace VisualPascalABCPlugins
|
|||
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;
|
||||
|
|
@ -119,7 +119,7 @@ namespace VisualPascalABCPlugins
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}' не поддерживается
|
||||
|
|
|
|||
Loading…
Reference in a new issue