Изменил подключение стандартных синтаксических конвертеров - сделал его явным

This commit is contained in:
miks1965 2017-01-12 13:50:31 +03:00
parent 67b9159df5
commit ce9188f0ca
9 changed files with 27 additions and 32 deletions

View file

@ -142,6 +142,10 @@
<Project>{613E0DDA-AA8A-437C-AC45-507B47429FF9}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
</ProjectReference>
<ProjectReference Include="..\StandardSyntaxTreeConverter\StandardSyntaxTreeConverter.csproj">
<Project>{4d36d4ce-56fd-4bec-b846-d54b3a39ffd5}</Project>
<Name>StandardSyntaxTreeConverter</Name>
</ProjectReference>
<ProjectReference Include="..\SyntaxTreeConverters\SyntaxTreeConverters.csproj">
<Project>{f10a5330-dcf4-4533-877c-7b1b1be23884}</Project>
<Name>SyntaxTreeConverters</Name>

View file

@ -40,7 +40,11 @@ namespace PascalABCCompiler.SemanticTreeConverters
private void AddConverters(string DirectoryName)
{
DirectoryInfo di = new DirectoryInfo(DirectoryName);
FileInfo[] dllfiles = di.GetFiles("*Conversion.dll");
// динамически подключаемые конверторы. Не очень устойчивая конструкция!!!
// Делается это для ликвидации зависимости от семантического уровня - это понятно
// Но - должен быть другой - нормальный - путь
FileInfo[] dllfiles = di.GetFiles("*Conversion.dll");
System.Reflection.Assembly assembly = null;
ISemanticTreeConverter Converter;
foreach (FileInfo fi in dllfiles)

View file

@ -7,6 +7,7 @@ using System.Text;
using System.IO;
using PascalABCCompiler.SyntaxTree;
using PascalABCCompiler.Errors;
using PascalABCCompiler.SyntaxTreeConverters;
namespace PascalABCCompiler.SyntaxTreeConverters
{
@ -36,17 +37,23 @@ namespace PascalABCCompiler.SyntaxTreeConverters
this.Compiler = Compiler;
}
public void AddStandardConverters()
{
var st = new StandardSyntaxTreeConverter();
syntaxTreeConverters.Add(st);
}
public void AddConverters()
{
AddConverters(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName));
AddStandardConverters();
AddExternalConvertersAsPlugins(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName));
}
private void AddConverters(string DirectoryName)
private void AddExternalConvertersAsPlugins(string DirectoryName)
{
DirectoryInfo di = new DirectoryInfo(DirectoryName);
List<FileInfo> dllfiles = di.GetFiles("*ConversionSyntax.dll").ToList();
List<FileInfo> standartdllfile = di.GetFiles("StandardSyntaxTreeConverter.dll").ToList();
if (standartdllfile.Count>0)
dllfiles.Insert(0, standartdllfile[0]);
List<FileInfo> dllfiles = di.GetFiles("*ConversionSyntax.dll").ToList(); // Это только YieldConversionSyntax.dll
//List<FileInfo> standartdllfile = di.GetFiles("StandardSyntaxTreeConverter.dll").ToList();
//if (standartdllfile.Count>0)
// dllfiles.Insert(0, standartdllfile[0]);
//dllfiles.Insert(0,new FileInfo("StandardSyntaxTreeConverter.dll"));
System.Reflection.Assembly assembly = null;

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "2";
public const string Build = "0";
public const string Revision = "1373";
public const string Revision = "1374";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=0
%REVISION%=1373
%MINOR%=2
%REVISION%=1374
%COREVERSION%=0
%MAJOR%=3

View file

@ -1 +1 @@
!define VERSION '3.2.0.1373'
!define VERSION '3.2.0.1374'

View file

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PascalABCCompiler.SyntaxTree;
namespace PascalABCCompiler.SyntaxTreeConverters
{
class StandardSyntaxTreeConverter: ISyntaxTreeConverter
{
public string Name { get; } = "Standard";
public syntax_tree_node Convert(syntax_tree_node root)
{
FillParentNodeVisitor.New.ProcessNode(root); // прошивание ссылками на Parent nodes. Должно идти первым
StandOutExprWithLambdaInForeachSequenceVisitor.New.ProcessNode(root); // выносим выражения с лямбдами из заголовка foreach
return root;
}
}
}

View file

@ -40,7 +40,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StandardSyntaxConverters.cs" />
<Compile Include="StandardSyntaxConverter.cs" />
<Compile Include="StandOutExprWithLambdaInForeachSequenceConverter.cs" />
</ItemGroup>
<ItemGroup>

Binary file not shown.