pascalabcnet/LanguageIntegrator/BaseLanguage.cs
AlexanderZemlyak 97c29a4e1b
Compiler tiding up, refactoring Keywords class and uniting errors in Errors file (#3179)
* 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
2024-07-13 18:44:49 +03:00

61 lines
2.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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();
}
}