* Tidy up first part of compiler code * Rename Net Compiler Options * Move CompilationErrors to Errors project * Return default constructor to compiler warning * Rename semantic check for include namespaces in unit * Create two Errors files instead of one in Errors project * Fix current unit is not main program check * Add documentation to compilation errors in Errors project * Return compiler thrown errors to Compiler project * Refactor keywords class - extract base keywords functionality * Fix keywords case sensitivity * Fix case sensitivity again... * Optimize keywords initialization * Fix parse expression error because of wrong constructor call
61 lines
2.5 KiB
C#
61 lines
2.5 KiB
C#
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||
|
||
using PascalABCCompiler.Parsers;
|
||
using System.Collections.Generic;
|
||
using PascalABCCompiler.SyntaxTreeConverters;
|
||
using PascalABCCompiler.TreeConverter;
|
||
|
||
namespace Languages.Facade
|
||
{
|
||
/// <summary>
|
||
/// Базовый класс языка программирования, поддерживаемого платформой
|
||
/// </summary>
|
||
public abstract class BaseLanguage : ILanguage
|
||
{
|
||
|
||
/// <summary>
|
||
/// Все параметры должны быть не null (и не пустым массивом), кроме IDocParser в случае, если он не требуется
|
||
/// </summary>
|
||
public BaseLanguage(string name, string version, string copyright, IParser parser, IDocParser docParser,
|
||
List<ISyntaxTreeConverter> syntaxTreeConverters, syntax_tree_visitor syntaxTreeToSemanticTreeConverter,
|
||
string[] filesExtensions, bool caseSensitive, string[] systemUnitNames)
|
||
{
|
||
this.Name = name;
|
||
this.Version = version;
|
||
this.Copyright = copyright;
|
||
this.Parser = parser;
|
||
this.DocParser = docParser;
|
||
this.SyntaxTreeConverters = syntaxTreeConverters;
|
||
this.SyntaxTreeToSemanticTreeConverter = syntaxTreeToSemanticTreeConverter;
|
||
this.FilesExtensions = filesExtensions;
|
||
this.CaseSensitive = caseSensitive;
|
||
this.SystemUnitNames = systemUnitNames;
|
||
}
|
||
|
||
public virtual string Name { get; protected set; }
|
||
|
||
public virtual string Version { get; protected set; }
|
||
|
||
public virtual string Copyright { get; protected set; }
|
||
|
||
public virtual IParser Parser { get; protected set; }
|
||
|
||
public virtual IDocParser DocParser { get; protected set; }
|
||
|
||
public virtual List<ISyntaxTreeConverter> SyntaxTreeConverters { get; protected set; }
|
||
|
||
public virtual syntax_tree_visitor SyntaxTreeToSemanticTreeConverter { get; protected set; }
|
||
|
||
public virtual string[] FilesExtensions { get; protected set; }
|
||
|
||
public virtual bool CaseSensitive { get; protected set; }
|
||
|
||
public virtual string[] SystemUnitNames { get; protected set; }
|
||
|
||
public abstract void SetSemanticConstants();
|
||
|
||
public abstract void SetSyntaxTreeToSemanticTreeConverter();
|
||
}
|
||
}
|