pascalabcnet/LanguageIntegrator/BaseLanguage.cs
AlexanderZemlyak 7a59245eaf
Language interface change (#3356)
* Move standard language info assigning to LanguageInformation classes

* Move Language name in compilation_unit.Language variable assigning in BaseParser

* Documentation update
2025-11-07 20:43:29 +03:00

59 lines
2.3 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(ILanguageInformation languageInformation,
IParser parser, IDocParser docParser, List<ISyntaxTreeConverter> syntaxTreeConverters)
{
this.LanguageInformation = languageInformation;
this.Parser = parser;
this.Parser.LanguageInformation = languageInformation;
this.DocParser = docParser;
this.SyntaxTreeConverters = syntaxTreeConverters;
}
public string Name => LanguageInformation.Name;
public string Version => LanguageInformation.Version;
public string Copyright => LanguageInformation.Copyright;
public string[] FilesExtensions => LanguageInformation.FilesExtensions;
public bool CaseSensitive => LanguageInformation.CaseSensitive;
public string[] SystemUnitNames => LanguageInformation.SystemUnitNames;
public virtual ILanguageInformation LanguageInformation { get; }
public virtual IParser Parser { get; protected set; }
public virtual IDocParser DocParser { get; protected set; }
public virtual List<ISyntaxTreeConverter> SyntaxTreeConverters { get; protected set; }
public bool ApplySyntaxTreeConvertersForIntellisense => LanguageInformation.ApplySyntaxTreeConvertersForIntellisense;
public virtual syntax_tree_visitor SyntaxTreeToSemanticTreeConverter { get; protected set; }
public abstract void SetSemanticConstants();
public abstract void SetSyntaxTreeToSemanticTreeConverter();
}
}