2024-05-25 12:26:32 +03:00
|
|
|
// 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 System.Collections.Generic;
|
|
|
|
|
using Languages.Facade;
|
|
|
|
|
using PascalABCCompiler;
|
|
|
|
|
using PascalABCCompiler.SyntaxTreeConverters;
|
|
|
|
|
using PascalABCCompiler.SystemLibrary;
|
|
|
|
|
using PascalABCCompiler.TreeConverter;
|
|
|
|
|
|
|
|
|
|
namespace Languages.Pascal
|
|
|
|
|
{
|
2024-07-02 16:10:50 +03:00
|
|
|
public class PascalABCLanguage : BaseLanguage
|
2024-05-25 12:26:32 +03:00
|
|
|
{
|
|
|
|
|
|
2024-07-02 16:10:50 +03:00
|
|
|
public PascalABCLanguage() : base(
|
2024-05-25 12:26:32 +03:00
|
|
|
name: StringConstants.pascalLanguageName,
|
|
|
|
|
version: "1.2",
|
|
|
|
|
copyright: "Copyright © 2005-2024 by Ivan Bondarev, Stanislav Mikhalkovich",
|
|
|
|
|
|
|
|
|
|
parser: new Frontend.Wrapping.PascalABCNewLanguageParser(),
|
|
|
|
|
docParser: new Frontend.Documentation.PascalDocTagsLanguageParser(),
|
|
|
|
|
|
|
|
|
|
syntaxTreeConverters: new List<ISyntaxTreeConverter>() { new Frontend.Converters.StandardSyntaxTreeConverter(), new SyntaxSemanticVisitors.LambdaAnyConverter() },
|
|
|
|
|
syntaxTreeToSemanticTreeConverter: new syntax_tree_visitor(),
|
|
|
|
|
|
|
|
|
|
filesExtensions: new string[] { StringConstants.pascalSourceFileExtension },
|
|
|
|
|
caseSensitive: false,
|
|
|
|
|
systemUnitNames: StringConstants.pascalDefaultStandardModules
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void SetSemanticConstants()
|
|
|
|
|
{
|
|
|
|
|
SemanticRulesConstants.ClassBaseType = SystemLibrary.object_type;
|
|
|
|
|
SemanticRulesConstants.StructBaseType = SystemLibrary.value_type;
|
|
|
|
|
SemanticRulesConstants.AddResultVariable = true;
|
|
|
|
|
SemanticRulesConstants.ZeroBasedStrings = false;
|
|
|
|
|
SemanticRulesConstants.FastStrings = false;
|
|
|
|
|
SemanticRulesConstants.InitStringAsEmptyString = true;
|
|
|
|
|
SemanticRulesConstants.UseDivisionAssignmentOperatorsForIntegerTypes = false;
|
|
|
|
|
SemanticRulesConstants.ManyVariablesOneInitializator = false;
|
|
|
|
|
SemanticRulesConstants.OrderIndependedMethodNames = true;
|
|
|
|
|
SemanticRulesConstants.OrderIndependedFunctionNames = false;
|
|
|
|
|
SemanticRulesConstants.OrderIndependedTypeNames = false;
|
|
|
|
|
SemanticRulesConstants.EnableExitProcedure = true;
|
|
|
|
|
SemanticRulesConstants.StrongPointersTypeCheckForDotNet = true;
|
|
|
|
|
SemanticRulesConstants.AllowChangeLoopVariable = false;
|
|
|
|
|
SemanticRulesConstants.AllowGlobalVisibilityForPABCDll = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SetSyntaxTreeToSemanticTreeConverter()
|
|
|
|
|
{
|
|
|
|
|
SyntaxTreeToSemanticTreeConverter = new syntax_tree_visitor();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|