New checks for directives added (#3099)
* Extract base classes from ParserTools (local) and GPPGParserHelper * Fix string resources error * Extract base class for unexpected token error * Update ParserTools project file * Add comments for compiler directives usages in compiler * Add directives checks * Move string constants to new project * Implement scalable directives checks * Remove known directives from compiler * Fix PABCSystem namespace error * Allow region and endregion with no params * Allow parameters to endif directive * Delete directive parameters extension checks * Replace error with warning for uknown directive case * Fix generate native code (semantic rule) assigning * Improve error messages for directives * Rename RunParseThread to SwitchOnIntellisence Для отладки может требоваться отключение Intellisence на уровне кода. Для понятности метод назван SwitchOnIntellisence. * Resolve merge conflicts * Add new compiler errors for unsupported target framework and output file type * Add documentation to directives checks * Fix directives check loop
This commit is contained in:
parent
769212192f
commit
efb4a4338f
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -46,6 +46,7 @@
|
|||
**/OptimizerConversion.dll
|
||||
**/PABCRtl.dll
|
||||
**/LanguageIntegrator.dll
|
||||
**/StringConstants.dll
|
||||
**/ParserTools.dll
|
||||
**/PascalABCParser.dll
|
||||
**/PluginsSupport.dll
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ namespace CodeCompletion
|
|||
|
||||
public class CodeCompletionNameHelper
|
||||
{
|
||||
public static readonly string system_unit_file_name = PascalABCCompiler.TreeConverter.compiler_string_consts.pascalSystemUnitName;
|
||||
public static readonly string system_unit_file_name = PascalABCCompiler.StringConstants.pascalSystemUnitName;
|
||||
public static string system_unit_file_full_name;
|
||||
private static CodeCompletionNameHelper helper;
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@
|
|||
<Project>{613E0DDA-AA8A-437C-AC45-507B47429FF9}</Project>
|
||||
<Name>SemanticTree</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\StringConstants\StringConstants.csproj">
|
||||
<Project>{e8aefbf9-0113-4fa4-be45-6cda555498b7}</Project>
|
||||
<Name>StringConstants</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj">
|
||||
<Project>{C2CAC65A-B2AE-4CCC-B067-E6B8E75DF73A}</Project>
|
||||
<Name>SyntaxTree</Name>
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace CodeCompletion
|
|||
foreach (string s in files)
|
||||
{
|
||||
string fname = Path.GetFileNameWithoutExtension(s);
|
||||
if (fname == "__RedirectIOMode" || fname == "__RunMode" || fname == compiler_string_consts.pascalExtensionsUnitName)
|
||||
if (fname == "__RedirectIOMode" || fname == "__RunMode" || fname == StringConstants.pascalExtensionsUnitName)
|
||||
continue;
|
||||
SymInfo si = new SymInfo(Path.GetFileNameWithoutExtension(s), SymbolKind.Namespace, null);
|
||||
si.IsUnitNamespace = true;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ using System.IO;
|
|||
using PascalABCCompiler.SyntaxTree;
|
||||
using System.Reflection;
|
||||
using PascalABCCompiler;
|
||||
using PascalABCCompiler.TreeConverter;
|
||||
using PascalABCCompiler.TreeRealization;
|
||||
using PascalABCCompiler.Parsers;
|
||||
|
||||
|
|
@ -612,7 +611,7 @@ namespace CodeCompletion
|
|||
case Operators.BitwiseNOT:
|
||||
ev.EvalNot(); break;
|
||||
case Operators.LogicalNOT:
|
||||
ev.EvalNot(); returned_scope = entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name); break;
|
||||
ev.EvalNot(); returned_scope = entry_scope.FindName(StringConstants.bool_type_name); break;
|
||||
case Operators.Minus:
|
||||
ev.EvalUnmin(); break;
|
||||
}
|
||||
|
|
@ -652,19 +651,19 @@ namespace CodeCompletion
|
|||
|
||||
public override void visit(bool_const _bool_const)
|
||||
{
|
||||
returned_scope = TypeTable.bool_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name);
|
||||
returned_scope = TypeTable.bool_type;//entry_scope.FindName(StringConstants.bool_type_name);
|
||||
cnst_val.prim_val = _bool_const.val;
|
||||
}
|
||||
|
||||
public override void visit(int32_const _int32_const)
|
||||
{
|
||||
returned_scope = TypeTable.int_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name);
|
||||
returned_scope = TypeTable.int_type;//entry_scope.FindName(StringConstants.integer_type_name);
|
||||
cnst_val.prim_val = _int32_const.val;
|
||||
}
|
||||
|
||||
public override void visit(double_const _double_const)
|
||||
{
|
||||
returned_scope = TypeTable.real_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name);
|
||||
returned_scope = TypeTable.real_type;//entry_scope.FindName(StringConstants.real_type_name);
|
||||
cnst_val.prim_val = _double_const.val;
|
||||
}
|
||||
|
||||
|
|
@ -925,7 +924,7 @@ namespace CodeCompletion
|
|||
|
||||
public override void visit(string_const _string_const)
|
||||
{
|
||||
returned_scope = TypeTable.string_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name);
|
||||
returned_scope = TypeTable.string_type;//entry_scope.FindName(StringConstants.string_type_name);
|
||||
//cnst_val.prim_val = "'"+_string_const.Value+"'";
|
||||
cnst_val.prim_val = this.converter.controller.Parser.LanguageInformation.GetStringForString(_string_const.Value);
|
||||
}
|
||||
|
|
@ -1222,7 +1221,7 @@ namespace CodeCompletion
|
|||
indexes.Add(null);
|
||||
}
|
||||
}
|
||||
else indexes.Add((TypeScope)entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name));
|
||||
else indexes.Add((TypeScope)entry_scope.FindName(StringConstants.integer_type_name));
|
||||
TypeScope ts = of_type as TypeScope;
|
||||
if (of_type is ProcScope)
|
||||
ts = new ProcType(of_type as ProcScope);
|
||||
|
|
@ -2635,7 +2634,7 @@ namespace CodeCompletion
|
|||
is_system_unit = true;
|
||||
add_standart_types(entry_scope);
|
||||
}
|
||||
if (_unit_module.unit_name.idunit_name.name == PascalABCCompiler.TreeConverter.compiler_string_consts.pascalExtensionsUnitName)
|
||||
if (_unit_module.unit_name.idunit_name.name == StringConstants.pascalExtensionsUnitName)
|
||||
{
|
||||
is_extensions_unit = true;
|
||||
}
|
||||
|
|
@ -2731,7 +2730,7 @@ namespace CodeCompletion
|
|||
entry_scope.AddUsedUnit(dc.visitor.entry_scope);
|
||||
add_standart_types(dc.visitor.entry_scope);
|
||||
//get_standart_types(dc.stv);
|
||||
entry_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.pascalSystemUnitName,dc.visitor.entry_scope);
|
||||
entry_scope.AddName(StringConstants.pascalSystemUnitName,dc.visitor.entry_scope);
|
||||
}
|
||||
CodeCompletionController.comp_modules[unit_name] = dc;
|
||||
|
||||
|
|
@ -2741,14 +2740,14 @@ namespace CodeCompletion
|
|||
dc.visitor.entry_scope.InitAssemblies();
|
||||
entry_scope.AddUsedUnit(dc.visitor.entry_scope);
|
||||
//get_standart_types(dc.stv);
|
||||
entry_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.pascalSystemUnitName,dc.visitor.entry_scope);
|
||||
entry_scope.AddName(StringConstants.pascalSystemUnitName,dc.visitor.entry_scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void add_extensions_unit()
|
||||
{
|
||||
string unit_name = CodeCompletionNameHelper.FindSourceFileName(PascalABCCompiler.TreeConverter.compiler_string_consts.pascalExtensionsUnitName, out _);
|
||||
string unit_name = CodeCompletionNameHelper.FindSourceFileName(StringConstants.pascalExtensionsUnitName, out _);
|
||||
|
||||
if (unit_name != null)
|
||||
{
|
||||
|
|
@ -2761,7 +2760,7 @@ namespace CodeCompletion
|
|||
{
|
||||
dc.visitor.entry_scope.InitAssemblies();
|
||||
entry_scope.AddUsedUnit(dc.visitor.entry_scope);
|
||||
entry_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.pascalExtensionsUnitName, dc.visitor.entry_scope);
|
||||
entry_scope.AddName(StringConstants.pascalExtensionsUnitName, dc.visitor.entry_scope);
|
||||
}
|
||||
CodeCompletionController.comp_modules[unit_name] = dc;
|
||||
}
|
||||
|
|
@ -2769,7 +2768,7 @@ namespace CodeCompletion
|
|||
{
|
||||
dc.visitor.entry_scope.InitAssemblies();
|
||||
entry_scope.AddUsedUnit(dc.visitor.entry_scope);
|
||||
entry_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.pascalExtensionsUnitName, dc.visitor.entry_scope);
|
||||
entry_scope.AddName(StringConstants.pascalExtensionsUnitName, dc.visitor.entry_scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2874,9 +2873,9 @@ namespace CodeCompletion
|
|||
str += ".";
|
||||
|
||||
}
|
||||
if (string.Compare(str, PascalABCCompiler.TreeConverter.compiler_string_consts.system_unit_name, true) == 0)
|
||||
if (string.Compare(str, StringConstants.pascalSystemUnitNamespaceName, true) == 0)
|
||||
has_system_unit = true;
|
||||
if (string.Compare(str, PascalABCCompiler.TreeConverter.compiler_string_consts.pascalExtensionsUnitName, true) == 0)
|
||||
if (string.Compare(str, StringConstants.pascalExtensionsUnitName, true) == 0)
|
||||
has_extensions_unit = true;
|
||||
unl.AddElement(new PascalABCCompiler.TreeRealization.using_namespace(str));
|
||||
}
|
||||
|
|
@ -3075,138 +3074,138 @@ namespace CodeCompletion
|
|||
private void add_standart_types(SymScope cur_scope)
|
||||
{
|
||||
string type_name = null;
|
||||
//obj_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name),typeof(object));
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name,TypeTable.obj_type);
|
||||
//int_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name),typeof(int));
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name, int_type);
|
||||
//obj_type = new CompiledScope(new SymInfo(StringConstants.object_type_name, SymbolKind.Type,StringConstants.object_type_name),typeof(object));
|
||||
cur_scope.AddName(StringConstants.object_type_name,TypeTable.obj_type);
|
||||
//int_type = new CompiledScope(new SymInfo(StringConstants.integer_type_name, SymbolKind.Type,StringConstants.integer_type_name),typeof(int));
|
||||
//cur_scope.AddName(StringConstants.integer_type_name, int_type);
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.IntType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.int_type);
|
||||
//real_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name),typeof(double));
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name,real_type);
|
||||
//real_type = new CompiledScope(new SymInfo(StringConstants.real_type_name, SymbolKind.Type,StringConstants.real_type_name),typeof(double));
|
||||
//cur_scope.AddName(StringConstants.real_type_name,real_type);
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.DoubleType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.real_type);
|
||||
//string_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name, SymbolKind.Class,PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name),typeof(string));
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name,TypeTable.string_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name,
|
||||
//new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.ShortStringTypeName),typeof(string)));
|
||||
//char_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name),typeof(char));
|
||||
//string_type = new CompiledScope(new SymInfo(StringConstants.string_type_name, SymbolKind.Class,StringConstants.string_type_name),typeof(string));
|
||||
cur_scope.AddName(StringConstants.string_type_name,TypeTable.string_type);
|
||||
//cur_scope.AddName(StringConstants.string_type_name,
|
||||
//new CompiledScope(new SymInfo(StringConstants.string_type_name, SymbolKind.Type,StringConstants.ShortStringTypeName),typeof(string)));
|
||||
//char_type = new CompiledScope(new SymInfo(StringConstants.char_type_name, SymbolKind.Type,StringConstants.char_type_name),typeof(char));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.CharType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.char_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name,char_type);
|
||||
//bool_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name),typeof(bool));
|
||||
//cur_scope.AddName(StringConstants.char_type_name,char_type);
|
||||
//bool_type = new CompiledScope(new SymInfo(StringConstants.bool_type_name, SymbolKind.Type,StringConstants.bool_type_name),typeof(bool));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.BoolType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.bool_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name,bool_type);
|
||||
//byte_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name),typeof(byte));
|
||||
//cur_scope.AddName(StringConstants.bool_type_name,bool_type);
|
||||
//byte_type = new CompiledScope(new SymInfo(StringConstants.byte_type_name, SymbolKind.Type,StringConstants.byte_type_name),typeof(byte));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.ByteType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.byte_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name,byte_type);
|
||||
//int16_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name),typeof(short));
|
||||
//cur_scope.AddName(StringConstants.byte_type_name,byte_type);
|
||||
//int16_type = new CompiledScope(new SymInfo(StringConstants.short_type_name, SymbolKind.Type,StringConstants.short_type_name),typeof(short));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.ShortType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.int16_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name,int16_type);
|
||||
//sbyte_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name),typeof(sbyte));
|
||||
//cur_scope.AddName(StringConstants.short_type_name,int16_type);
|
||||
//sbyte_type = new CompiledScope(new SymInfo(StringConstants.sbyte_type_name, SymbolKind.Type,StringConstants.sbyte_type_name),typeof(sbyte));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.SByteType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.sbyte_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name,sbyte_type);
|
||||
//uint16_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name),typeof(ushort));
|
||||
//cur_scope.AddName(StringConstants.sbyte_type_name,sbyte_type);
|
||||
//uint16_type = new CompiledScope(new SymInfo(StringConstants.ushort_type_name, SymbolKind.Type,StringConstants.ushort_type_name),typeof(ushort));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.UShortType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.uint16_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name,uint16_type);
|
||||
//uint32_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name),typeof(uint));
|
||||
//cur_scope.AddName(StringConstants.ushort_type_name,uint16_type);
|
||||
//uint32_type = new CompiledScope(new SymInfo(StringConstants.uint_type_name, SymbolKind.Type,StringConstants.uint_type_name),typeof(uint));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.UIntType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.uint32_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name,uint32_type);
|
||||
//int64_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name),typeof(long));
|
||||
//cur_scope.AddName(StringConstants.uint_type_name,uint32_type);
|
||||
//int64_type = new CompiledScope(new SymInfo(StringConstants.long_type_name, SymbolKind.Type,StringConstants.long_type_name),typeof(long));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.Int64Type);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.int64_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name,int64_type);
|
||||
//uint64_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name),typeof(ulong));
|
||||
//cur_scope.AddName(StringConstants.long_type_name,int64_type);
|
||||
//uint64_type = new CompiledScope(new SymInfo(StringConstants.ulong_type_name, SymbolKind.Type,StringConstants.ulong_type_name),typeof(ulong));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.UInt64Type);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.uint64_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name,uint64_type);
|
||||
//float_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name),typeof(float));
|
||||
//cur_scope.AddName(StringConstants.ulong_type_name,uint64_type);
|
||||
//float_type = new CompiledScope(new SymInfo(StringConstants.float_type_name, SymbolKind.Type,StringConstants.float_type_name),typeof(float));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.FloatType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.float_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name,float_type);
|
||||
//ptr_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name),Type.GetType("System.Void*"));
|
||||
//cur_scope.AddName(StringConstants.float_type_name,float_type);
|
||||
//ptr_type = new CompiledScope(new SymInfo(StringConstants.pointer_type_name, SymbolKind.Type,StringConstants.pointer_type_name),Type.GetType("System.Void*"));
|
||||
type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.PointerType);
|
||||
if (type_name != null) cur_scope.AddName(type_name, TypeTable.ptr_type);
|
||||
//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name,ptr_type);
|
||||
ProcScope ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.set_length_procedure_name,null);
|
||||
//cur_scope.AddName(StringConstants.pointer_type_name,ptr_type);
|
||||
ProcScope ps = new ProcScope(StringConstants.set_length_procedure_name,null);
|
||||
ps.AddParameter(new ElementScope(new SymInfo("arr", SymbolKind.Parameter,"arr"),new ArrayScope(),null,ps));
|
||||
ps.parameters[0].param_kind = parametr_kind.var_parametr;
|
||||
ps.AddParameter(new ElementScope(new SymInfo("length", SymbolKind.Parameter,"length"),TypeTable.int_type,null,ps));
|
||||
ps.Complete();
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.set_length_procedure_name,ps);
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name,new ElementScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, SymbolKind.Constant,PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name),TypeTable.bool_type,true,null));
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name,new ElementScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, SymbolKind.Constant,PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name),TypeTable.bool_type,false,null));
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.new_procedure_name,null);
|
||||
cur_scope.AddName(StringConstants.set_length_procedure_name,ps);
|
||||
cur_scope.AddName(StringConstants.true_const_name,new ElementScope(new SymInfo(StringConstants.true_const_name, SymbolKind.Constant,StringConstants.true_const_name),TypeTable.bool_type,true,null));
|
||||
cur_scope.AddName(StringConstants.false_const_name,new ElementScope(new SymInfo(StringConstants.false_const_name, SymbolKind.Constant,StringConstants.false_const_name),TypeTable.bool_type,false,null));
|
||||
ps = new ProcScope(StringConstants.new_procedure_name,null);
|
||||
ElementScope prm = new ElementScope(new SymInfo("p", SymbolKind.Parameter,"p"),TypeTable.ptr_type,null,ps);
|
||||
prm.param_kind = parametr_kind.var_parametr;
|
||||
ps.AddParameter(prm);
|
||||
ps.Complete();
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.new_procedure_name,ps);
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.dispose_procedure_name,null);
|
||||
cur_scope.AddName(StringConstants.new_procedure_name,ps);
|
||||
ps = new ProcScope(StringConstants.dispose_procedure_name,null);
|
||||
prm = new ElementScope(new SymInfo("p", SymbolKind.Parameter,"p"),TypeTable.ptr_type,null,ps);
|
||||
prm.param_kind = parametr_kind.var_parametr;
|
||||
ps.AddParameter(prm);
|
||||
ps.Complete();
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.dispose_procedure_name,ps);
|
||||
cur_scope.AddName(StringConstants.dispose_procedure_name,ps);
|
||||
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, null);
|
||||
ps = new ProcScope(StringConstants.IncProcedure, null);
|
||||
prm = new ElementScope(new SymInfo("i", SymbolKind.Parameter, "i"), TypeTable.int16_type, null, ps);
|
||||
prm.param_kind = parametr_kind.var_parametr;
|
||||
ps.AddParameter(prm);
|
||||
ps.Complete();
|
||||
ps.si.not_include = true;
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, ps);
|
||||
cur_scope.AddName(StringConstants.IncProcedure, ps);
|
||||
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, null);
|
||||
ps = new ProcScope(StringConstants.IncProcedure, null);
|
||||
prm = new ElementScope(new SymInfo("i", SymbolKind.Parameter, "i"), TypeTable.uint16_type, null, ps);
|
||||
prm.param_kind = parametr_kind.var_parametr;
|
||||
ps.AddParameter(prm);
|
||||
ps.Complete();
|
||||
ps.si.not_include = true;
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, ps);
|
||||
cur_scope.AddName(StringConstants.IncProcedure, ps);
|
||||
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, null);
|
||||
ps = new ProcScope(StringConstants.IncProcedure, null);
|
||||
prm = new ElementScope(new SymInfo("i", SymbolKind.Parameter, "i"), TypeTable.sbyte_type, null, ps);
|
||||
prm.param_kind = parametr_kind.var_parametr;
|
||||
ps.AddParameter(prm);
|
||||
ps.Complete();
|
||||
ps.si.not_include = true;
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, ps);
|
||||
cur_scope.AddName(StringConstants.IncProcedure, ps);
|
||||
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, null);
|
||||
ps = new ProcScope(StringConstants.IncProcedure, null);
|
||||
prm = new ElementScope(new SymInfo("i", SymbolKind.Parameter, "i"), TypeTable.int64_type, null, ps);
|
||||
prm.param_kind = parametr_kind.var_parametr;
|
||||
ps.AddParameter(prm);
|
||||
ps.Complete();
|
||||
ps.si.not_include = true;
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, ps);
|
||||
cur_scope.AddName(StringConstants.IncProcedure, ps);
|
||||
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, null);
|
||||
ps = new ProcScope(StringConstants.IncProcedure, null);
|
||||
prm = new ElementScope(new SymInfo("i", SymbolKind.Parameter, "i"), TypeTable.uint64_type, null, ps);
|
||||
prm.param_kind = parametr_kind.var_parametr;
|
||||
ps.AddParameter(prm);
|
||||
ps.Complete();
|
||||
ps.si.not_include = true;
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, ps);
|
||||
cur_scope.AddName(StringConstants.IncProcedure, ps);
|
||||
|
||||
ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, null);
|
||||
ps = new ProcScope(StringConstants.IncProcedure, null);
|
||||
prm = new ElementScope(new SymInfo("i", SymbolKind.Parameter, "i"), TypeTable.uint32_type, null, ps);
|
||||
prm.param_kind = parametr_kind.var_parametr;
|
||||
ps.AddParameter(prm);
|
||||
ps.Complete();
|
||||
ps.si.not_include = true;
|
||||
cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.IncProcedure, ps);
|
||||
cur_scope.AddName(StringConstants.IncProcedure, ps);
|
||||
}
|
||||
|
||||
public override void visit(hex_constant _hex_constant)
|
||||
{
|
||||
//throw new Exception("The method or operation is not implemented.");
|
||||
returned_scope = TypeTable.uint64_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name);
|
||||
returned_scope = TypeTable.uint64_type;//entry_scope.FindName(StringConstants.ulong_type_name);
|
||||
cnst_val.prim_val = _hex_constant.val;
|
||||
}
|
||||
|
||||
|
|
@ -3838,7 +3837,7 @@ namespace CodeCompletion
|
|||
if (element_type != null)
|
||||
returned_scope = new SetScope(element_type);
|
||||
else
|
||||
returned_scope = cur_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.set_name);
|
||||
returned_scope = cur_scope.FindName(StringConstants.set_name);
|
||||
cnst_val.prim_val = null;
|
||||
}
|
||||
|
||||
|
|
@ -4332,7 +4331,7 @@ namespace CodeCompletion
|
|||
foreach (enumerator en in _enum_type_definition.enumerators.enumerators)
|
||||
{
|
||||
var name = (en.name as named_type_reference).FirstIdent.name;
|
||||
ElementScope ss = new ElementScope(new SymInfo(name, SymbolKind.Constant, name),/*cur_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name)*/enum_scope, cur_scope);
|
||||
ElementScope ss = new ElementScope(new SymInfo(name, SymbolKind.Constant, name),/*cur_scope.FindName(StringConstants.integer_type_name)*/enum_scope, cur_scope);
|
||||
ss.is_static = true;
|
||||
ss.cnst_val = name;
|
||||
elems.Add(ss);
|
||||
|
|
@ -4350,7 +4349,7 @@ namespace CodeCompletion
|
|||
|
||||
public override void visit(char_const _char_const)
|
||||
{
|
||||
returned_scope = TypeTable.char_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name);
|
||||
returned_scope = TypeTable.char_type;//entry_scope.FindName(StringConstants.char_type_name);
|
||||
if (in_kav)
|
||||
cnst_val.prim_val = this.converter.controller.Parser.LanguageInformation.GetStringForChar(_char_const.cconst);
|
||||
//cnst_val.prim_val = "'"+_char_const.cconst.ToString()+"'";
|
||||
|
|
@ -4364,14 +4363,14 @@ namespace CodeCompletion
|
|||
|
||||
public override void visit(sharp_char_const _sharp_char_const)
|
||||
{
|
||||
returned_scope = TypeTable.char_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name);
|
||||
returned_scope = TypeTable.char_type;//entry_scope.FindName(StringConstants.char_type_name);
|
||||
cnst_val.prim_val = this.converter.controller.Parser.LanguageInformation.GetStringForSharpChar(_sharp_char_const.char_num);
|
||||
}
|
||||
|
||||
private bool in_kav=true;
|
||||
public override void visit(literal_const_line _literal_const_line)
|
||||
{
|
||||
//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name);
|
||||
//entry_scope.FindName(StringConstants.string_type_name);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
in_kav = false;
|
||||
for (int i = 0; i < _literal_const_line.literals.Count; i++)
|
||||
|
|
@ -4398,7 +4397,7 @@ namespace CodeCompletion
|
|||
{
|
||||
|
||||
}
|
||||
returned_scope = new ShortStringScope(TypeTable.string_type,cnst_val.prim_val);//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name);
|
||||
returned_scope = new ShortStringScope(TypeTable.string_type,cnst_val.prim_val);//entry_scope.FindName(StringConstants.string_type_name);
|
||||
returned_scope.topScope = cur_scope;
|
||||
returned_scope.loc = get_location(_string_num_definition);
|
||||
}
|
||||
|
|
@ -4756,7 +4755,7 @@ namespace CodeCompletion
|
|||
ref has_system_unit, ref has_extensions_unit, unl);
|
||||
}
|
||||
}
|
||||
//if (_interface_node.unit_name.idunit_name.name != PascalABCCompiler.TreeConverter.compiler_string_consts.system_unit_file_name)
|
||||
//if (_interface_node.unit_name.idunit_name.name != StringConstants.system_unit_file_name)
|
||||
if (!is_system_unit && !has_system_unit)
|
||||
add_system_unit();
|
||||
if (!is_system_unit && !is_extensions_unit && !has_extensions_unit)
|
||||
|
|
@ -5152,13 +5151,13 @@ namespace CodeCompletion
|
|||
public override void visit(int64_const _int64_const)
|
||||
{
|
||||
//throw new Exception("The method or operation is not implemented.");
|
||||
returned_scope = TypeTable.int64_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name);
|
||||
returned_scope = TypeTable.int64_type;//entry_scope.FindName(StringConstants.long_type_name);
|
||||
cnst_val.prim_val = _int64_const.val;
|
||||
}
|
||||
|
||||
public override void visit(uint64_const _uint64_const)
|
||||
{
|
||||
returned_scope = TypeTable.uint64_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name);
|
||||
returned_scope = TypeTable.uint64_type;//entry_scope.FindName(StringConstants.ulong_type_name);
|
||||
cnst_val.prim_val = _uint64_const.val;
|
||||
}
|
||||
|
||||
|
|
@ -5232,30 +5231,30 @@ namespace CodeCompletion
|
|||
{
|
||||
switch(op)
|
||||
{
|
||||
case Operators.Plus : return PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name;
|
||||
case Operators.Minus : return PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name;
|
||||
case Operators.Division : return PascalABCCompiler.TreeConverter.compiler_string_consts.div_name;
|
||||
case Operators.IntegerDivision: return PascalABCCompiler.TreeConverter.compiler_string_consts.div_name;
|
||||
case Operators.Multiplication : return PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name;
|
||||
case Operators.ModulusRemainder : return PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name;
|
||||
case Operators.Less : return PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name;
|
||||
case Operators.LessEqual : return PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name;
|
||||
case Operators.Greater : return PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name;
|
||||
case Operators.GreaterEqual : return PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name;
|
||||
case Operators.Equal : return PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name;
|
||||
case Operators.NotEqual : return PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name;
|
||||
case Operators.AssignmentAddition : return PascalABCCompiler.TreeConverter.compiler_string_consts.plusassign_name;
|
||||
case Operators.AssignmentMultiplication : return PascalABCCompiler.TreeConverter.compiler_string_consts.multassign_name;
|
||||
case Operators.AssignmentSubtraction : return PascalABCCompiler.TreeConverter.compiler_string_consts.minusassign_name;
|
||||
case Operators.AssignmentDivision : return PascalABCCompiler.TreeConverter.compiler_string_consts.divassign_name;
|
||||
case Operators.Plus : return StringConstants.plus_name;
|
||||
case Operators.Minus : return StringConstants.minus_name;
|
||||
case Operators.Division : return StringConstants.div_name;
|
||||
case Operators.IntegerDivision: return StringConstants.div_name;
|
||||
case Operators.Multiplication : return StringConstants.mul_name;
|
||||
case Operators.ModulusRemainder : return StringConstants.mod_name;
|
||||
case Operators.Less : return StringConstants.sm_name;
|
||||
case Operators.LessEqual : return StringConstants.smeq_name;
|
||||
case Operators.Greater : return StringConstants.gr_name;
|
||||
case Operators.GreaterEqual : return StringConstants.greq_name;
|
||||
case Operators.Equal : return StringConstants.eq_name;
|
||||
case Operators.NotEqual : return StringConstants.noteq_name;
|
||||
case Operators.AssignmentAddition : return StringConstants.plusassign_name;
|
||||
case Operators.AssignmentMultiplication : return StringConstants.multassign_name;
|
||||
case Operators.AssignmentSubtraction : return StringConstants.minusassign_name;
|
||||
case Operators.AssignmentDivision : return StringConstants.divassign_name;
|
||||
case Operators.Implicit : return "implicit";
|
||||
case Operators.Explicit : return "explicit";
|
||||
case Operators.In: return PascalABCCompiler.TreeConverter.compiler_string_consts.in_name;
|
||||
case Operators.Power: return PascalABCCompiler.TreeConverter.compiler_string_consts.power_name;
|
||||
case Operators.LogicalOR: return PascalABCCompiler.TreeConverter.compiler_string_consts.or_name;
|
||||
case Operators.LogicalAND: return PascalABCCompiler.TreeConverter.compiler_string_consts.and_name;
|
||||
case Operators.BitwiseXOR: return PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name;
|
||||
case Operators.LogicalNOT: return PascalABCCompiler.TreeConverter.compiler_string_consts.not_name;
|
||||
case Operators.In: return StringConstants.in_name;
|
||||
case Operators.Power: return StringConstants.power_name;
|
||||
case Operators.LogicalOR: return StringConstants.or_name;
|
||||
case Operators.LogicalAND: return StringConstants.and_name;
|
||||
case Operators.BitwiseXOR: return StringConstants.xor_name;
|
||||
case Operators.LogicalNOT: return StringConstants.not_name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
@ -5821,7 +5820,7 @@ namespace CodeCompletion
|
|||
{
|
||||
method_call mc = new method_call();
|
||||
mc.parameters = new expression_list(new List<expression> { _diapason_expr_new.left, _diapason_expr_new.right });
|
||||
mc.dereferencing_value = new dot_node(new ident(compiler_string_consts.pascalSystemUnitName), new ident("InternalRange"));
|
||||
mc.dereferencing_value = new dot_node(new ident(StringConstants.pascalSystemUnitName), new ident("InternalRange"));
|
||||
mc.visit(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ namespace CodeCompletion
|
|||
|
||||
public override void visit(string_const _string_const)
|
||||
{
|
||||
returned_scope = new ElementScope(entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name));
|
||||
returned_scope = new ElementScope(entry_scope.FindName(StringConstants.string_type_name));
|
||||
}
|
||||
|
||||
public override void visit(expression_list _expression_list)
|
||||
|
|
@ -1450,7 +1450,7 @@ namespace CodeCompletion
|
|||
if (returned_scope != null) returned_scope = new ElementScope(returned_scope);
|
||||
}
|
||||
else if (_typecast_node.cast_op == op_typecast.is_op)
|
||||
returned_scope = new ElementScope(entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name));
|
||||
returned_scope = new ElementScope(entry_scope.FindName(StringConstants.bool_type_name));
|
||||
}
|
||||
|
||||
public override void visit(interface_node _interface_node)
|
||||
|
|
@ -1546,7 +1546,7 @@ namespace CodeCompletion
|
|||
|
||||
public override void visit(format_expr _format_expr)
|
||||
{
|
||||
returned_scope = entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name);
|
||||
returned_scope = entry_scope.FindName(StringConstants.string_type_name);
|
||||
}
|
||||
|
||||
public override void visit(initfinal_part _initfinal_part)
|
||||
|
|
@ -1776,7 +1776,7 @@ namespace CodeCompletion
|
|||
|
||||
public override void visit(sizeof_operator _sizeof_operator)
|
||||
{
|
||||
returned_scope = new ElementScope(entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name));
|
||||
returned_scope = new ElementScope(entry_scope.FindName(StringConstants.integer_type_name));
|
||||
}
|
||||
|
||||
public override void visit(typeof_operator _typeof_operator)
|
||||
|
|
@ -2041,7 +2041,7 @@ namespace CodeCompletion
|
|||
|
||||
method_call mc = new method_call();
|
||||
mc.parameters = new expression_list(new List<expression> { _diapason_expr_new.left, _diapason_expr_new.right });
|
||||
mc.dereferencing_value = new dot_node(new ident(compiler_string_consts.pascalSystemUnitName), new ident("InternalRange"));
|
||||
mc.dereferencing_value = new dot_node(new ident(StringConstants.pascalSystemUnitName), new ident("InternalRange"));
|
||||
mc.visit(this);
|
||||
}
|
||||
|
||||
|
|
@ -2051,7 +2051,7 @@ namespace CodeCompletion
|
|||
var rr = this.returned_scope;
|
||||
//var nn = new new_expr((syntax_type, plist, true, new SyntaxTree.array_const(acn.elements, acn.elements.source_context), acn.source_context);
|
||||
//var nn = new new_expr($2, el, true, $6 as array_const, @$);
|
||||
var dn = new dot_node(new ident(compiler_string_consts.pascalSystemUnitName), new ident("Arr"), acn.source_context);
|
||||
var dn = new dot_node(new ident(StringConstants.pascalSystemUnitName), new ident("Arr"), acn.source_context);
|
||||
var el = new expression_list(acn.elements.expressions[0], acn.source_context);
|
||||
var nn = new method_call(dn, el, acn.source_context);
|
||||
visit(nn);
|
||||
|
|
|
|||
|
|
@ -75,19 +75,19 @@ namespace CodeCompletion
|
|||
if (!ctn.IsEnum)
|
||||
switch (tc)
|
||||
{
|
||||
case TypeCode.Int32: return PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name;
|
||||
case TypeCode.Double: return PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name;
|
||||
case TypeCode.Boolean: return PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name;
|
||||
case TypeCode.String: return PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name;
|
||||
case TypeCode.Char: return PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name;
|
||||
case TypeCode.Byte: return PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name;
|
||||
case TypeCode.SByte: return PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name;
|
||||
case TypeCode.Int16: return PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name;
|
||||
case TypeCode.Int64: return PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name;
|
||||
case TypeCode.UInt16: return PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name;
|
||||
case TypeCode.UInt32: return PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name;
|
||||
case TypeCode.UInt64: return PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name;
|
||||
case TypeCode.Single: return PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name;
|
||||
case TypeCode.Int32: return StringConstants.integer_type_name;
|
||||
case TypeCode.Double: return StringConstants.real_type_name;
|
||||
case TypeCode.Boolean: return StringConstants.bool_type_name;
|
||||
case TypeCode.String: return StringConstants.string_type_name;
|
||||
case TypeCode.Char: return StringConstants.char_type_name;
|
||||
case TypeCode.Byte: return StringConstants.byte_type_name;
|
||||
case TypeCode.SByte: return StringConstants.sbyte_type_name;
|
||||
case TypeCode.Int16: return StringConstants.short_type_name;
|
||||
case TypeCode.Int64: return StringConstants.long_type_name;
|
||||
case TypeCode.UInt16: return StringConstants.ushort_type_name;
|
||||
case TypeCode.UInt32: return StringConstants.uint_type_name;
|
||||
case TypeCode.UInt64: return StringConstants.ulong_type_name;
|
||||
case TypeCode.Single: return StringConstants.float_type_name;
|
||||
}
|
||||
else return ctn.FullName;
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ namespace CodeCompletion
|
|||
return sb.ToString();
|
||||
}
|
||||
if (ctn.IsArray) return "array of " + GetTypeName(ctn.GetElementType());
|
||||
if (ctn == Type.GetType("System.Void*")) return PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name;
|
||||
if (ctn == Type.GetType("System.Void*")) return StringConstants.pointer_type_name;
|
||||
return ctn.FullName;
|
||||
}
|
||||
|
||||
|
|
@ -137,14 +137,14 @@ namespace CodeCompletion
|
|||
return sb.ToString();
|
||||
}
|
||||
//if (ctn.IsArray) return "array of "+GetTypeName(ctn.GetElementType());
|
||||
//if (ctn == Type.GetType("System.Void*")) return PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name;
|
||||
//if (ctn == Type.GetType("System.Void*")) return StringConstants.pointer_type_name;
|
||||
return ctn.Name;
|
||||
}
|
||||
|
||||
public static string GetTopScopeName(SymScope sc)
|
||||
{
|
||||
if (sc == null || sc.si == null) return "";
|
||||
if (sc.si.name == "" || sc.si.name.Contains("$") || sc.si.name == PascalABCCompiler.TreeConverter.compiler_string_consts.pascalSystemUnitName) return "";
|
||||
if (sc.si.name == "" || sc.si.name.Contains("$") || sc.si.name == StringConstants.pascalSystemUnitName) return "";
|
||||
if (sc is ProcScope) return "";
|
||||
return sc.si.name + ".";
|
||||
}
|
||||
|
|
@ -495,7 +495,7 @@ namespace CodeCompletion
|
|||
|
||||
private bool hasUsesCycle(SymScope unit, int deep=0)
|
||||
{
|
||||
if (unit.Name == compiler_string_consts.pascalSystemUnitName)
|
||||
if (unit.Name == StringConstants.pascalSystemUnitName)
|
||||
return true;
|
||||
if (deep > 100)
|
||||
return true;
|
||||
|
|
@ -525,7 +525,7 @@ namespace CodeCompletion
|
|||
|
||||
public void AddUsedUnit(SymScope unit)
|
||||
{
|
||||
if (this.si.name != compiler_string_consts.pascalSystemUnitName || unit is NamespaceScope)
|
||||
if (this.si.name != StringConstants.pascalSystemUnitName || unit is NamespaceScope)
|
||||
used_units.Add(unit);
|
||||
}
|
||||
|
||||
|
|
@ -5336,8 +5336,8 @@ namespace CodeCompletion
|
|||
else
|
||||
{
|
||||
Type t = PascalABCCompiler.NetHelper.NetHelper.FindType(full_name);
|
||||
if (t == null) t = PascalABCCompiler.NetHelper.NetHelper.FindType(full_name + PascalABCCompiler.TreeConverter.compiler_string_consts.generic_params_infix + "1");
|
||||
if (t == null) t = PascalABCCompiler.NetHelper.NetHelper.FindType(full_name + PascalABCCompiler.TreeConverter.compiler_string_consts.generic_params_infix + "2");
|
||||
if (t == null) t = PascalABCCompiler.NetHelper.NetHelper.FindType(full_name + StringConstants.generic_params_infix + "1");
|
||||
if (t == null) t = PascalABCCompiler.NetHelper.NetHelper.FindType(full_name + StringConstants.generic_params_infix + "2");
|
||||
if (t != null)
|
||||
{
|
||||
return TypeTable.get_compiled_type(new SymInfo(s, SymbolKind.Type, full_name), t);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace CodeCompletion
|
|||
var controller = new CodeCompletion.CodeCompletionController();
|
||||
CodeCompletion.DomSyntaxTreeVisitor.use_semantic_for_intellisense = true;
|
||||
CodeCompletion.CodeCompletionController.comp = comp;
|
||||
CodeCompletion.CodeCompletionController.SetParser(compiler_string_consts.pascalSourceFileExtension);
|
||||
CodeCompletion.CodeCompletionController.SetParser(StringConstants.pascalSourceFileExtension);
|
||||
CodeCompletion.CodeCompletionController.ParsersController = comp.ParsersController;
|
||||
var files = Directory.GetFiles(dir, "*.pas");
|
||||
var parser = comp.ParsersController;
|
||||
|
|
@ -104,7 +104,7 @@ namespace CodeCompletion
|
|||
var comp = new PascalABCCompiler.Compiler();
|
||||
var controller = new CodeCompletion.CodeCompletionController();
|
||||
CodeCompletion.CodeCompletionController.comp = comp;
|
||||
CodeCompletion.CodeCompletionController.SetParser(compiler_string_consts.pascalSourceFileExtension);
|
||||
CodeCompletion.CodeCompletionController.SetParser(StringConstants.pascalSourceFileExtension);
|
||||
CodeCompletion.CodeCompletionController.ParsersController = comp.ParsersController;
|
||||
var files = Directory.GetFiles(dir, "*.pas");
|
||||
var parser = comp.ParsersController;
|
||||
|
|
@ -341,7 +341,7 @@ namespace CodeCompletion
|
|||
int col=0;
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw;
|
||||
LanguageIntegration.LanguageIntegrator.ReloadAllParsers();
|
||||
IParser parser = CodeCompletionController.ParsersController.SelectParser(compiler_string_consts.pascalSourceFileExtension);
|
||||
IParser parser = CodeCompletionController.ParsersController.SelectParser(StringConstants.pascalSourceFileExtension);
|
||||
|
||||
string test_str = "System.Console";
|
||||
off = test_str.Length;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -279,12 +279,6 @@ namespace PascalABCCompiler
|
|||
{
|
||||
this.sourceLocation = new SourceLocation(sl.doc.file_name, sl.begin_line_num, sl.begin_column_num, sl.end_line_num, sl.end_column_num);
|
||||
}
|
||||
|
||||
public ResourceFileNotFound(string ResFileName)
|
||||
: base(string.Format(StringResources.Get("COMPILATIONERROR_RESOURCEFILE_{0}_NOT_FOUND"), ResFileName), null)
|
||||
{
|
||||
//this.sourceLocation = new SourceLocation(sl.doc.file_name, sl.begin_line_num, sl.begin_column_num, sl.end_line_num, sl.end_column_num);
|
||||
}
|
||||
}
|
||||
|
||||
public class IncludeNamespaceInUnitError : CompilerCompilationError
|
||||
|
|
@ -397,13 +391,31 @@ namespace PascalABCCompiler
|
|||
|
||||
public class UnsupportedTargetFramework : CompilerCompilationError
|
||||
{
|
||||
public UnsupportedTargetFramework(string FrameworkName, TreeRealization.location sl)
|
||||
public UnsupportedTargetFramework(string FrameworkName, location sl)
|
||||
: base(string.Format(StringResources.Get("COMPILATIONERROR_UNSUPPORTED_TARGETFRAMEWORK_{0}"), FrameworkName))
|
||||
{
|
||||
this.sourceLocation = new SourceLocation(sl.doc.file_name, sl.begin_line_num, sl.begin_column_num, sl.end_line_num, sl.end_column_num);
|
||||
}
|
||||
}
|
||||
|
||||
public class UnsupportedTargetPlatform : CompilerCompilationError
|
||||
{
|
||||
public UnsupportedTargetPlatform(string platformName, location loc)
|
||||
: base(string.Format(StringResources.Get("COMPILATIONERROR_UNSUPPORTED_TARGET_PLATFORM{0}"), platformName))
|
||||
{
|
||||
sourceLocation = new SourceLocation(loc.doc.file_name, loc.begin_line_num, loc.begin_column_num, loc.end_line_num, loc.end_column_num);
|
||||
}
|
||||
}
|
||||
|
||||
public class UnsupportedOutputFileType : CompilerCompilationError
|
||||
{
|
||||
public UnsupportedOutputFileType(string outputFileType, location loc)
|
||||
: base(string.Format(StringResources.Get("COMPILATIONERROR_UNSUPPORTED_OUTPUT_FILE_TYPE{0}"), outputFileType))
|
||||
{
|
||||
sourceLocation = new SourceLocation(loc.doc.file_name, loc.begin_line_num, loc.begin_column_num, loc.end_line_num, loc.end_column_num);
|
||||
}
|
||||
}
|
||||
|
||||
public enum UnitState { BeginCompilation, InterfaceCompiled, Compiled }
|
||||
|
||||
public class CompilationUnit
|
||||
|
|
@ -423,7 +435,7 @@ namespace PascalABCCompiler
|
|||
//private SemanticTree.compilation_unitArrayList _interfaceUsedUnits=new SemanticTree.compilation_unitArrayList();
|
||||
|
||||
// название языка модуля
|
||||
public string languageName = TreeConverter.compiler_string_consts.pascalLanguageName;
|
||||
public string languageName = StringConstants.pascalLanguageName;
|
||||
|
||||
/// <summary>
|
||||
/// Только "реальные" юниты (не dll и namespace)
|
||||
|
|
@ -520,7 +532,7 @@ namespace PascalABCCompiler
|
|||
public bool Optimise = false;
|
||||
public bool SavePCUInThreadPull = false;
|
||||
public bool RunWithEnvironment = false;
|
||||
public string CompiledUnitExtension = TreeConverter.compiler_string_consts.pascalCompiledUnitExtension;
|
||||
public string CompiledUnitExtension = StringConstants.pascalCompiledUnitExtension;
|
||||
public bool ProjectCompiled = false;
|
||||
public IProjectInfo CurrentProject = null;
|
||||
public OutputType OutputFileType = OutputType.ConsoleApplicaton;
|
||||
|
|
@ -612,7 +624,7 @@ namespace PascalABCCompiler
|
|||
{
|
||||
public string name = null;
|
||||
public StandardModuleAddMethod addMethod = StandardModuleAddMethod.LeftToAll;
|
||||
public string languageToAdd = TreeConverter.compiler_string_consts.pascalLanguageName;
|
||||
public string languageToAdd = StringConstants.pascalLanguageName;
|
||||
|
||||
public StandardModule(string Name, StandardModuleAddMethod addMethod)
|
||||
{
|
||||
|
|
@ -883,13 +895,6 @@ namespace PascalABCCompiler
|
|||
|
||||
public List<var_definition_node> CompiledVariables = new List<var_definition_node>();
|
||||
|
||||
private Dictionary<string, List<TreeRealization.compiler_directive>> compilerDirectives = null;
|
||||
|
||||
//public Hashtable CompilerDirectives
|
||||
//{
|
||||
// get { return compiler_directives; }
|
||||
//}
|
||||
|
||||
private uint linesCompiled;
|
||||
public uint LinesCompiled
|
||||
{
|
||||
|
|
@ -1172,25 +1177,14 @@ namespace PascalABCCompiler
|
|||
}
|
||||
}
|
||||
|
||||
private static HashSet<string> knownDirectives = new HashSet<string>(new string[] { PascalABCCompiler.TreeConverter.compiler_string_consts.main_resource_string,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.trademark_string, PascalABCCompiler.TreeConverter.compiler_string_consts.copyright_string,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.company_string, PascalABCCompiler.TreeConverter.compiler_string_consts.product_string,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.version_string, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_apptype,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_reference, PascalABCCompiler.TreeConverter.compiler_string_consts.include_namespace_directive,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_savepcu, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_zerobasedstrings,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_zerobasedstrings_ON, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_zerobasedstrings_OFF,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_nullbasedstrings_ON, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_nullbasedstrings_OFF,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_initstring_as_empty_ON, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_initstring_as_empty_OFF,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_resource, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_platformtarget,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_targetframework, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_faststrings,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_gendoc, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_region,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_endregion, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_ifdef,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_endif, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_ifndef,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_define, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_else,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_undef, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_include,
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_hidden_idents,
|
||||
});
|
||||
#region COMPILER DIRECTIVES
|
||||
|
||||
/// <summary>
|
||||
/// Формирует словарь директив компилятора, собирая их из всех переданных модулей
|
||||
/// </summary>
|
||||
/// <param name="Units"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="DuplicateDirective"></exception>
|
||||
private Dictionary<string, List<compiler_directive>> GetCompilerDirectives(List<CompilationUnit> Units)
|
||||
{
|
||||
Dictionary<string, List<compiler_directive>> directives = new Dictionary<string, List<compiler_directive>>(StringComparer.CurrentCultureIgnoreCase);
|
||||
|
|
@ -1204,11 +1198,10 @@ namespace PascalABCCompiler
|
|||
{
|
||||
if (!directives.ContainsKey(cd.name))
|
||||
directives.Add(cd.name, new List<compiler_directive>());
|
||||
// TODO: сделать проверку на дубликаты централизованной (в другом месте) EVA
|
||||
else if (cd.name.Equals("mainresource", StringComparison.CurrentCultureIgnoreCase))
|
||||
throw new DuplicateDirective(cd.location.doc.file_name, "mainresource", cd.location);
|
||||
directives[cd.name].Insert(0, cd);
|
||||
if (!knownDirectives.Contains(cd.name.ToLower()))
|
||||
warnings.Add(new Errors.CommonWarning(string.Format(StringResources.Get("WARNING_UNKNOWN_DIRECTIVE"), cd.name), cd.location.doc.file_name, cd.location.begin_line_num, cd.location.begin_column_num));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1225,6 +1218,24 @@ namespace PascalABCCompiler
|
|||
return Directives;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// преобразует в директивы семантического уровня | в TreeConverter такая же функция EVA
|
||||
/// </summary>
|
||||
private List<compiler_directive> GetDirectivesAsSemanticNodes(List<SyntaxTree.compiler_directive> compilerDirectives, string unitFileName)
|
||||
{
|
||||
List<compiler_directive> list = new List<compiler_directive>();
|
||||
foreach (SyntaxTree.compiler_directive directive in compilerDirectives)
|
||||
{
|
||||
list.Add(new compiler_directive(directive.Name.text,
|
||||
directive.Directive?.text ?? "",
|
||||
get_location_from_treenode(directive, unitFileName),
|
||||
unitFileName));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TreeRealization.location get_location_from_treenode(SyntaxTree.syntax_tree_node tn, string FileName)
|
||||
{
|
||||
if (tn.source_context == null)
|
||||
|
|
@ -1235,22 +1246,6 @@ namespace PascalABCCompiler
|
|||
tn.source_context.end_position.line_num, tn.source_context.end_position.column_num, new TreeRealization.document(FileName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// преобразует в директивы семантического уровня
|
||||
/// </summary>
|
||||
private List<compiler_directive> GetDirectivesAsSemanticNodes(List<SyntaxTree.compiler_directive> compilerDirectives, string unitFileName)
|
||||
{
|
||||
List<compiler_directive> list = new List<compiler_directive>();
|
||||
foreach (SyntaxTree.compiler_directive directive in compilerDirectives)
|
||||
{
|
||||
list.Add(new compiler_directive(directive.Name.text,
|
||||
directive.Directive?.text ?? "",
|
||||
get_location_from_treenode(directive, unitFileName),
|
||||
unitFileName));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
void syncStartCompile()
|
||||
{
|
||||
Compile();
|
||||
|
|
@ -1826,7 +1821,7 @@ namespace PascalABCCompiler
|
|||
|
||||
if (info != null && info.modules.Count > 0)
|
||||
{
|
||||
comp_opt.ReferencedAssemblies.Add(Path.Combine(Path.GetDirectoryName(CompilerOptions.SourceFileName), PascalABCCompiler.TreeConverter.compiler_string_consts.pabc_rtl_dll_name));
|
||||
comp_opt.ReferencedAssemblies.Add(Path.Combine(Path.GetDirectoryName(CompilerOptions.SourceFileName), StringConstants.pabc_rtl_dll_name));
|
||||
string mod_file_name = FindFileInDirs("PABCRtl.dll", out _, Path.Combine(this.CompilerOptions.SystemDirectory, "Lib"));
|
||||
File.Copy(mod_file_name, Path.Combine(Path.GetDirectoryName(CompilerOptions.SourceFileName), "PABCRtl.dll"), true);
|
||||
/*foreach (string mod in info.modules)
|
||||
|
|
@ -1958,12 +1953,12 @@ namespace PascalABCCompiler
|
|||
}
|
||||
}
|
||||
|
||||
private void SetOutputFileTypeOption()
|
||||
private void SetOutputFileTypeOption(Dictionary<string, List<TreeRealization.compiler_directive>> compilerDirectives)
|
||||
{
|
||||
if (compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.compiler_directive_apptype))
|
||||
if (compilerDirectives.ContainsKey(StringConstants.compiler_directive_apptype))
|
||||
{
|
||||
string directive = compilerDirectives[TreeConverter.compiler_string_consts.compiler_directive_apptype][0].directive.ToLower();
|
||||
switch (directive)
|
||||
string outputFileType = compilerDirectives[StringConstants.compiler_directive_apptype][0].directive.ToLower();
|
||||
switch (outputFileType)
|
||||
{
|
||||
case "console":
|
||||
CompilerOptions.OutputFileType = CompilerOptions.OutputType.ConsoleApplicaton;
|
||||
|
|
@ -1978,18 +1973,27 @@ namespace PascalABCCompiler
|
|||
CompilerOptions.OutputFileType = CompilerOptions.OutputType.PascalCompiledUnit;
|
||||
break;
|
||||
default:
|
||||
throw new Exception("No possible OutputFileType!");
|
||||
ErrorsList.Add(new UnsupportedOutputFileType(outputFileType, compilerDirectives[StringConstants.compiler_directive_apptype][0].location));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// передача информации о типе выходного файла системному юниту
|
||||
if (UnitsTopologicallySortedList.Count > 0)
|
||||
{
|
||||
bool isConsoleApplication = CompilerOptions.OutputFileType == CompilerOptions.OutputType.ConsoleApplicaton;
|
||||
common_unit_node systemUnit = UnitsTopologicallySortedList[0].SemanticTree as common_unit_node;
|
||||
systemUnit.IsConsoleApplicationVariable = isConsoleApplication;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetOutputPlatformOption(NETGenerator.CompilerOptions compilerOptions)
|
||||
private void SetOutputPlatformOption(NETGenerator.CompilerOptions compilerOptions, Dictionary<string, List<TreeRealization.compiler_directive>> compilerDirectives)
|
||||
{
|
||||
List<compiler_directive> compilerDirectivesList = new List<compiler_directive>();
|
||||
if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.compiler_directive_platformtarget, out compilerDirectivesList))
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_platformtarget, out compilerDirectivesList))
|
||||
{
|
||||
string plt = compilerDirectivesList[0].directive.ToLower();
|
||||
switch (plt)
|
||||
string platformName = compilerDirectivesList[0].directive.ToLower();
|
||||
switch (platformName)
|
||||
{
|
||||
case "x86":
|
||||
compilerOptions.platformtarget = NETGenerator.CompilerOptions.PlatformTarget.x86;
|
||||
|
|
@ -2024,12 +2028,13 @@ namespace PascalABCCompiler
|
|||
}
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Unknown platform!");
|
||||
ErrorsList.Add(new UnsupportedTargetPlatform(platformName, compilerDirectivesList[0].location));
|
||||
break;
|
||||
}
|
||||
if (CompilerOptions.Only32Bit)
|
||||
compilerOptions.platformtarget = NETGenerator.CompilerOptions.PlatformTarget.x86;
|
||||
}
|
||||
if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.compiler_directive_targetframework, out compilerDirectivesList))
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_targetframework, out compilerDirectivesList))
|
||||
{
|
||||
compilerOptions.TargetFramework = compilerDirectivesList[0].directive;
|
||||
if (!(new string[] { "net40", "net403", "net45", "net451", "net452", "net46", "net461", "net462", "net47", "net471", "net472", "net48", "net481" })
|
||||
|
|
@ -2040,56 +2045,56 @@ namespace PascalABCCompiler
|
|||
}
|
||||
}
|
||||
|
||||
private void FillCompilerInfoOptions(NETGenerator.CompilerOptions compilerOptions)
|
||||
private void FillCompilerInfoOptions(NETGenerator.CompilerOptions compilerOptions, Dictionary<string, List<TreeRealization.compiler_directive>> compilerDirectives)
|
||||
{
|
||||
var compilerDirectives = new List<compiler_directive>();
|
||||
|
||||
if (this.compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.product_string, out compilerDirectives))
|
||||
List<compiler_directive> compilerDirectivesList;
|
||||
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_product_string, out compilerDirectivesList))
|
||||
{
|
||||
compilerOptions.Product = compilerDirectives[0].directive;
|
||||
compilerOptions.Product = compilerDirectivesList[0].directive;
|
||||
}
|
||||
if (this.compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.version_string, out compilerDirectives))
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_version_string, out compilerDirectivesList))
|
||||
{
|
||||
compilerOptions.ProductVersion = compilerDirectives[0].directive;
|
||||
compilerOptions.ProductVersion = compilerDirectivesList[0].directive;
|
||||
}
|
||||
if (this.compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.company_string, out compilerDirectives))
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_company_string, out compilerDirectivesList))
|
||||
{
|
||||
compilerOptions.Company = compilerDirectives[0].directive;
|
||||
compilerOptions.Company = compilerDirectivesList[0].directive;
|
||||
}
|
||||
if (this.compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.trademark_string, out compilerDirectives))
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_trademark_string, out compilerDirectivesList))
|
||||
{
|
||||
compilerOptions.TradeMark = compilerDirectives[0].directive;
|
||||
compilerOptions.TradeMark = compilerDirectivesList[0].directive;
|
||||
}
|
||||
if (this.compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.copyright_string, out compilerDirectives))
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_copyright_string, out compilerDirectivesList))
|
||||
{
|
||||
compilerOptions.Copyright = compilerDirectives[0].directive;
|
||||
compilerOptions.Copyright = compilerDirectivesList[0].directive;
|
||||
}
|
||||
if (this.compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.title_string, out compilerDirectives))
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_title_string, out compilerDirectivesList))
|
||||
{
|
||||
compilerOptions.Title = compilerDirectives[0].directive;
|
||||
compilerOptions.Title = compilerDirectivesList[0].directive;
|
||||
}
|
||||
if (this.compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.description_string, out compilerDirectives))
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_description_string, out compilerDirectivesList))
|
||||
{
|
||||
compilerOptions.Description = compilerDirectives[0].directive;
|
||||
compilerOptions.Description = compilerDirectivesList[0].directive;
|
||||
}
|
||||
if (this.compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.main_resource_string, out compilerDirectives))
|
||||
if (compilerDirectives.TryGetValue(StringConstants.compiler_directive_main_resource_string, out compilerDirectivesList))
|
||||
{
|
||||
if (this.compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.product_string) ||
|
||||
this.compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.version_string) ||
|
||||
this.compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.company_string) ||
|
||||
this.compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.trademark_string) ||
|
||||
this.compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.title_string) ||
|
||||
this.compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.description_string) ||
|
||||
this.compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.copyright_string))
|
||||
if (compilerDirectives.ContainsKey(StringConstants.compiler_directive_product_string) ||
|
||||
compilerDirectives.ContainsKey(StringConstants.compiler_directive_version_string) ||
|
||||
compilerDirectives.ContainsKey(StringConstants.compiler_directive_company_string) ||
|
||||
compilerDirectives.ContainsKey(StringConstants.compiler_directive_trademark_string) ||
|
||||
compilerDirectives.ContainsKey(StringConstants.compiler_directive_title_string) ||
|
||||
compilerDirectives.ContainsKey(StringConstants.compiler_directive_description_string) ||
|
||||
compilerDirectives.ContainsKey(StringConstants.compiler_directive_copyright_string))
|
||||
{
|
||||
ErrorsList.Add(new MainResourceNotAllowed(compilerDirectives[0].location));
|
||||
ErrorsList.Add(new MainResourceNotAllowed(compilerDirectivesList[0].location));
|
||||
}
|
||||
TryThrowInvalidPath(compilerDirectives[0].directive, compilerDirectives[0].location);
|
||||
TryThrowInvalidPath(compilerDirectivesList[0].directive, compilerDirectivesList[0].location);
|
||||
// Тут не обязательно нормализовывать путь
|
||||
// И если он слишком длинный - File.Exists вернёт false
|
||||
compilerOptions.MainResourceFileName = Path.Combine(Path.GetDirectoryName(compilerDirectives[0].source_file), compilerDirectives[0].directive);
|
||||
compilerOptions.MainResourceFileName = Path.Combine(Path.GetDirectoryName(compilerDirectivesList[0].source_file), compilerDirectivesList[0].directive);
|
||||
if (!File.Exists(compilerOptions.MainResourceFileName))
|
||||
ErrorsList.Add(new ResourceFileNotFound(compilerDirectives[0].directive, compilerDirectives[0].location));
|
||||
ErrorsList.Add(new ResourceFileNotFound(compilerDirectivesList[0].directive, compilerDirectivesList[0].location));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2230,7 +2235,7 @@ namespace PascalABCCompiler
|
|||
PrepareCompileOptionsForProject();
|
||||
}
|
||||
|
||||
#region CONSTRUCTING SYNTAX AND SEMANTIC TREES STAGE
|
||||
#region CONSTRUCTING SYNTAX AND SEMANTIC TREES
|
||||
|
||||
// компиляция всех юнитов произойдет рекурсивно (кроме отложенных)
|
||||
CompileUnit(
|
||||
|
|
@ -2248,7 +2253,7 @@ namespace PascalABCCompiler
|
|||
|
||||
PrebuildMainSemanticTreeActions(out var compilerOptions, out var resourceFiles);
|
||||
|
||||
#region GENERATING CODE STAGE
|
||||
#region GENERATING CODE
|
||||
if (ErrorsList.Count == 0)
|
||||
{
|
||||
|
||||
|
|
@ -2327,6 +2332,12 @@ namespace PascalABCCompiler
|
|||
else return CompilerOptions.OutputFileName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Сохраняет документацию для модулей;
|
||||
/// Выясняет тип выходного файла, целевой фреймворк, платформу;
|
||||
/// Заполняет опции компиляции согласно директивам и/или информации из проекта;
|
||||
/// Находит ресурсные файлы из директив
|
||||
/// </summary>
|
||||
private void PrebuildMainSemanticTreeActions(out NETGenerator.CompilerOptions compilerOptions, out List<string> resourceFiles)
|
||||
{
|
||||
if (CompilerOptions.SaveDocumentation)
|
||||
|
|
@ -2334,37 +2345,30 @@ namespace PascalABCCompiler
|
|||
SaveDocumentationsForUnits();
|
||||
}
|
||||
|
||||
compilerDirectives = GetCompilerDirectives(UnitsTopologicallySortedList);
|
||||
Dictionary<string, List<TreeRealization.compiler_directive>> compilerDirectives = GetCompilerDirectives(UnitsTopologicallySortedList);
|
||||
|
||||
// выяснение типа выходного файла по соотв. директиве компилятора
|
||||
SetOutputFileTypeOption();
|
||||
SetOutputFileTypeOption(compilerDirectives);
|
||||
|
||||
// перемещаем PABCSystem в начало списка
|
||||
MoveSystemUnitForwardInUnitsTopologicallySortedList();
|
||||
|
||||
// передача информации о типе выходного файла системному юниту
|
||||
if (UnitsTopologicallySortedList.Count > 0)
|
||||
{
|
||||
bool isConsoleApplication = CompilerOptions.OutputFileType == CompilerOptions.OutputType.ConsoleApplicaton;
|
||||
common_unit_node systemUnit = UnitsTopologicallySortedList[0].SemanticTree as common_unit_node;
|
||||
systemUnit.IsConsoleApplicationVariable = isConsoleApplication;
|
||||
}
|
||||
// MoveSystemUnitForwardInUnitsTopologicallySortedList();
|
||||
|
||||
compilerOptions = new NETGenerator.CompilerOptions();
|
||||
|
||||
// выяснение TargetFramework и целевой платформы
|
||||
SetOutputPlatformOption(compilerOptions);
|
||||
SetOutputPlatformOption(compilerOptions, compilerDirectives);
|
||||
|
||||
// остальные директивы
|
||||
FillCompilerInfoOptions(compilerOptions);
|
||||
// заполнение опций компилятора из директив
|
||||
FillCompilerInfoOptions(compilerOptions, compilerDirectives);
|
||||
|
||||
// получние путей к файлам ресурсов из директив
|
||||
resourceFiles = GetResourceFilesFromCompilerDirectives(compilerDirectives);
|
||||
|
||||
// заполнение опций компилятора из заголовка проекта
|
||||
FillCompilerOptionsFromProject(compilerOptions);
|
||||
|
||||
// Устанавливает опции компилятора, связанные с типом выходного файла
|
||||
SetTargetTypeOption(compilerOptions);
|
||||
|
||||
resourceFiles = GetResourceFilesFromCompilerDirectives();
|
||||
}
|
||||
|
||||
private program_node ConstructMainSemanticTree(NETGenerator.CompilerOptions compilerOptions)
|
||||
|
|
@ -2554,13 +2558,13 @@ namespace PascalABCCompiler
|
|||
}
|
||||
}
|
||||
|
||||
private List<string> GetResourceFilesFromCompilerDirectives()
|
||||
private List<string> GetResourceFilesFromCompilerDirectives(Dictionary<string, List<TreeRealization.compiler_directive>> compilerDirectives)
|
||||
{
|
||||
List<string> ResourceFiles = null;
|
||||
if (compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.compiler_directive_resource))
|
||||
if (compilerDirectives.ContainsKey(StringConstants.compiler_directive_resource))
|
||||
{
|
||||
ResourceFiles = new List<string>();
|
||||
List<compiler_directive> ResourceDirectives = compilerDirectives[TreeConverter.compiler_string_consts.compiler_directive_resource];
|
||||
List<compiler_directive> ResourceDirectives = compilerDirectives[StringConstants.compiler_directive_resource];
|
||||
|
||||
foreach (compiler_directive cd in ResourceDirectives)
|
||||
{
|
||||
|
|
@ -2908,7 +2912,7 @@ namespace PascalABCCompiler
|
|||
|
||||
// Наверное, этот код MikhailoMMX лишний
|
||||
//MikhailoMMX PABCRtl.dll будем искать сначала в GAC, а потом в папке с программой
|
||||
if (FileName == TreeConverter.compiler_string_consts.pabc_rtl_dll_name)
|
||||
if (FileName == StringConstants.pabc_rtl_dll_name)
|
||||
{
|
||||
|
||||
string name = get_assembly_path(FileName, true);
|
||||
|
|
@ -3150,7 +3154,7 @@ namespace PascalABCCompiler
|
|||
{
|
||||
var directives = GetDirectivesAsSemanticNodes(unit.SyntaxTree.compiler_directives, unit.SyntaxTree.file_name);
|
||||
|
||||
return directives.Any(directive => directive.name.ToLower() == TreeConverter.compiler_string_consts.include_namespace_directive);
|
||||
return directives.Any(directive => directive.name.ToLower() == StringConstants.compiler_directive_include_namespace);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3289,7 +3293,7 @@ namespace PascalABCCompiler
|
|||
List<string> files = new List<string>();
|
||||
foreach (compiler_directive cd in directives)
|
||||
{
|
||||
if (cd.name.ToLower() == TreeConverter.compiler_string_consts.include_namespace_directive)
|
||||
if (cd.name.ToLower() == StringConstants.compiler_directive_include_namespace)
|
||||
{
|
||||
string directive = cd.directive.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar);
|
||||
|
||||
|
|
@ -3362,12 +3366,8 @@ namespace PascalABCCompiler
|
|||
var referenceDirectives = new List<compiler_directive>();
|
||||
foreach (compiler_directive directive in directives)
|
||||
{
|
||||
if (directive.name.ToLower() == TreeConverter.compiler_string_consts.compiler_directive_reference)
|
||||
if (directive.name.ToLower() == StringConstants.compiler_directive_reference)
|
||||
{
|
||||
#region SEMANTIC CHECKS : EMPTY REFERENCE
|
||||
if (string.IsNullOrEmpty(directive.directive))
|
||||
throw new TreeConverter.SimpleSemanticError(directive.location, "EXPECTED_ASSEMBLY_NAME"); // Семантическая ошибка
|
||||
#endregion
|
||||
|
||||
referenceDirectives.Add(directive);
|
||||
}
|
||||
|
|
@ -3403,7 +3403,7 @@ namespace PascalABCCompiler
|
|||
{
|
||||
foreach (compiler_directive cd in directives)
|
||||
{
|
||||
if (cd.name.ToLower() == TreeConverter.compiler_string_consts.compiler_directive_platformtarget
|
||||
if (cd.name.ToLower() == StringConstants.compiler_directive_platformtarget
|
||||
&& !string.IsNullOrEmpty(cd.directive) && cd.directive.IndexOf("dotnet5") != -1)
|
||||
{
|
||||
CompilerOptions.UseDllForSystemUnits = false;
|
||||
|
|
@ -4294,7 +4294,7 @@ namespace PascalABCCompiler
|
|||
if (((SyntaxTree.unit_module)Unit.SyntaxTree).unit_name.HeaderKeyword == PascalABCCompiler.SyntaxTree.UnitHeaderKeyword.Library)
|
||||
return;
|
||||
foreach (SyntaxTree.compiler_directive cd in Unit.SyntaxTree.compiler_directives)
|
||||
if (cd.Name.text.ToLower() == TreeConverter.compiler_string_consts.compiler_savepcu)
|
||||
if (cd.Name.text.ToLower() == StringConstants.compiler_directive_savepcu)
|
||||
if (!Convert.ToBoolean(cd.Directive.text))
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,6 +143,10 @@
|
|||
<Project>{613E0DDA-AA8A-437C-AC45-507B47429FF9}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\StringConstants\StringConstants.csproj">
|
||||
<Project>{e8aefbf9-0113-4fa4-be45-6cda555498b7}</Project>
|
||||
<Name>StringConstants</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SyntaxTreeConverters\SyntaxTreeConverters.csproj">
|
||||
<Project>{f10a5330-dcf4-4533-877c-7b1b1be23884}</Project>
|
||||
<Name>SyntaxTreeConverters</Name>
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ namespace PascalABCCompiler
|
|||
|
||||
private string get_delegate_name(common_type_node ctn)
|
||||
{
|
||||
common_method_node cmn = ctn.find_first_in_type(compiler_string_consts.invoke_method_name).sym_info as common_method_node;
|
||||
common_method_node cmn = ctn.find_first_in_type(StringConstants.invoke_method_name).sym_info as common_method_node;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (cmn.return_value_type != null)
|
||||
sb.Append("@function");
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ namespace PascalABCCompiler.PCU
|
|||
|
||||
//TODO сохранить в PCU
|
||||
cun.scope.CaseSensitive = false;
|
||||
if (string.Compare(unit_name, compiler_string_consts.pascalSystemUnitName, true)==0)
|
||||
if (string.Compare(unit_name, StringConstants.pascalSystemUnitName, true)==0)
|
||||
PascalABCCompiler.TreeConverter.syntax_tree_visitor.init_system_module(cun);
|
||||
//ssyy
|
||||
//Создаём область видимости для implementation - части
|
||||
|
|
@ -1764,9 +1764,9 @@ namespace PascalABCCompiler.PCU
|
|||
cmn.function_code = GetCode(br.ReadInt32());
|
||||
cmn.cont_type.methods.AddElement(cmn);
|
||||
if (cmn.name == "op_Equality")
|
||||
cmn.cont_type.scope.AddSymbol(compiler_string_consts.eq_name, new SymbolInfo(cmn));
|
||||
cmn.cont_type.scope.AddSymbol(StringConstants.eq_name, new SymbolInfo(cmn));
|
||||
else if (cmn.name == "op_Inequality")
|
||||
cmn.cont_type.scope.AddSymbol(compiler_string_consts.noteq_name, new SymbolInfo(cmn));
|
||||
cmn.cont_type.scope.AddSymbol(StringConstants.noteq_name, new SymbolInfo(cmn));
|
||||
return cmn;
|
||||
}
|
||||
|
||||
|
|
@ -1999,10 +1999,10 @@ namespace PascalABCCompiler.PCU
|
|||
|
||||
private void AddEnumOperators(common_type_node tctn)
|
||||
{
|
||||
/*basic_function_node enum_gr = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.gr_name,tctn,SemanticTree.basic_function_type.enumgr,SystemLibrary.SystemLibrary.bool_type);
|
||||
basic_function_node enum_greq = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.greq_name,tctn,SemanticTree.basic_function_type.enumgreq,SystemLibrary.SystemLibrary.bool_type);
|
||||
basic_function_node enum_sm = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.sm_name,tctn,SemanticTree.basic_function_type.enumsm,SystemLibrary.SystemLibrary.bool_type);
|
||||
basic_function_node enum_smeq = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.smeq_name,tctn,SemanticTree.basic_function_type.enumsmeq,SystemLibrary.SystemLibrary.bool_type);*/
|
||||
/*basic_function_node enum_gr = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.gr_name,tctn,SemanticTree.basic_function_type.enumgr,SystemLibrary.SystemLibrary.bool_type);
|
||||
basic_function_node enum_greq = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.greq_name,tctn,SemanticTree.basic_function_type.enumgreq,SystemLibrary.SystemLibrary.bool_type);
|
||||
basic_function_node enum_sm = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.sm_name,tctn,SemanticTree.basic_function_type.enumsm,SystemLibrary.SystemLibrary.bool_type);
|
||||
basic_function_node enum_smeq = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.smeq_name,tctn,SemanticTree.basic_function_type.enumsmeq,SystemLibrary.SystemLibrary.bool_type);*/
|
||||
compilation_context.add_convertions_to_enum_type(tctn);
|
||||
}
|
||||
|
||||
|
|
@ -2256,9 +2256,9 @@ namespace PascalABCCompiler.PCU
|
|||
|
||||
if (type_is_delegate)
|
||||
{
|
||||
SymbolInfo sim = ctn.find_first_in_type(compiler_string_consts.invoke_method_name);
|
||||
SymbolInfo sim = ctn.find_first_in_type(StringConstants.invoke_method_name);
|
||||
common_method_node invoke_method = sim.sym_info as common_method_node;
|
||||
sim = ctn.find_first_in_type(compiler_string_consts.default_constructor_name);
|
||||
sim = ctn.find_first_in_type(StringConstants.default_constructor_name);
|
||||
common_method_node constructor = sim.sym_info as common_method_node;
|
||||
delegate_internal_interface dii = new delegate_internal_interface(invoke_method.return_value_type, invoke_method, constructor);
|
||||
dii.parameters.AddRange(invoke_method.parameters);
|
||||
|
|
@ -2277,7 +2277,7 @@ namespace PascalABCCompiler.PCU
|
|||
{
|
||||
foreach (common_type_node par in ctn.generic_params)
|
||||
{
|
||||
SymbolInfo tsi = ctn.find_first_in_type(compiler_string_consts.generic_param_kind_prefix + par.name);
|
||||
SymbolInfo tsi = ctn.find_first_in_type(StringConstants.generic_param_kind_prefix + par.name);
|
||||
if (tsi != null)
|
||||
{
|
||||
par.runtime_initialization_marker = tsi.sym_info as class_field;
|
||||
|
|
@ -2516,8 +2516,8 @@ namespace PascalABCCompiler.PCU
|
|||
{
|
||||
if (ctn.fields[0].type is simple_array)
|
||||
{
|
||||
ctn.find(TreeConverter.compiler_string_consts.upper_array_const_name);
|
||||
ctn.find(TreeConverter.compiler_string_consts.lower_array_const_name);
|
||||
ctn.find(StringConstants.upper_array_const_name);
|
||||
ctn.find(StringConstants.lower_array_const_name);
|
||||
constant_node lower_bound = ctn.const_defs[1].const_value;
|
||||
constant_node upper_bound = ctn.const_defs[0].const_value;
|
||||
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ namespace PascalABCCompiler.PCU
|
|||
{
|
||||
if (base_type != null && base_type.IsDelegate)
|
||||
return base_type.find_in_type(name, CurrentScope, null, no_search_in_extension_methods);
|
||||
else if (name == compiler_string_consts.deconstruct_method_name)
|
||||
else if (name == StringConstants.deconstruct_method_name)
|
||||
return SystemLibrary.SystemLibrary.object_type.find_in_type(name, CurrentScope, null, no_search_in_extension_methods);
|
||||
|
||||
// SSM перенес из common_type_node (types.cs 2116) - без этого не работали методы расширения последовательностей для типов в pcu, реализующих IEnumerable<T>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace PascalABCCompiler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,46 +34,46 @@ namespace PascalABCCompiler.NETGenerator {
|
|||
|
||||
static OperatorsNameConvertor()
|
||||
{
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name]="op_Addition";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name]="op_Subtraction";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name]="op_Multiply";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.div_name]="op_Division";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.and_name]="op_BitwiseAnd";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.or_name]="op_BitwiseOr";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name]="op_Equality";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name]="op_GreaterThan";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name]="op_GreaterThanOrEqual";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name]="op_LessThan";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name]="op_LessThanOrEqual";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name]="op_Modulus";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.not_name]="op_LogicalNot";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name]="op_Inequality";
|
||||
names[StringConstants.plus_name]="op_Addition";
|
||||
names[StringConstants.minus_name]="op_Subtraction";
|
||||
names[StringConstants.mul_name]="op_Multiply";
|
||||
names[StringConstants.div_name]="op_Division";
|
||||
names[StringConstants.and_name]="op_BitwiseAnd";
|
||||
names[StringConstants.or_name]="op_BitwiseOr";
|
||||
names[StringConstants.eq_name]="op_Equality";
|
||||
names[StringConstants.gr_name]="op_GreaterThan";
|
||||
names[StringConstants.greq_name]="op_GreaterThanOrEqual";
|
||||
names[StringConstants.sm_name]="op_LessThan";
|
||||
names[StringConstants.smeq_name]="op_LessThanOrEqual";
|
||||
names[StringConstants.mod_name]="op_Modulus";
|
||||
names[StringConstants.not_name]="op_LogicalNot";
|
||||
names[StringConstants.noteq_name]="op_Inequality";
|
||||
|
||||
//op_Implicit
|
||||
//op_Explicit
|
||||
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name]="op_ExclusiveOr";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.and_name]="op_LogicalAnd";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.or_name]="op_LogicalOr";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.assign_name]="op_Assign";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name]="op_LeftShift";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name]="op_RightShift";
|
||||
//names["op_SignedRightShift"]=PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name;
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name]="op_UnsignedRightShift";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name]="op_Equality";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.multassign_name]="op_MultiplicationAssignment";
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.minusassign_name]="op_SubtractionAssignment";
|
||||
//names[PascalABCCompiler.TreeConverter.compiler_string_consts.minusassign_name]="op_ExclusiveOrAssignment";
|
||||
names[StringConstants.xor_name]="op_ExclusiveOr";
|
||||
names[StringConstants.and_name]="op_LogicalAnd";
|
||||
names[StringConstants.or_name]="op_LogicalOr";
|
||||
names[StringConstants.assign_name]="op_Assign";
|
||||
names[StringConstants.shl_name]="op_LeftShift";
|
||||
names[StringConstants.shr_name]="op_RightShift";
|
||||
//names["op_SignedRightShift"]=StringConstants.shr_name;
|
||||
names[StringConstants.shr_name]="op_UnsignedRightShift";
|
||||
names[StringConstants.eq_name]="op_Equality";
|
||||
names[StringConstants.multassign_name]="op_MultiplicationAssignment";
|
||||
names[StringConstants.minusassign_name]="op_SubtractionAssignment";
|
||||
//names[StringConstants.minusassign_name]="op_ExclusiveOrAssignment";
|
||||
//op_LeftShiftAssignment
|
||||
//op_ModulusAssignment
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.plusassign_name]="op_AdditionAssignment";
|
||||
names[StringConstants.plusassign_name]="op_AdditionAssignment";
|
||||
//op_BitwiseAndAssignment
|
||||
//op_BitwiseOrAssignment
|
||||
//op_Comma
|
||||
names[PascalABCCompiler.TreeConverter.compiler_string_consts.divassign_name]="op_DivisionAssignment";
|
||||
names[StringConstants.divassign_name]="op_DivisionAssignment";
|
||||
//op_Decrement
|
||||
//op_Increment
|
||||
//names[PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name] ="op_UnaryNegation";
|
||||
//names[StringConstants.minus_name] ="op_UnaryNegation";
|
||||
//op_UnaryPlus
|
||||
//op_OnesComplement
|
||||
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
get
|
||||
{
|
||||
if (fileOfAttributeConstructor != null) return fileOfAttributeConstructor;
|
||||
TypeBuilder tb = mb.DefineType(PascalABCCompiler.TreeConverter.compiler_string_consts.file_of_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
TypeBuilder tb = mb.DefineType(StringConstants.file_of_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
types.Add(tb);
|
||||
fileOfAttributeConstructor = tb.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, new Type[1] { TypeFactory.ObjectType });
|
||||
FieldBuilder fld = tb.DefineField("Type", TypeFactory.ObjectType, FieldAttributes.Public);
|
||||
|
|
@ -326,7 +326,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
get
|
||||
{
|
||||
if (setOfAttributeConstructor != null) return setOfAttributeConstructor;
|
||||
TypeBuilder tb = mb.DefineType(PascalABCCompiler.TreeConverter.compiler_string_consts.set_of_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
TypeBuilder tb = mb.DefineType(StringConstants.set_of_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
types.Add(tb);
|
||||
setOfAttributeConstructor = tb.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, new Type[1] { TypeFactory.ObjectType });
|
||||
FieldBuilder fld = tb.DefineField("Type", TypeFactory.ObjectType, FieldAttributes.Public);
|
||||
|
|
@ -347,7 +347,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
get
|
||||
{
|
||||
if (templateClassAttributeConstructor != null) return templateClassAttributeConstructor;
|
||||
TypeBuilder tb = mb.DefineType(PascalABCCompiler.TreeConverter.compiler_string_consts.template_class_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
TypeBuilder tb = mb.DefineType(StringConstants.template_class_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
types.Add(tb);
|
||||
templateClassAttributeConstructor = tb.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, new Type[1] { TypeFactory.ByteType.MakeArrayType() });
|
||||
FieldBuilder fld = tb.DefineField("Tree", TypeFactory.ByteType.MakeArrayType(), FieldAttributes.Public);
|
||||
|
|
@ -368,7 +368,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
get
|
||||
{
|
||||
if (typeSynonimAttributeConstructor != null) return typeSynonimAttributeConstructor;
|
||||
TypeBuilder tb = mb.DefineType(PascalABCCompiler.TreeConverter.compiler_string_consts.type_synonim_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
TypeBuilder tb = mb.DefineType(StringConstants.type_synonim_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
types.Add(tb);
|
||||
typeSynonimAttributeConstructor = tb.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, new Type[1] { TypeFactory.ObjectType });
|
||||
FieldBuilder fld = tb.DefineField("Type", TypeFactory.ObjectType, FieldAttributes.Public);
|
||||
|
|
@ -389,7 +389,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
get
|
||||
{
|
||||
if (shortStringAttributeConstructor != null) return shortStringAttributeConstructor;
|
||||
TypeBuilder tb = mb.DefineType(PascalABCCompiler.TreeConverter.compiler_string_consts.short_string_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
TypeBuilder tb = mb.DefineType(StringConstants.short_string_attr_name, TypeAttributes.Public | TypeAttributes.BeforeFieldInit, typeof(Attribute));
|
||||
types.Add(tb);
|
||||
shortStringAttributeConstructor = tb.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, new Type[1] { TypeFactory.Int32Type });
|
||||
FieldBuilder fld = tb.DefineField("Length", TypeFactory.Int32Type, FieldAttributes.Public);
|
||||
|
|
@ -463,8 +463,8 @@ namespace PascalABCCompiler.NETGenerator
|
|||
bool IsDllAndSystemNamespace(string name, string DllFileName)
|
||||
{
|
||||
return comp_opt.target == TargetType.Dll && DllFileName != "PABCRtl.dll" &&
|
||||
(name == compiler_string_consts.pascalSystemUnitName || name == compiler_string_consts.pascalExtensionsUnitName ||
|
||||
name.EndsWith(PascalABCCompiler.TreeConverter.compiler_string_consts.ImplementationSectionNamespaceName));
|
||||
(name == StringConstants.pascalSystemUnitName || name == StringConstants.pascalExtensionsUnitName ||
|
||||
name.EndsWith(StringConstants.ImplementationSectionNamespaceName));
|
||||
}
|
||||
|
||||
bool IsDotnet5()
|
||||
|
|
|
|||
|
|
@ -125,6 +125,10 @@
|
|||
<Project>{613E0DDA-AA8A-437C-AC45-507B47429FF9}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\StringConstants\StringConstants.csproj">
|
||||
<Project>{e8aefbf9-0113-4fa4-be45-6cda555498b7}</Project>
|
||||
<Name>StringConstants</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TreeConverter\TreeConverter.csproj">
|
||||
<Project>{1C9C945A-586D-42A2-A06B-65D84FA7FF78}</Project>
|
||||
<Name>TreeConverter</Name>
|
||||
|
|
|
|||
|
|
@ -1111,7 +1111,7 @@ namespace PascalABCCompiler
|
|||
private void VisitCommonNamespaceFunctionCall(common_namespace_function_call en)
|
||||
{
|
||||
CheckInfiniteRecursion(en);
|
||||
if ((en.function_node.name == "Reset" || en.function_node.name == "Rewrite" || en.function_node.name == "Assign") && en.function_node.comprehensive_namespace.namespace_name == compiler_string_consts.pascalSystemUnitName)
|
||||
if ((en.function_node.name == "Reset" || en.function_node.name == "Rewrite" || en.function_node.name == "Assign") && en.function_node.comprehensive_namespace.namespace_name == StringConstants.pascalSystemUnitName)
|
||||
{
|
||||
expression_node p = en.parameters[0];
|
||||
switch (p.semantic_node_type)
|
||||
|
|
|
|||
|
|
@ -82,6 +82,10 @@
|
|||
<Project>{613E0DDA-AA8A-437C-AC45-507B47429FF9}</Project>
|
||||
<Name>SemanticTree</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\StringConstants\StringConstants.csproj">
|
||||
<Project>{e8aefbf9-0113-4fa4-be45-6cda555498b7}</Project>
|
||||
<Name>StringConstants</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TreeConverter\TreeConverter.csproj">
|
||||
<Project>{1C9C945A-586D-42A2-A06B-65D84FA7FF78}</Project>
|
||||
<Name>TreeConverter</Name>
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
<Compile Include="ParsersController.cs" />
|
||||
<Compile Include="ParserTools\BaseParser.cs" />
|
||||
<Compile Include="ParserTools\BaseParserTools.cs" />
|
||||
<Compile Include="ParserTools\DirectiveHelper.cs" />
|
||||
<Compile Include="ParserTools\IParser.cs" />
|
||||
<Compile Include="ParserTools\CommentBinder.cs" />
|
||||
<Compile Include="ParserTools\DefaultLanguageInformation.cs" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// 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 System.Text.RegularExpressions;
|
||||
using PascalABCCompiler.Errors;
|
||||
using PascalABCCompiler.SyntaxTree;
|
||||
|
||||
|
|
@ -111,6 +112,8 @@ namespace PascalABCCompiler.Parsers
|
|||
|
||||
public string[] SystemUnitNames { get; }
|
||||
|
||||
public Dictionary<string, ParserTools.Directives.DirectiveInfo> ValidDirectives { get; protected set; }
|
||||
|
||||
public SourceFilesProviderDelegate sourceFilesProvider = null;
|
||||
public virtual SourceFilesProviderDelegate SourceFilesProvider
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using QUT.Gppg;
|
||||
using PascalABCCompiler.Parsers;
|
||||
using PascalABCCompiler.ParserTools.Directives;
|
||||
|
||||
namespace PascalABCCompiler.ParserTools
|
||||
{
|
||||
|
|
@ -37,6 +39,9 @@ namespace PascalABCCompiler.ParserTools
|
|||
|
||||
public static Dictionary<string, string> tokenNum; // строки, соответствующие терминалам, для вывода ошибок - SSM
|
||||
|
||||
protected BaseParser parserCached;
|
||||
protected abstract BaseParser ParserCached { get; }
|
||||
|
||||
public SourceContext ToSourceContext(LexLocation loc)
|
||||
{
|
||||
if (loc != null)
|
||||
|
|
@ -83,12 +88,96 @@ namespace PascalABCCompiler.ParserTools
|
|||
warnings.Add(new CommonWarning(res, currentFileName, loc.begin_position.line_num, loc.begin_position.column_num));
|
||||
}
|
||||
|
||||
public string ReplaceSpecialSymbols(string text)
|
||||
protected string ReplaceSpecialSymbols(string text)
|
||||
{
|
||||
text = text.Replace("''", "'");
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление кавычек у параметра директивы
|
||||
/// </summary>
|
||||
protected string DeleteQuotesFromDirectiveParam(string param)
|
||||
{
|
||||
if (param.Length != 1 && param.StartsWith("'") && param.EndsWith("'"))
|
||||
return param.Substring(1, param.Length - 2);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Проверка директивы с помощью проверок из Parser.ValidDirectives
|
||||
/// </summary>
|
||||
public void CheckDirectiveParams(string directiveName, List<string> directiveParams, SourceContext loc)
|
||||
{
|
||||
BaseParser parserNeeded = ParserCached;
|
||||
|
||||
// проверка имени директивы
|
||||
if (!parserNeeded.ValidDirectives.ContainsKey(directiveName))
|
||||
{
|
||||
AddWarningFromResource("UNKNOWN_DIRECTIVE{0}", loc, directiveName); // предупреждение для совместимости с Delphi
|
||||
return;
|
||||
}
|
||||
|
||||
var directiveInfo = parserNeeded.ValidDirectives[directiveName];
|
||||
|
||||
// случай директивы, переданной без параметров
|
||||
if (directiveParams.Count == 0)
|
||||
{
|
||||
// если задан формат параметров и не поддерживается 0 параметров
|
||||
if (directiveInfo != null && directiveInfo.checkParamsNumNeeded && !directiveInfo.paramsNums.Contains(0))
|
||||
{
|
||||
AddErrorFromResource("MISSING_DIRECTIVE_PARAM{0}", loc, directiveName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// проверка на добавление параметров директиве без параметров
|
||||
if (directiveInfo == null)
|
||||
{
|
||||
AddErrorFromResource("UNNECESSARY_DIRECTIVE_PARAM{0}", loc, directiveName);
|
||||
return;
|
||||
}
|
||||
|
||||
// проверка кол-ва параметров директивы (учитывается случай, когда их может не быть)
|
||||
if (directiveInfo.checkParamsNumNeeded && !directiveInfo.paramsNums.Contains(directiveParams.Count))
|
||||
{
|
||||
AddWrongNumberOfParamsError(directiveName, directiveParams, loc, directiveInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
// проверки параметров по отдельности
|
||||
if (!directiveInfo.ParamsValid(directiveParams, out int indexOfMismatch, out string specificErrorMessage))
|
||||
{
|
||||
AddErrorFromResource("INCORRECT_DIRECTIVE_PARAM{0}{1}{2}", loc, directiveName, directiveParams[indexOfMismatch], specificErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Формирование ошибки неправильного кол-ва параметров директивы в зависимости от возможных количеств из DirectiveInfo
|
||||
/// </summary>
|
||||
private void AddWrongNumberOfParamsError(string directiveName, List<string> directiveParams, SourceContext loc, DirectiveInfo directiveInfo)
|
||||
{
|
||||
string paramsNumString = "";
|
||||
int maxParamsNum = directiveInfo.paramsNums.Max();
|
||||
|
||||
if (directiveInfo.paramsNums.Length > 1)
|
||||
{
|
||||
if (directiveParams.Count > maxParamsNum)
|
||||
{
|
||||
string paramString = maxParamsNum > 1 ? GetFromStringResources("PARAM_MULTIPLE1") : GetFromStringResources("PARAM_SINGLE2");
|
||||
paramsNumString = GetFromStringResources("NOT_MORE_THAN") + " " + maxParamsNum + " " + paramString;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string paramString = directiveInfo.paramsNums[0] > 1 ? GetFromStringResources("PARAM_MULTIPLE2") : GetFromStringResources("PARAM_SINGLE1");
|
||||
paramsNumString = GetFromStringResources("EXACTLY") + " " + directiveInfo.paramsNums[0] + " " + paramString;
|
||||
}
|
||||
|
||||
AddErrorFromResource("DIRECTIVE_WRONG_NUMBER_OF_PARAMS{0}{1}", loc, directiveName, paramsNumString);
|
||||
}
|
||||
|
||||
public char_const create_char_const(string text, SourceContext sc)
|
||||
{
|
||||
string char_text = new string(text.ToCharArray(1, text.Length - 2));
|
||||
|
|
|
|||
|
|
@ -1015,7 +1015,7 @@ namespace PascalABCCompiler.Parsers
|
|||
var strrank = rank > 1 ? "[" + new string(',', rank - 1) + "]" : "";
|
||||
return $"array{strrank}" + " of " + GetShortTypeName(ctn.GetElementType());
|
||||
}
|
||||
//if (ctn == Type.GetType("System.Void*")) return PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name;
|
||||
//if (ctn == Type.GetType("System.Void*")) return StringConstants.pointer_type_name;
|
||||
return ctn.Name;
|
||||
}
|
||||
|
||||
|
|
@ -3952,7 +3952,7 @@ namespace PascalABCCompiler.Parsers
|
|||
return sb.ToString();
|
||||
}
|
||||
//if (ctn.IsArray) return "array of "+GetTypeName(ctn.GetElementType());
|
||||
//if (ctn == Type.GetType("System.Void*")) return PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name;
|
||||
//if (ctn == Type.GetType("System.Void*")) return StringConstants.pointer_type_name;
|
||||
return ctn.Name;
|
||||
}
|
||||
|
||||
|
|
|
|||
222
ParserTools/ParserTools/DirectiveHelper.cs
Normal file
222
ParserTools/ParserTools/DirectiveHelper.cs
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using PascalABCCompiler.Errors;
|
||||
|
||||
namespace PascalABCCompiler.ParserTools.Directives
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс для хранения информации о директиве компилятора (количество параметров, проверки для параметров и др.)
|
||||
/// </summary>
|
||||
public class DirectiveInfo
|
||||
{
|
||||
private ParamChecksCollection checks;
|
||||
|
||||
public int[] paramsNums = new int[1] { 1 }; // по умолчанию один параметр
|
||||
public bool checkParamsNumNeeded;
|
||||
|
||||
// по умолчанию никаких проверок параметров, но включена проверка их кол-ва
|
||||
public DirectiveInfo(ParamChecksCollection paramChecks = null, bool checkParamsNumNeeded = true, int[] paramsNums = null)
|
||||
{
|
||||
this.checks = paramChecks;
|
||||
if (paramsNums != null)
|
||||
this.paramsNums = paramsNums;
|
||||
this.checkParamsNumNeeded = checkParamsNumNeeded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Функция для проверки всех параметров директивы
|
||||
/// </summary>
|
||||
public bool ParamsValid(List<string> directiveParams, out int indexOfMismatch, out string errorMessage)
|
||||
{
|
||||
// если проверки не нужны
|
||||
if (checks == null)
|
||||
{
|
||||
indexOfMismatch = -1;
|
||||
errorMessage = null;
|
||||
return true;
|
||||
}
|
||||
return checks.CheckParams(directiveParams, out indexOfMismatch, out errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Базовый класс для всех проверок параметров директив
|
||||
/// </summary>
|
||||
public abstract class ParamCheckBase
|
||||
{
|
||||
public int paramsToCheckNum; // кол-во параметров, проверяемых одной проверкой, по умолчанию - 1
|
||||
|
||||
public string errorMessage = "";
|
||||
|
||||
public ParamCheckBase(int paramsToCheckNum = 1)
|
||||
{
|
||||
this.paramsToCheckNum = paramsToCheckNum;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Проверка одного параметра
|
||||
/// </summary>
|
||||
public abstract bool CheckParam(string param);
|
||||
|
||||
/// <summary>
|
||||
/// Проверка нужного кол-ва параметров
|
||||
/// </summary>
|
||||
public bool CheckParams(string[] directiveParams, out int indexOfMismatch)
|
||||
{
|
||||
for (var i = 0; i < directiveParams.Length; i++)
|
||||
{
|
||||
if (!CheckParam(directiveParams[i]))
|
||||
{
|
||||
indexOfMismatch = i;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
indexOfMismatch = -1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Класс для пользовательской проверки параметров (можно передать лямбду с проверкой)
|
||||
/// </summary>
|
||||
public sealed class FuncCheck : ParamCheckBase
|
||||
{
|
||||
Predicate<string> check;
|
||||
|
||||
public FuncCheck(Predicate<string> pred, string errorMessage = "", int paramsToCheckNum = 1) : base(paramsToCheckNum)
|
||||
{
|
||||
this.errorMessage = errorMessage;
|
||||
check = pred;
|
||||
}
|
||||
|
||||
public override bool CheckParam(string s) => check(s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Проверка, что параметр имеет формат идентификатора
|
||||
/// </summary>
|
||||
public class IsValidIdentifierCheck : ParamCheckBase
|
||||
{
|
||||
|
||||
public IsValidIdentifierCheck(int paramsToCheckNum = 1) : base(paramsToCheckNum)
|
||||
{
|
||||
errorMessage = ParserErrorsStringResources.Get("EXPECTED_IDENTIFIER");
|
||||
|
||||
}
|
||||
|
||||
public override bool CheckParam(string param)
|
||||
{
|
||||
return Regex.IsMatch(param, @"^[\p{L}_][\p{L}0-9_]*$");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Проверка принадлежности параметра списку возможных вариантов
|
||||
/// </summary>
|
||||
public class IsAnyOfCheck : ParamCheckBase
|
||||
{
|
||||
private string[] paramVariants;
|
||||
|
||||
public IsAnyOfCheck(int paramsToCheckNum = 1, params string[] paramVariants) : base(paramsToCheckNum)
|
||||
{
|
||||
this.paramVariants = paramVariants;
|
||||
|
||||
if (paramVariants.Length <= 5)
|
||||
{
|
||||
string firstPartOfError = ParserErrorsStringResources.Get("AVAILABLE_PARAM_VARIANTS{0}");
|
||||
errorMessage = string.Format(firstPartOfError, string.Join(", ", paramVariants));
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = ParserErrorsStringResources.Get("SEE_THE_HELP_FOR_VARIANTS");
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CheckParam(string param)
|
||||
{
|
||||
return paramVariants.Contains(param.ToLower());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Проверка, что расширение параметра входит в список возможных расширений
|
||||
/// </summary>
|
||||
public class IsAnyExtensionsOfCheck : ParamCheckBase
|
||||
{
|
||||
private string[] extVariants;
|
||||
|
||||
public IsAnyExtensionsOfCheck(int paramsToCheckNum = 1, params string[] extVariants) : base(paramsToCheckNum)
|
||||
{
|
||||
this.extVariants = extVariants;
|
||||
|
||||
string firstPartOfError = ParserErrorsStringResources.Get("AVAILABLE_EXT_VARIANTS{0}");
|
||||
errorMessage = string.Format(firstPartOfError, string.Join(", ", extVariants));
|
||||
}
|
||||
|
||||
public override bool CheckParam(string param)
|
||||
{
|
||||
return extVariants.Contains(Path.GetExtension(param.ToLower()));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Класс для хранения всех проверок одной директивы
|
||||
/// </summary>
|
||||
public class ParamChecksCollection
|
||||
{
|
||||
private readonly ParamCheckBase[] checks;
|
||||
|
||||
public ParamChecksCollection(params ParamCheckBase[] checks)
|
||||
{
|
||||
this.checks = checks;
|
||||
}
|
||||
|
||||
public bool CheckParams(List<string> directiveParams, out int indexOfMismatch, out string errorMessage)
|
||||
{
|
||||
int directivesChecked = 0;
|
||||
for (var i = 0; i < checks.Length; i++)
|
||||
{
|
||||
// каждая проверка работает с кол-вом параметров, которое в ней указано
|
||||
if (!checks[i].CheckParams(directiveParams.Skip(directivesChecked).Take(checks[i].paramsToCheckNum).ToArray(), out int index))
|
||||
{
|
||||
indexOfMismatch = index;
|
||||
errorMessage = checks[i].errorMessage;
|
||||
return false;
|
||||
}
|
||||
directivesChecked += checks[i].paramsToCheckNum;
|
||||
}
|
||||
|
||||
indexOfMismatch = -1;
|
||||
errorMessage = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Класс вспомогательных методов для работы с директивами
|
||||
/// </summary>
|
||||
public static class DirectiveHelper
|
||||
{
|
||||
#region SINGLE CHECKS WRAPPERS
|
||||
public static ParamChecksCollection SingleAnyOfCheck(params string[] paramVariants)
|
||||
{
|
||||
return new ParamChecksCollection(new IsAnyOfCheck(1, paramVariants));
|
||||
}
|
||||
|
||||
public static ParamChecksCollection SingleAnyExtOfCheck(params string[] extVariants)
|
||||
{
|
||||
return new ParamChecksCollection(new IsAnyExtensionsOfCheck(1, extVariants));
|
||||
}
|
||||
|
||||
public static ParamChecksCollection SingleIsValidIdCheck()
|
||||
{
|
||||
return new ParamChecksCollection(new IsValidIdentifierCheck(1));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ namespace PascalABCCompiler.Errors
|
|||
{
|
||||
public static string Get(string Id)
|
||||
{
|
||||
return PascalABCCompiler.StringResources.Get("PARSER_ERRORS_" + Id);
|
||||
return StringResources.Get("PARSER_ERRORS_" + Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
// 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;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace PascalABCCompiler
|
||||
{
|
||||
|
||||
public enum SourceFileOperation
|
||||
{
|
||||
GetText, GetLastWriteTime, Exists, FileEncoding
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: DESKTOP-V3E9T2U
|
||||
// DateTime: 20.04.2024 21:42:54
|
||||
// DateTime: 27.04.2024 19:33:37
|
||||
// UserName: alex
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
@ -136,15 +136,13 @@ namespace GPPGParserScanner
|
|||
const int EXCLUDETEXT = 5;
|
||||
|
||||
#region user code
|
||||
public PascalParserTools parsertools;
|
||||
public PascalParserTools parserTools;
|
||||
Stack<BufferContext> buffStack = new Stack<BufferContext>();
|
||||
Stack<string> fNameStack = new Stack<string>();
|
||||
Stack<int> IfStack = new Stack<int>(); // 0 - if, 1 - else
|
||||
public List<string> Defines = new List<string>();
|
||||
int IfExclude;
|
||||
string Pars;
|
||||
string directivename;
|
||||
string directiveparam;
|
||||
LexLocation currentLexLocation;
|
||||
bool HiddenIdents = false;
|
||||
bool ExprMode = false;
|
||||
|
|
@ -1785,7 +1783,7 @@ yylval = new Union(); yylval.op = new op_type_node(Operators.Division); return (
|
|||
case 26:
|
||||
case 30:
|
||||
case 32:
|
||||
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}",CurrentLexLocation, yytext);
|
||||
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}",CurrentLexLocation, yytext);
|
||||
return -1;
|
||||
break;
|
||||
case 3:
|
||||
|
|
@ -1861,9 +1859,9 @@ string cur_yytext = yytext;
|
|||
if (res == (int)Tokens.tkIdentifier)
|
||||
{
|
||||
if (cur_yytext[0] == '!' && !HiddenIdents && !ExprMode)
|
||||
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}",CurrentLexLocation, ""+cur_yytext[0]);
|
||||
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}",CurrentLexLocation, ""+cur_yytext[0]);
|
||||
yylval = new Union();
|
||||
yylval.id = parsertools.create_ident(cur_yytext,currentLexLocation);
|
||||
yylval.id = parserTools.create_ident(cur_yytext,currentLexLocation);
|
||||
}
|
||||
else
|
||||
switch (res)
|
||||
|
|
@ -2067,33 +2065,33 @@ return (int)Tokens.INVISIBLE;
|
|||
case 31:
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.ex = parsertools.create_int_const(yytext,currentLexLocation);
|
||||
yylval.ex = parserTools.create_int_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkInteger;
|
||||
break;
|
||||
case 33:
|
||||
case 34:
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.stn = parsertools.create_string_const(yytext,currentLexLocation);
|
||||
yylval.stn = parserTools.create_string_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkStringLiteral;
|
||||
break;
|
||||
case 35:
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.stn = parsertools.create_multiline_string_const(yytext,currentLexLocation);
|
||||
yylval.stn = parserTools.create_multiline_string_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkMultilineStringLiteral;
|
||||
break;
|
||||
case 36:
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.ex = parsertools.create_bigint_const(yytext,currentLexLocation);
|
||||
yylval.ex = parserTools.create_bigint_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkBigInteger;
|
||||
break;
|
||||
case 37:
|
||||
case 38:
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.ex = parsertools.create_double_const(yytext,currentLexLocation);
|
||||
yylval.ex = parserTools.create_double_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkFloat;
|
||||
break;
|
||||
case 39:
|
||||
|
|
@ -2149,7 +2147,7 @@ yylval = new Union();
|
|||
case 55:
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.stn = parsertools.create_sharp_char_const(yytext,currentLexLocation);
|
||||
yylval.stn = parserTools.create_sharp_char_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkAsciiChar;
|
||||
break;
|
||||
case 56:
|
||||
|
|
@ -2170,73 +2168,80 @@ BEGIN(COMMENT1);
|
|||
case 61:
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.ex = parsertools.create_hex_const(yytext,currentLexLocation);
|
||||
yylval.ex = parserTools.create_hex_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkHex;
|
||||
break;
|
||||
case 62:
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.stn = parsertools.create_format_string_const(yytext,currentLexLocation);
|
||||
yylval.stn = parserTools.create_format_string_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkFormatStringLiteral;
|
||||
break;
|
||||
case 63:
|
||||
if (parsertools.buildTreeForFormatter)
|
||||
if (parserTools.buildTreeForFormatter)
|
||||
break;
|
||||
|
||||
parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
|
||||
parsertools.CheckDirectiveParams(directivename,directiveparam); // directivename in UPPERCASE!
|
||||
if (directivename == "HIDDENIDENTS")
|
||||
parserTools.ParseDirective(yytext, CurrentLexLocation, out var directiveName, out var directiveParams);
|
||||
|
||||
if (directiveName == null) // Ñ<>лÑ?Ñ?ай пÑ?Ñ<>Ñ?ой диÑ?екÑ?ивÑ?
|
||||
break;
|
||||
|
||||
parserTools.CheckDirectiveParams(directiveName, directiveParams, CurrentLexLocation);
|
||||
|
||||
directiveName = directiveName.ToUpper();
|
||||
|
||||
if (directiveName == "HIDDENIDENTS")
|
||||
{
|
||||
HiddenIdents = true;
|
||||
}
|
||||
else if (directivename == "INCLUDE")
|
||||
else if (directiveName == "INCLUDE")
|
||||
{
|
||||
TryInclude(directiveparam);
|
||||
TryInclude(directiveParams[0]);
|
||||
}
|
||||
else if (directivename == "IFDEF")
|
||||
else if (directiveName == "IFDEF")
|
||||
{
|
||||
IfStack.Push(0);
|
||||
if (!Defines.Contains(directiveparam))
|
||||
if (!Defines.Contains(directiveParams[0]))
|
||||
{
|
||||
BEGIN(EXCLUDETEXT);
|
||||
IfExclude = 1;
|
||||
}
|
||||
}
|
||||
else if (directivename == "IFNDEF")
|
||||
else if (directiveName == "IFNDEF")
|
||||
{
|
||||
IfStack.Push(0);
|
||||
if (Defines.Contains(directiveparam))
|
||||
if (Defines.Contains(directiveParams[0]))
|
||||
{
|
||||
BEGIN(EXCLUDETEXT);
|
||||
IfExclude = 1;
|
||||
}
|
||||
}
|
||||
else if (directivename == "ELSE")
|
||||
else if (directiveName == "ELSE")
|
||||
{
|
||||
if (IfStack.Count==0)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
if (IfStack.Peek()==1)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
IfStack.Pop();
|
||||
IfStack.Push(1);
|
||||
BEGIN(EXCLUDETEXT);
|
||||
IfExclude = 1;
|
||||
}
|
||||
else if (directivename == "ENDIF")
|
||||
else if (directiveName == "ENDIF")
|
||||
{
|
||||
if (IfStack.Count == 0)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $endif",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $endif",CurrentLexLocation);
|
||||
IfStack.Pop();
|
||||
}
|
||||
else if (directivename == "DEFINE")
|
||||
else if (directiveName == "DEFINE")
|
||||
{
|
||||
if (!Defines.Contains(directiveparam))
|
||||
Defines.Add(directiveparam);
|
||||
if (!Defines.Contains(directiveParams[0]))
|
||||
Defines.Add(directiveParams[0]);
|
||||
}
|
||||
else if (directivename == "UNDEF")
|
||||
else if (directiveName == "UNDEF")
|
||||
{
|
||||
if (Defines.Contains(directiveparam))
|
||||
Defines.Remove(directiveparam);
|
||||
if (Defines.Contains(directiveParams[0]))
|
||||
Defines.Remove(directiveParams[0]);
|
||||
}
|
||||
break;
|
||||
case 64:
|
||||
|
|
@ -2269,31 +2274,38 @@ BEGIN(INITIAL);
|
|||
}
|
||||
break;
|
||||
case 74:
|
||||
parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
|
||||
parsertools.CheckDirectiveParams(directivename,directiveparam); // directivename in UPPERCASE!
|
||||
if (directivename == "IFDEF")
|
||||
parserTools.ParseDirective(yytext, CurrentLexLocation, out directiveName, out directiveParams);
|
||||
|
||||
if (directiveName == null) // Ñ<>лÑ?Ñ?ай пÑ?Ñ<>Ñ?ой диÑ?екÑ?ивÑ?
|
||||
break;
|
||||
|
||||
parserTools.CheckDirectiveParams(directiveName, directiveParams, CurrentLexLocation);
|
||||
|
||||
directiveName = directiveName.ToUpper();
|
||||
|
||||
if (directiveName == "IFDEF")
|
||||
{
|
||||
IfStack.Push(0);
|
||||
IfExclude++;
|
||||
}
|
||||
else if (directivename == "IFNDEF")
|
||||
else if (directiveName == "IFNDEF")
|
||||
{
|
||||
IfStack.Push(0);
|
||||
IfExclude++;
|
||||
}
|
||||
else if (directivename == "ELSE")
|
||||
else if (directiveName == "ELSE")
|
||||
{
|
||||
if (IfStack.Peek() == 1)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
IfStack.Pop();
|
||||
IfStack.Push(1);
|
||||
if (IfExclude == 1)
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
else if (directivename == "ENDIF")
|
||||
else if (directiveName == "ENDIF")
|
||||
{
|
||||
if (IfStack.Count==0)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $endif",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $endif",CurrentLexLocation);
|
||||
IfStack.Pop();
|
||||
IfExclude--;
|
||||
if (IfExclude == 0)
|
||||
|
|
@ -2302,17 +2314,17 @@ parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
|
|||
else if (IfExclude > 0)
|
||||
{
|
||||
int ind_to_remove = -1;
|
||||
for (int i=0; i<parsertools.compilerDirectives.Count; i++)
|
||||
for (int i=0; i<parserTools.compilerDirectives.Count; i++)
|
||||
{
|
||||
if (parsertools.compilerDirectives[i].source_context.begin_position.line_num == CurrentLexLocation.StartLine &&
|
||||
parsertools.compilerDirectives[i].source_context.begin_position.column_num - 2 == CurrentLexLocation.StartColumn + 1)
|
||||
if (parserTools.compilerDirectives[i].source_context.begin_position.line_num == CurrentLexLocation.StartLine &&
|
||||
parserTools.compilerDirectives[i].source_context.begin_position.column_num - 2 == CurrentLexLocation.StartColumn + 1)
|
||||
{
|
||||
ind_to_remove = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ind_to_remove != -1)
|
||||
parsertools.compilerDirectives.RemoveAt(ind_to_remove);
|
||||
parserTools.compilerDirectives.RemoveAt(ind_to_remove);
|
||||
}
|
||||
break;
|
||||
case 75:
|
||||
|
|
@ -2416,32 +2428,32 @@ if (currentLexLocation != null)
|
|||
public LexLocation CurrentLexLocation
|
||||
{
|
||||
get {
|
||||
return new LexLocation(tokLin, tokCol, tokELin, tokECol, parsertools.currentFileName);
|
||||
return new LexLocation(tokLin, tokCol, tokELin, tokECol, parserTools.currentFileName);
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool yywrap()
|
||||
{
|
||||
if (IfStack.Count > 0)
|
||||
parsertools.AddErrorFromResource("ENDIF_ABSENT",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("ENDIF_ABSENT",CurrentLexLocation);
|
||||
BEGIN(INITIAL);
|
||||
if (buffStack.Count == 0)
|
||||
return true;
|
||||
RestoreBuffCtx(buffStack.Pop());
|
||||
parsertools.currentFileName = fNameStack.Pop();
|
||||
parserTools.currentFileName = fNameStack.Pop();
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void yyerror(string format, params object[] args)
|
||||
{
|
||||
string errorMsg = parsertools.CreateErrorString(yytext,args);
|
||||
parsertools.AddError(errorMsg,CurrentLexLocation);
|
||||
string errorMsg = parserTools.CreateErrorString(yytext,args);
|
||||
parserTools.AddError(errorMsg,CurrentLexLocation);
|
||||
}
|
||||
|
||||
private void TryInclude(string fName)
|
||||
{
|
||||
if (fName == null || fName.Length == 0)
|
||||
parsertools.AddErrorFromResource("INCLUDE_EMPTY_FILE",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("INCLUDE_EMPTY_FILE",CurrentLexLocation);
|
||||
else
|
||||
try {
|
||||
if (fName.StartsWith("'"))
|
||||
|
|
@ -2453,22 +2465,22 @@ public LexLocation CurrentLexLocation
|
|||
BufferContext savedCtx = MkBuffCtx();
|
||||
string full_path = fName;
|
||||
if (!Path.IsPathRooted(full_path))
|
||||
full_path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(parsertools.currentFileName), fName));
|
||||
full_path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(parserTools.currentFileName), fName));
|
||||
|
||||
if (fNameStack.Contains(full_path))
|
||||
{
|
||||
parsertools.AddErrorFromResource("RECUR_INCLUDE", CurrentLexLocation, fName);
|
||||
parserTools.AddErrorFromResource("RECUR_INCLUDE", CurrentLexLocation, fName);
|
||||
return;
|
||||
}
|
||||
|
||||
SetSource(File.ReadAllText(full_path), 0);
|
||||
fNameStack.Push(parsertools.currentFileName);
|
||||
parsertools.currentFileName = full_path;
|
||||
fNameStack.Push(parserTools.currentFileName);
|
||||
parserTools.currentFileName = full_path;
|
||||
buffStack.Push(savedCtx);
|
||||
}
|
||||
catch
|
||||
{
|
||||
parsertools.AddErrorFromResource("INCLUDE_COULDNT_OPEN_FILE{0}",CurrentLexLocation,fName);
|
||||
parserTools.AddErrorFromResource("INCLUDE_COULDNT_OPEN_FILE{0}",CurrentLexLocation,fName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
%{
|
||||
public PascalParserTools parsertools;
|
||||
public PascalParserTools parserTools;
|
||||
Stack<BufferContext> buffStack = new Stack<BufferContext>();
|
||||
Stack<string> fNameStack = new Stack<string>();
|
||||
Stack<int> IfStack = new Stack<int>(); // 0 - if, 1 - else
|
||||
public List<string> Defines = new List<string>();
|
||||
int IfExclude;
|
||||
string Pars;
|
||||
string directivename;
|
||||
string directiveparam;
|
||||
LexLocation currentLexLocation;
|
||||
bool HiddenIdents = false;
|
||||
bool ExprMode = false;
|
||||
|
|
@ -68,63 +66,70 @@ UNICODEARROW \x890
|
|||
}
|
||||
|
||||
{DIRECTIVE} {
|
||||
if (parsertools.buildTreeForFormatter)
|
||||
if (parserTools.buildTreeForFormatter)
|
||||
break;
|
||||
|
||||
parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
|
||||
parsertools.CheckDirectiveParams(directivename,directiveparam); // directivename in UPPERCASE!
|
||||
if (directivename == "HIDDENIDENTS")
|
||||
parserTools.ParseDirective(yytext, CurrentLexLocation, out var directiveName, out var directiveParams);
|
||||
|
||||
if (directiveName == null) // случай пустой директивы
|
||||
break;
|
||||
|
||||
parserTools.CheckDirectiveParams(directiveName, directiveParams, CurrentLexLocation);
|
||||
|
||||
directiveName = directiveName.ToUpper();
|
||||
|
||||
if (directiveName == "HIDDENIDENTS")
|
||||
{
|
||||
HiddenIdents = true;
|
||||
}
|
||||
else if (directivename == "INCLUDE")
|
||||
else if (directiveName == "INCLUDE")
|
||||
{
|
||||
TryInclude(directiveparam);
|
||||
TryInclude(directiveParams[0]);
|
||||
}
|
||||
else if (directivename == "IFDEF")
|
||||
else if (directiveName == "IFDEF")
|
||||
{
|
||||
IfStack.Push(0);
|
||||
if (!Defines.Contains(directiveparam))
|
||||
if (!Defines.Contains(directiveParams[0]))
|
||||
{
|
||||
BEGIN(EXCLUDETEXT);
|
||||
IfExclude = 1;
|
||||
}
|
||||
}
|
||||
else if (directivename == "IFNDEF")
|
||||
else if (directiveName == "IFNDEF")
|
||||
{
|
||||
IfStack.Push(0);
|
||||
if (Defines.Contains(directiveparam))
|
||||
if (Defines.Contains(directiveParams[0]))
|
||||
{
|
||||
BEGIN(EXCLUDETEXT);
|
||||
IfExclude = 1;
|
||||
}
|
||||
}
|
||||
else if (directivename == "ELSE")
|
||||
else if (directiveName == "ELSE")
|
||||
{
|
||||
if (IfStack.Count==0)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
if (IfStack.Peek()==1)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
IfStack.Pop();
|
||||
IfStack.Push(1);
|
||||
BEGIN(EXCLUDETEXT);
|
||||
IfExclude = 1;
|
||||
}
|
||||
else if (directivename == "ENDIF")
|
||||
else if (directiveName == "ENDIF")
|
||||
{
|
||||
if (IfStack.Count == 0)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $endif",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $endif",CurrentLexLocation);
|
||||
IfStack.Pop();
|
||||
}
|
||||
else if (directivename == "DEFINE")
|
||||
else if (directiveName == "DEFINE")
|
||||
{
|
||||
if (!Defines.Contains(directiveparam))
|
||||
Defines.Add(directiveparam);
|
||||
if (!Defines.Contains(directiveParams[0]))
|
||||
Defines.Add(directiveParams[0]);
|
||||
}
|
||||
else if (directivename == "UNDEF")
|
||||
else if (directiveName == "UNDEF")
|
||||
{
|
||||
if (Defines.Contains(directiveparam))
|
||||
Defines.Remove(directiveparam);
|
||||
if (Defines.Contains(directiveParams[0]))
|
||||
Defines.Remove(directiveParams[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,31 +138,39 @@ UNICODEARROW \x890
|
|||
}
|
||||
|
||||
<EXCLUDETEXT>{DIRECTIVE} {
|
||||
parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
|
||||
parsertools.CheckDirectiveParams(directivename,directiveparam); // directivename in UPPERCASE!
|
||||
if (directivename == "IFDEF")
|
||||
|
||||
parserTools.ParseDirective(yytext, CurrentLexLocation, out directiveName, out directiveParams);
|
||||
|
||||
if (directiveName == null) // случай пустой директивы
|
||||
break;
|
||||
|
||||
parserTools.CheckDirectiveParams(directiveName, directiveParams, CurrentLexLocation);
|
||||
|
||||
directiveName = directiveName.ToUpper();
|
||||
|
||||
if (directiveName == "IFDEF")
|
||||
{
|
||||
IfStack.Push(0);
|
||||
IfExclude++;
|
||||
}
|
||||
else if (directivename == "IFNDEF")
|
||||
else if (directiveName == "IFNDEF")
|
||||
{
|
||||
IfStack.Push(0);
|
||||
IfExclude++;
|
||||
}
|
||||
else if (directivename == "ELSE")
|
||||
else if (directiveName == "ELSE")
|
||||
{
|
||||
if (IfStack.Peek() == 1)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
|
||||
IfStack.Pop();
|
||||
IfStack.Push(1);
|
||||
if (IfExclude == 1)
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
else if (directivename == "ENDIF")
|
||||
else if (directiveName == "ENDIF")
|
||||
{
|
||||
if (IfStack.Count==0)
|
||||
parsertools.AddErrorFromResource("UNNECESSARY $endif",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("UNNECESSARY $endif",CurrentLexLocation);
|
||||
IfStack.Pop();
|
||||
IfExclude--;
|
||||
if (IfExclude == 0)
|
||||
|
|
@ -166,17 +179,17 @@ UNICODEARROW \x890
|
|||
else if (IfExclude > 0)
|
||||
{
|
||||
int ind_to_remove = -1;
|
||||
for (int i=0; i<parsertools.compilerDirectives.Count; i++)
|
||||
for (int i=0; i<parserTools.compilerDirectives.Count; i++)
|
||||
{
|
||||
if (parsertools.compilerDirectives[i].source_context.begin_position.line_num == CurrentLexLocation.StartLine &&
|
||||
parsertools.compilerDirectives[i].source_context.begin_position.column_num - 2 == CurrentLexLocation.StartColumn + 1)
|
||||
if (parserTools.compilerDirectives[i].source_context.begin_position.line_num == CurrentLexLocation.StartLine &&
|
||||
parserTools.compilerDirectives[i].source_context.begin_position.column_num - 2 == CurrentLexLocation.StartColumn + 1)
|
||||
{
|
||||
ind_to_remove = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ind_to_remove != -1)
|
||||
parsertools.compilerDirectives.RemoveAt(ind_to_remove);
|
||||
parserTools.compilerDirectives.RemoveAt(ind_to_remove);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -262,9 +275,9 @@ UNICODEARROW \x890
|
|||
if (res == (int)Tokens.tkIdentifier)
|
||||
{
|
||||
if (cur_yytext[0] == '!' && !HiddenIdents && !ExprMode)
|
||||
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}",CurrentLexLocation, ""+cur_yytext[0]);
|
||||
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}",CurrentLexLocation, ""+cur_yytext[0]);
|
||||
yylval = new Union();
|
||||
yylval.id = parsertools.create_ident(cur_yytext,currentLexLocation);
|
||||
yylval.id = parserTools.create_ident(cur_yytext,currentLexLocation);
|
||||
}
|
||||
else
|
||||
switch (res)
|
||||
|
|
@ -466,14 +479,14 @@ UNICODEARROW \x890
|
|||
{INTNUM} {
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.ex = parsertools.create_int_const(yytext,currentLexLocation);
|
||||
yylval.ex = parserTools.create_int_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkInteger;
|
||||
}
|
||||
|
||||
{BIGINTNUM} {
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.ex = parsertools.create_bigint_const(yytext,currentLexLocation);
|
||||
yylval.ex = parserTools.create_bigint_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkBigInteger;
|
||||
}
|
||||
|
||||
|
|
@ -481,7 +494,7 @@ UNICODEARROW \x890
|
|||
{HEXNUM} {
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.ex = parsertools.create_hex_const(yytext,currentLexLocation);
|
||||
yylval.ex = parserTools.create_hex_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkHex;
|
||||
}
|
||||
|
||||
|
|
@ -489,35 +502,35 @@ UNICODEARROW \x890
|
|||
{EXPNUM} {
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.ex = parsertools.create_double_const(yytext,currentLexLocation);
|
||||
yylval.ex = parserTools.create_double_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkFloat;
|
||||
}
|
||||
|
||||
{STRINGNUM} {
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.stn = parsertools.create_string_const(yytext,currentLexLocation);
|
||||
yylval.stn = parserTools.create_string_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkStringLiteral;
|
||||
}
|
||||
|
||||
{MULTILINESTRINGNUM} {
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.stn = parsertools.create_multiline_string_const(yytext,currentLexLocation);
|
||||
yylval.stn = parserTools.create_multiline_string_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkMultilineStringLiteral;
|
||||
}
|
||||
|
||||
{FORMATSTRINGNUM} {
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.stn = parsertools.create_format_string_const(yytext,currentLexLocation);
|
||||
yylval.stn = parserTools.create_format_string_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkFormatStringLiteral;
|
||||
}
|
||||
|
||||
{SHARPCHARNUM} {
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.stn = parsertools.create_sharp_char_const(yytext,currentLexLocation);
|
||||
yylval.stn = parserTools.create_sharp_char_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkAsciiChar;
|
||||
}
|
||||
|
||||
|
|
@ -528,7 +541,7 @@ UNICODEARROW \x890
|
|||
}
|
||||
|
||||
[^ \r\n\t] {
|
||||
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}",CurrentLexLocation, yytext);
|
||||
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}",CurrentLexLocation, yytext);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -544,32 +557,32 @@ UNICODEARROW \x890
|
|||
public LexLocation CurrentLexLocation
|
||||
{
|
||||
get {
|
||||
return new LexLocation(tokLin, tokCol, tokELin, tokECol, parsertools.currentFileName);
|
||||
return new LexLocation(tokLin, tokCol, tokELin, tokECol, parserTools.currentFileName);
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool yywrap()
|
||||
{
|
||||
if (IfStack.Count > 0)
|
||||
parsertools.AddErrorFromResource("ENDIF_ABSENT",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("ENDIF_ABSENT",CurrentLexLocation);
|
||||
BEGIN(INITIAL);
|
||||
if (buffStack.Count == 0)
|
||||
return true;
|
||||
RestoreBuffCtx(buffStack.Pop());
|
||||
parsertools.currentFileName = fNameStack.Pop();
|
||||
parserTools.currentFileName = fNameStack.Pop();
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void yyerror(string format, params object[] args)
|
||||
{
|
||||
string errorMsg = parsertools.CreateErrorString(yytext,args);
|
||||
parsertools.AddError(errorMsg,CurrentLexLocation);
|
||||
string errorMsg = parserTools.CreateErrorString(yytext,args);
|
||||
parserTools.AddError(errorMsg,CurrentLexLocation);
|
||||
}
|
||||
|
||||
private void TryInclude(string fName)
|
||||
{
|
||||
if (fName == null || fName.Length == 0)
|
||||
parsertools.AddErrorFromResource("INCLUDE_EMPTY_FILE",CurrentLexLocation);
|
||||
parserTools.AddErrorFromResource("INCLUDE_EMPTY_FILE",CurrentLexLocation);
|
||||
else
|
||||
try {
|
||||
if (fName.StartsWith("'"))
|
||||
|
|
@ -581,22 +594,22 @@ UNICODEARROW \x890
|
|||
BufferContext savedCtx = MkBuffCtx();
|
||||
string full_path = fName;
|
||||
if (!Path.IsPathRooted(full_path))
|
||||
full_path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(parsertools.currentFileName), fName));
|
||||
full_path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(parserTools.currentFileName), fName));
|
||||
|
||||
if (fNameStack.Contains(full_path))
|
||||
{
|
||||
parsertools.AddErrorFromResource("RECUR_INCLUDE", CurrentLexLocation, fName);
|
||||
parserTools.AddErrorFromResource("RECUR_INCLUDE", CurrentLexLocation, fName);
|
||||
return;
|
||||
}
|
||||
|
||||
SetSource(File.ReadAllText(full_path), 0);
|
||||
fNameStack.Push(parsertools.currentFileName);
|
||||
parsertools.currentFileName = full_path;
|
||||
fNameStack.Push(parserTools.currentFileName);
|
||||
parserTools.currentFileName = full_path;
|
||||
buffStack.Push(savedCtx);
|
||||
}
|
||||
catch
|
||||
{
|
||||
parsertools.AddErrorFromResource("INCLUDE_COULDNT_OPEN_FILE{0}",CurrentLexLocation,fName);
|
||||
parserTools.AddErrorFromResource("INCLUDE_COULDNT_OPEN_FILE{0}",CurrentLexLocation,fName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ using PascalABCCompiler.SyntaxTree;
|
|||
using System;
|
||||
using System.Linq;
|
||||
using PascalABCCompiler.ParserTools;
|
||||
using PascalABCCompiler.PascalABCNewParser;
|
||||
using PascalABCCompiler.Parsers;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PascalABCSavParser
|
||||
{
|
||||
|
|
@ -39,6 +42,16 @@ namespace PascalABCSavParser
|
|||
public List<var_def_statement> pascalABCVarStatements;
|
||||
public List<type_declaration> pascalABCTypeDeclarations;
|
||||
|
||||
protected override BaseParser ParserCached
|
||||
{
|
||||
get
|
||||
{
|
||||
if (parserCached == null)
|
||||
parserCached = Controller.Instance.SelectParser(".pas") as BaseParser;
|
||||
return parserCached;
|
||||
}
|
||||
}
|
||||
|
||||
static PascalParserTools()
|
||||
{
|
||||
tokenNum = new Dictionary<string, string>();
|
||||
|
|
@ -89,16 +102,47 @@ namespace PascalABCSavParser
|
|||
pascalABCTypeDeclarations = new List<type_declaration>();
|
||||
}
|
||||
|
||||
public void DivideDirectiveOn(string yytext, out string directivename, out string directiveparam)
|
||||
/// <summary>
|
||||
/// Разбор директивы, согласно спецификации языка
|
||||
/// </summary>
|
||||
public void ParseDirective(string directive, QUT.Gppg.LexLocation location, out string directiveName, out List<string> directiveParams)
|
||||
{
|
||||
var ind = yytext.IndexOfAny(new char[]{' ','}'});
|
||||
directivename = yytext.Substring(2,ind-2).ToUpper().Trim();
|
||||
directiveparam = yytext.Substring(ind + 1).TrimEnd('}').Trim();
|
||||
}
|
||||
directiveName = null;
|
||||
directiveParams = new List<string>();
|
||||
|
||||
public void CheckDirectiveParams(string directivename, string directiveparam)
|
||||
{
|
||||
List<string> words = Regex.Split(directive, @"('.*?')|\s+").Where(word => word != "").ToList();
|
||||
|
||||
// подсоединяем } к последнему слову
|
||||
if (words.Last() == "}")
|
||||
{
|
||||
words[words.Count - 2] += "}";
|
||||
words.RemoveAt(words.Count - 1);
|
||||
}
|
||||
|
||||
// пустая директива - ошибка
|
||||
if (words[0] == "{$}")
|
||||
{
|
||||
AddErrorFromResource("EMPTY_DIRECTIVE", location);
|
||||
return;
|
||||
}
|
||||
|
||||
// подсоединяем первое слово к {$
|
||||
if (words[0] == "{$")
|
||||
{
|
||||
words[0] += words[1];
|
||||
words.RemoveAt(1);
|
||||
}
|
||||
|
||||
if (words.Count == 1)
|
||||
{
|
||||
directiveName = words[0].Substring(2, words[0].Length - 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
directiveName = words[0].Substring(2, words[0].Length - 2);
|
||||
words[words.Count - 1] = words[words.Count - 1].TrimEnd('}');
|
||||
directiveParams = words.Skip(1).Select(word => DeleteQuotesFromDirectiveParam(word)).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
protected override string GetFromStringResources(string res)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// GPPG version 1.3.6
|
||||
// Machine: DESKTOP-V3E9T2U
|
||||
// DateTime: 20.04.2024 21:42:55
|
||||
// DateTime: 23.04.2024 22:43:23
|
||||
// UserName: alex
|
||||
// Input file <ABCPascal.y>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ using PascalABCSavParser;
|
|||
using PascalABCCompiler.Parsers;
|
||||
using GPPGParserScanner;
|
||||
using GPPGPreprocessor3;
|
||||
using PascalABCCompiler.ParserTools.Directives;
|
||||
using static PascalABCCompiler.ParserTools.Directives.DirectiveHelper;
|
||||
|
||||
namespace PascalABCCompiler.PascalABCNewParser
|
||||
{
|
||||
|
|
@ -78,7 +80,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
|||
|
||||
Scanner scanner = new Scanner();
|
||||
scanner.SetSource(Text, 0);
|
||||
scanner.parsertools = parsertools;// передали parsertools в объект сканера
|
||||
scanner.parserTools = parsertools;// передали parsertools в объект сканера
|
||||
if (definesList != null)
|
||||
scanner.Defines.AddRange(definesList);
|
||||
GPPGParser parser = new GPPGParser(scanner);
|
||||
|
|
@ -101,21 +103,69 @@ namespace PascalABCCompiler.PascalABCNewParser
|
|||
|
||||
public PascalABCNewLanguageParser()
|
||||
: base(
|
||||
name: "PascalABC.NET",
|
||||
version: "1.2",
|
||||
copyright: "Copyright © 2005-2024 by Ivan Bondarev, Stanislav Mikhalkovich",
|
||||
systemUnitNames: new string[] { "PABCSystem", "PABCExtensions" },
|
||||
name: "PascalABC.NET",
|
||||
version: "1.2",
|
||||
copyright: "Copyright © 2005-2024 by Ivan Bondarev, Stanislav Mikhalkovich",
|
||||
systemUnitNames: new string[] { "PABCSystem", "PABCExtensions" },
|
||||
caseSensitive: false,
|
||||
filesExtensions: new string[] { ".pas" })
|
||||
{
|
||||
InitializeValidDirectives();
|
||||
}
|
||||
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CompilerDirectives = new List<compiler_directive>();
|
||||
Errors.Clear();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Здесь записываются все директивы, поддерживаемые языком, а также правила для проверки их параметров (ограничения, накладываемые со стороны языка)
|
||||
/// </summary>
|
||||
private void InitializeValidDirectives()
|
||||
{
|
||||
#region VALID DIRECTIVES
|
||||
ValidDirectives = new Dictionary<string, DirectiveInfo>(StringComparer.CurrentCultureIgnoreCase)
|
||||
{
|
||||
[StringConstants.compiler_directive_apptype] = new DirectiveInfo(SingleAnyOfCheck("console", "windows", "dll", "pcu")),
|
||||
[StringConstants.compiler_directive_reference] = new DirectiveInfo(), // нет параметров - никаких проверок
|
||||
[StringConstants.compiler_directive_include_namespace] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_savepcu] = new DirectiveInfo(SingleAnyOfCheck("true", "false")),
|
||||
[StringConstants.compiler_directive_zerobasedstrings] = new DirectiveInfo(SingleAnyOfCheck("on", "off"), paramsNums: new int[2] { 0, 1 }),
|
||||
[StringConstants.compiler_directive_zerobasedstrings_ON] = null, // от null, скорее всего, придется избавиться, это не лучший подход EVA
|
||||
[StringConstants.compiler_directive_zerobasedstrings_OFF] = null,
|
||||
[StringConstants.compiler_directive_nullbasedstrings_ON] = null,
|
||||
[StringConstants.compiler_directive_nullbasedstrings_OFF] = null,
|
||||
[StringConstants.compiler_directive_initstring_as_empty_ON] = null,
|
||||
[StringConstants.compiler_directive_initstring_as_empty_OFF] = null,
|
||||
[StringConstants.compiler_directive_resource] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_platformtarget] = new DirectiveInfo(SingleAnyOfCheck("x86", "x64", "anycpu", "dotnet5win", "dotnet5linux", "dotnet5macos", "native")),
|
||||
[StringConstants.compiler_directive_faststrings] = null,
|
||||
[StringConstants.compiler_directive_gendoc] = new DirectiveInfo(SingleAnyOfCheck("true", "false")),
|
||||
[StringConstants.compiler_directive_region] = new DirectiveInfo(checkParamsNumNeeded: false),
|
||||
[StringConstants.compiler_directive_endregion] = new DirectiveInfo(checkParamsNumNeeded: false),
|
||||
[StringConstants.compiler_directive_ifdef] = new DirectiveInfo(SingleIsValidIdCheck()),
|
||||
[StringConstants.compiler_directive_endif] = new DirectiveInfo(SingleIsValidIdCheck(), paramsNums: new int[2] { 0, 1 }),
|
||||
[StringConstants.compiler_directive_ifndef] = new DirectiveInfo(SingleIsValidIdCheck()),
|
||||
[StringConstants.compiler_directive_else] = new DirectiveInfo(SingleIsValidIdCheck(), paramsNums: new int[2] { 0, 1 }),
|
||||
[StringConstants.compiler_directive_undef] = new DirectiveInfo(SingleIsValidIdCheck()),
|
||||
[StringConstants.compiler_directive_define] = new DirectiveInfo(SingleIsValidIdCheck()),
|
||||
[StringConstants.compiler_directive_include] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_targetframework] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_hidden_idents] = null,
|
||||
[StringConstants.compiler_directive_version_string] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_product_string] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_company_string] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_trademark_string] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_main_resource_string] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_title_string] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_description_string] = new DirectiveInfo(),
|
||||
[StringConstants.compiler_directive_omp] = new DirectiveInfo(SingleAnyOfCheck("critical", "parallel"), checkParamsNumNeeded: false)
|
||||
};
|
||||
#endregion
|
||||
}
|
||||
|
||||
public override SourceFilesProviderDelegate SourceFilesProvider
|
||||
{
|
||||
get
|
||||
|
|
@ -186,7 +236,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
|||
|
||||
PreprocessorParserHelper preprocessor3 = new PreprocessorParserHelper(Errors, FileName);
|
||||
var b = preprocessor3.Parse(Text);
|
||||
|
||||
|
||||
if (Errors.Count > 0)
|
||||
return null;
|
||||
|
||||
|
|
@ -213,7 +263,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
|||
{
|
||||
if (Text == string.Empty)
|
||||
return null;
|
||||
// LineCorrection = -1 не забыть
|
||||
// LineCorrection = -1 не забыть
|
||||
string origText = Text;
|
||||
Text = String.Concat("<<expression>>", Environment.NewLine, Text);
|
||||
localparserhelper = new GPPGParserHelper(Errors, Warnings, FileName);
|
||||
|
|
@ -222,7 +272,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
|||
if (root == null && origText != null && origText.Contains("<"))
|
||||
{
|
||||
Errors.Clear();
|
||||
root = localparserhelper.Parse(String.Concat("<<expression>>", Environment.NewLine, origText.Replace("<","&<")));
|
||||
root = localparserhelper.Parse(String.Concat("<<expression>>", Environment.NewLine, origText.Replace("<", "&<")));
|
||||
}
|
||||
return root as expression;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,6 +125,10 @@
|
|||
<Project>{AF2EFD7B-69DD-4B43-AF65-B59B29349C23}</Project>
|
||||
<Name>ParserTools</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\StringConstants\StringConstants.csproj">
|
||||
<Project>{e8aefbf9-0113-4fa4-be45-6cda555498b7}</Project>
|
||||
<Name>StringConstants</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SyntaxTree\SyntaxTree.csproj">
|
||||
<Project>{C2CAC65A-B2AE-4CCC-B067-E6B8E75DF73A}</Project>
|
||||
<Name>SyntaxTree</Name>
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ namespace GPPGParserScanner
|
|||
parsertools.buildTreeForFormatterStrings = true;
|
||||
Scanner scanner = new Scanner();
|
||||
scanner.SetSource("<<expression>>"+Text, 0);
|
||||
scanner.parsertools = parsertools;// передали parsertools в объект сканера
|
||||
scanner.parserTools = parsertools;// передали parsertools в объект сканера
|
||||
GPPGParser parser = new GPPGParser(scanner);
|
||||
parsertools.buildTreeForFormatter = false;
|
||||
parser.lambdaHelper = this.lambdaHelper;
|
||||
|
|
|
|||
|
|
@ -737,7 +737,7 @@ namespace PascalABCCompiler.VBNETParser
|
|||
return sb.ToString();
|
||||
}
|
||||
//if (ctn.IsArray) return "array of "+GetTypeName(ctn.GetElementType());
|
||||
//if (ctn == Type.GetType("System.Void*")) return PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name;
|
||||
//if (ctn == Type.GetType("System.Void*")) return StringConstants.pointer_type_name;
|
||||
return ctn.Name;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PascalABCSaushkinParser", "
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LanguageIntegrator", "LanguageIntegrator\LanguageIntegrator.csproj", "{A48D9069-D569-4110-9252-A10F139B669B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StringConstants", "StringConstants\StringConstants.csproj", "{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -517,6 +519,18 @@ Global
|
|||
{A48D9069-D569-4110-9252-A10F139B669B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{A48D9069-D569-4110-9252-A10F139B669B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A48D9069-D569-4110-9252-A10F139B669B}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -563,6 +577,7 @@ Global
|
|||
{27D9800E-2689-4AA1-A2D6-128E4A9BAE98} = {F8CE2712-826B-450B-A72F-D32D80C99858}
|
||||
{1443F539-DCC7-4491-B4FD-B716C739DB3C} = {BB6973BA-B3A2-4B31-A986-7CB008F22C4F}
|
||||
{A48D9069-D569-4110-9252-A10F139B669B} = {F8CE2712-826B-450B-A72F-D32D80C99858}
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7} = {F8CE2712-826B-450B-A72F-D32D80C99858}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {68E993E6-EE86-4DDF-B0A1-4FE884F8AC39}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26430.14
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34723.18
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualPascalABCNET", "VisualPascalABCNET", "{26843C5D-9D7E-4C2C-AC14-2D227FA5592E}"
|
||||
EndProject
|
||||
|
|
@ -101,6 +101,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LambdaAnySynToSemConverter"
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LanguageIntegrator", "LanguageIntegrator\LanguageIntegrator.csproj", "{A48D9069-D569-4110-9252-A10F139B669B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StringConstants", "StringConstants\StringConstants.csproj", "{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -459,6 +461,18 @@ Global
|
|||
{A48D9069-D569-4110-9252-A10F139B669B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{A48D9069-D569-4110-9252-A10F139B669B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A48D9069-D569-4110-9252-A10F139B669B}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -500,6 +514,7 @@ Global
|
|||
{A9AB4282-83B4-41A7-86C3-E5BF6A45E7E2} = {F8CE2712-826B-450B-A72F-D32D80C99858}
|
||||
{3AA92A45-7142-4C59-B12F-56DAE32A40E3} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
|
||||
{27D9800E-2689-4AA1-A2D6-128E4A9BAE98} = {F8CE2712-826B-450B-A72F-D32D80C99858}
|
||||
{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7} = {F8CE2712-826B-450B-A72F-D32D80C99858}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {97A10B06-9161-4E2B-9C6F-10EEF45013EC}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
cd ..\bin
|
||||
del ..\Release\PACNETConsole.zip
|
||||
..\utils\pkzipc\pkzipc.exe -add ..\Release\PABCNETC.zip pabcnetc.exe pabcnetcclear.exe Compiler.dll CompilerTools.dll Errors.dll Localization.dll NETGenerator.dll ParserTools.dll ICSharpCode.NRefactory.dll SemanticTree.dll SyntaxTree.dll TreeConverter.dll OptimizerConversion.dll PascalABCParser.dll licence.txt PascalABCNET.chm System.Threading.dll SyntaxTreeConverters.dll YieldHelpers.dll SyntaxVisitors.dll LambdaAnySynToSemConverter.dll LanguageIntegrator.dll
|
||||
..\utils\pkzipc\pkzipc.exe -add ..\Release\PABCNETC.zip pabcnetc.exe pabcnetcclear.exe Compiler.dll CompilerTools.dll Errors.dll Localization.dll NETGenerator.dll ParserTools.dll ICSharpCode.NRefactory.dll SemanticTree.dll SyntaxTree.dll TreeConverter.dll OptimizerConversion.dll PascalABCParser.dll licence.txt PascalABCNET.chm System.Threading.dll SyntaxTreeConverters.dll YieldHelpers.dll SyntaxVisitors.dll LambdaAnySynToSemConverter.dll LanguageIntegrator.dll StringConstants.dll
|
||||
..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PABCNETC.zip Lib\*.pcu
|
||||
..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PABCNETC.zip Lng\*.dat
|
||||
..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PABCNETC.zip Lng\*.LanguageName
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
cd ..\bin
|
||||
del ..\Release\PascalABCNETMono.zip
|
||||
..\utils\pkzipc\pkzipc.exe -add ..\Release\PascalABCNETMono.zip PascalABCNETMono.exe pabcnetc.exe pabcnetc PascalABCNET Compiler.dll CompilerTools.dll Errors.dll Localization.dll NETGenerator.dll ParserTools.dll SyntaxTreeConverters.dll ICSharpCode.NRefactory.dll SemanticTree.dll SyntaxTree.dll TreeConverter.dll OptimizerConversion.dll PascalABCParser.dll licence.txt PascalABCNET.chm System.Threading.dll PluginsSupport.dll InternalErrorReport.dll ICSharpCode.TextEditor.dll ICSharpCode.SharpZipLib.dll CodeCompletion.dll Debugger.Core.dll Mono.Debugger.Soft.dll Mono.Debugging.dll Mono.Debugging.Soft.dll NETXP.Controls.dll NETXP.Controls.Bars.dll NETXP.Library.dll NETXP.Win32.dll WeifenLuo.WinFormsUI.Docking.dll template.pct YieldHelpers.dll LanguageIntegrator.dll
|
||||
..\utils\pkzipc\pkzipc.exe -add ..\Release\PascalABCNETMono.zip PascalABCNETMono.exe pabcnetc.exe pabcnetc PascalABCNET Compiler.dll CompilerTools.dll Errors.dll Localization.dll NETGenerator.dll ParserTools.dll SyntaxTreeConverters.dll ICSharpCode.NRefactory.dll SemanticTree.dll SyntaxTree.dll TreeConverter.dll OptimizerConversion.dll PascalABCParser.dll licence.txt PascalABCNET.chm System.Threading.dll PluginsSupport.dll InternalErrorReport.dll ICSharpCode.TextEditor.dll ICSharpCode.SharpZipLib.dll CodeCompletion.dll Debugger.Core.dll Mono.Debugger.Soft.dll Mono.Debugging.dll Mono.Debugging.Soft.dll NETXP.Controls.dll NETXP.Controls.Bars.dll NETXP.Library.dll NETXP.Win32.dll WeifenLuo.WinFormsUI.Docking.dll template.pct YieldHelpers.dll LanguageIntegrator.dll StringConstants.dll
|
||||
..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PascalABCNETMono.zip Lib\*.pcu
|
||||
..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PascalABCNETMono.zip Highlighting\*.xshd
|
||||
..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PascalABCNETMono.zip Ico\*.ico
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
File "..\bin\Localization.dll"
|
||||
File "..\bin\NETGenerator.dll"
|
||||
File "..\bin\LanguageIntegrator.dll"
|
||||
File "..\bin\StringConstants.dll"
|
||||
File "..\bin\ParserTools.dll"
|
||||
File "..\bin\SemanticTree.dll"
|
||||
File "..\bin\SyntaxTree.dll"
|
||||
|
|
@ -59,6 +60,7 @@
|
|||
${AddFile} "Localization.dll"
|
||||
${AddFile} "NETGenerator.dll"
|
||||
${AddFile} "LanguageIntegrator.dll"
|
||||
${AddFile} "StringConstants.dll"
|
||||
${AddFile} "ParserTools.dll"
|
||||
${AddFile} "SemanticTree.dll"
|
||||
${AddFile} "SyntaxTree.dll"
|
||||
|
|
|
|||
36
StringConstants/Properties/AssemblyInfo.cs
Normal file
36
StringConstants/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Общие сведения об этой сборке предоставляются следующим набором
|
||||
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
|
||||
// связанные со сборкой.
|
||||
[assembly: AssemblyTitle("StringConstants")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("StringConstants")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2005-2024 by Ivan Bondarev, Stanislav Mikhalkovich")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
|
||||
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
|
||||
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
|
||||
[assembly: Guid("e8aefbf9-0113-4fa4-be45-6cda555498b7")]
|
||||
|
||||
// Сведения о версии сборки состоят из указанных ниже четырех значений:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер сборки
|
||||
// Редакция
|
||||
//
|
||||
// Можно задать все значения или принять номера сборки и редакции по умолчанию
|
||||
// используя "*", как показано ниже:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -1,18 +1,14 @@
|
|||
// 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;
|
||||
using System.Collections;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using PascalABCCompiler.TreeRealization;
|
||||
using System;
|
||||
|
||||
namespace PascalABCCompiler.TreeConverter
|
||||
namespace PascalABCCompiler
|
||||
{
|
||||
|
||||
public static class compiler_string_consts
|
||||
public static class StringConstants
|
||||
{
|
||||
|
||||
public static Dictionary<string, string> oper_names = new Dictionary<string, string>();
|
||||
|
||||
static int tvnc = 0;
|
||||
|
|
@ -21,7 +17,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
return "$TV" + (tvnc++).ToString() + "$";
|
||||
}
|
||||
|
||||
static compiler_string_consts()
|
||||
static StringConstants()
|
||||
{
|
||||
oper_names[plus_name] = "op_Addition";
|
||||
oper_names[minus_name] = "op_Subtraction";
|
||||
|
|
@ -65,7 +61,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
return null;
|
||||
}
|
||||
string rez = name;
|
||||
int ind = name.IndexOf(compiler_string_consts.generic_params_infix);
|
||||
int ind = name.IndexOf(generic_params_infix);
|
||||
if (ind > 0)
|
||||
{
|
||||
rez = name.Substring(0, ind);
|
||||
|
|
@ -85,8 +81,22 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
|
||||
|
||||
#region INTERNAL FUNCTION NAMES
|
||||
public static string ImplementationSectionNamespaceName = "_implementation______";
|
||||
public static readonly string main_function_name = "Main";
|
||||
public static readonly string c_main_function_name = "main";
|
||||
public static readonly string temp_main_function_name = "$Main";
|
||||
public static readonly string initialization_function_name = "$Initialization";
|
||||
public static readonly string finalization_function_name = "$Finalization";
|
||||
public static readonly string function_return_value_prefix = "$rv_";
|
||||
public static readonly string empty_function_name = "empty_function";
|
||||
#endregion
|
||||
|
||||
public static string CommandLineArgsVariableName = "CommandLineArgs";
|
||||
public static string MainArgsParamName = "args";
|
||||
public static string IsConsoleApplicationVariableName = "IsConsoleApplication";
|
||||
|
||||
#region TYPE NAMES
|
||||
public static readonly string bool_type_name = "boolean";
|
||||
public static readonly string byte_type_name = "byte";
|
||||
public static readonly string sbyte_type_name = "shortint";
|
||||
|
|
@ -112,7 +122,9 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public static readonly string void_class_name = "void";
|
||||
public static string value = "value";
|
||||
public static readonly string object_equals_name = "Equals";
|
||||
#endregion
|
||||
|
||||
#region OPERATORS
|
||||
public static readonly string plus_name = "+";
|
||||
public static readonly string minus_name = "-";
|
||||
public static readonly string mul_name = "*";
|
||||
|
|
@ -121,11 +133,6 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public static readonly string mod_name = "mod";
|
||||
public static readonly string explicit_operator_name = "op_Explicit";
|
||||
public static readonly string implicit_operator_name = "op_Implicit";
|
||||
|
||||
//public static string CommandLineArgsVariableName = "CommandLineArgs";
|
||||
public static string MainArgsParamName = "args";
|
||||
public static string IsConsoleApplicationVariableName = "IsConsoleApplication";
|
||||
|
||||
public static readonly string plusassign_name = "+=";
|
||||
public static readonly string minusassign_name = "-=";
|
||||
public static readonly string multassign_name = "*=";
|
||||
|
|
@ -150,20 +157,12 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public static readonly string shr_name = "shr";
|
||||
|
||||
public static readonly string assign_name = ":=";
|
||||
#endregion
|
||||
|
||||
public static readonly string unary_param_name = "param";
|
||||
public static readonly string left_param_name = "left";
|
||||
public static readonly string right_param_name = "right";
|
||||
|
||||
public static readonly string main_function_name = "Main";
|
||||
public static readonly string c_main_function_name = "main";
|
||||
public static readonly string temp_main_function_name = "$Main";
|
||||
public static readonly string initialization_function_name = "$Initialization";
|
||||
public static readonly string finalization_function_name = "$Finalization";
|
||||
|
||||
public static readonly string function_return_value_prefix = "$rv_";
|
||||
public static readonly string empty_function_name = "empty_function";
|
||||
|
||||
public static readonly string break_procedure_name = "break";
|
||||
public static readonly string continue_procedure_name = "continue";
|
||||
public static readonly string exit_procedure_name = "exit";
|
||||
|
|
@ -183,8 +182,6 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public static readonly string set_val_pascal_array_name = "set_val";
|
||||
public static readonly string index_property_pascal_array_name = "index";
|
||||
|
||||
public static readonly string system_unit_name = "PascalABCSystem";
|
||||
|
||||
public static readonly string delegate_type_name_template = "$delegate";
|
||||
|
||||
public static readonly string roof_name = "^";
|
||||
|
|
@ -319,12 +316,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
public static string default_constructor_name = "create";
|
||||
|
||||
// SSM - Константы директив компилятора. Вообще разбросаны по коду. Пусть будут здесь (3.1.2011)
|
||||
#region COMPILER DIRECTIVES
|
||||
#region PASCAL COMPILER DIRECTIVES
|
||||
public static string compiler_directive_apptype = "apptype";
|
||||
public static string compiler_directive_reference = "reference";
|
||||
public static string include_namespace_directive = "includenamespace";
|
||||
public static string compiler_savepcu = "savepcu";
|
||||
public static string compiler_directive_include_namespace = "includenamespace";
|
||||
public static string compiler_directive_savepcu = "savepcu";
|
||||
public static string compiler_directive_zerobasedstrings = "zerobasedstrings";
|
||||
public static string compiler_directive_zerobasedstrings_ON = "string_zerobased+";
|
||||
public static string compiler_directive_zerobasedstrings_OFF = "string_zerobased-";
|
||||
|
|
@ -347,24 +343,27 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public static string compiler_directive_include = "include";
|
||||
public static string compiler_directive_targetframework = "targetframework";
|
||||
public static string compiler_directive_hidden_idents = "hiddenidents";
|
||||
public const string version_string = "version";
|
||||
public const string product_string = "product";
|
||||
public const string company_string = "company";
|
||||
public const string copyright_string = "copyright";
|
||||
public const string trademark_string = "trademark";
|
||||
public const string main_resource_string = "mainresource";
|
||||
public const string title_string = "title";
|
||||
public const string description_string = "description";
|
||||
public static string compiler_directive_omp = "omp";
|
||||
public const string compiler_directive_version_string = "version";
|
||||
public const string compiler_directive_product_string = "product";
|
||||
public const string compiler_directive_company_string = "company";
|
||||
public const string compiler_directive_copyright_string = "copyright";
|
||||
public const string compiler_directive_trademark_string = "trademark";
|
||||
public const string compiler_directive_main_resource_string = "mainresource";
|
||||
public const string compiler_directive_title_string = "title";
|
||||
public const string compiler_directive_description_string = "description";
|
||||
#endregion
|
||||
|
||||
// SSM (3.1.2011) Перенес эти константы сюда.
|
||||
public static string system_unit_marker = "__IS_SYSTEM_MODULE";
|
||||
#region PASCAL LANGUAGE
|
||||
|
||||
#region PASCAL LANGUAGE BASIC NAMES
|
||||
public const string pascalLanguageName = "PascalABC.NET";
|
||||
public const string pascalSourceFileExtension = ".pas";
|
||||
public const string pascalCompiledUnitExtension = ".pcu";
|
||||
public static string pascalSystemUnitName = "PABCSystem";
|
||||
public static string pascalExtensionsUnitName = "PABCExtensions";
|
||||
public const string pascalSystemUnitName = "PABCSystem";
|
||||
public const string pascalSystemUnitNamespaceName = "PascalABCSystem";
|
||||
public const string pascalExtensionsUnitName = "PABCExtensions";
|
||||
public static readonly string[] pascalDefaultStandardModules = new string[]
|
||||
{
|
||||
pascalSystemUnitName,
|
||||
|
|
@ -416,7 +415,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
if (name.IndexOf(".") != -1)
|
||||
{
|
||||
return string.Format("{0}get_{1}", name.Substring(0, name.LastIndexOf('.') + 1), name.Substring(name.LastIndexOf('.')+1));
|
||||
return string.Format("{0}get_{1}", name.Substring(0, name.LastIndexOf('.') + 1), name.Substring(name.LastIndexOf('.') + 1));
|
||||
}
|
||||
return GetAccessorName("get_{0}", name);
|
||||
}
|
||||
|
|
@ -470,5 +469,4 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public static string StringType = "string";
|
||||
public static string config_variable_name = "__CONFIG__";
|
||||
}
|
||||
|
||||
}
|
||||
47
StringConstants/StringConstants.csproj
Normal file
47
StringConstants/StringConstants.csproj
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E8AEFBF9-0113-4FA4-BE45-6CDA555498B7}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>StringConstants</RootNamespace>
|
||||
<AssemblyName>StringConstants</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="StringConstants.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
// 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;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PascalABCCompiler.SyntaxTree
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
unit GOLDParserEngine;
|
||||
unit GOLDParserEngine;
|
||||
|
||||
{$NullBasedStrings true}
|
||||
{$zerobasedstrings on}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Gold Parser engine for PascalABC.NET, v0.1
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
unit GOLDParserEngine;
|
||||
unit GOLDParserEngine;
|
||||
|
||||
{$NullBasedStrings true}
|
||||
{$zerobasedstrings on}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Gold Parser engine for PascalABC.NET, v0.1
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
{
|
||||
var varName = ((IVAriableDefinitionNode)symbolInfo.SymbolInfo.sym_info).name.ToLower();
|
||||
var ff = symbolInfo.SymbolInfo.sym_info.GetType();
|
||||
var isSelfWordInClass = scope is CapturedVariablesTreeNodeClassScope && varName == compiler_string_consts.self_word;
|
||||
var isSelfWordInClass = scope is CapturedVariablesTreeNodeClassScope && varName == PascalABCCompiler.StringConstants.self_word;
|
||||
SourceContext sourceCtxt = null;
|
||||
if (symbolInfo.SymbolInfo.sym_info.location != null)
|
||||
sourceCtxt = new SourceContext(symbolInfo.SymbolInfo.sym_info.location.begin_line_num, symbolInfo.SymbolInfo.sym_info.location.begin_column_num,
|
||||
|
|
@ -401,7 +401,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
dotnode1 = new dot_node(ClassName, new ident(varName));
|
||||
else
|
||||
dotnode1 = new dot_node(
|
||||
new ident(compiler_string_consts.self_word, sourceCtxt),
|
||||
new ident(PascalABCCompiler.StringConstants.self_word, sourceCtxt),
|
||||
new ident(
|
||||
_capturedVarsClassDefs[upperScopeWhereVarsAreCaptured.ScopeIndex]
|
||||
.GeneratedUpperClassFieldName, sourceCtxt), sourceCtxt);
|
||||
|
|
@ -457,7 +457,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
else
|
||||
{
|
||||
var dotnode1 = new dot_node(
|
||||
new ident(compiler_string_consts.self_word, sourceCtxt),
|
||||
new ident(PascalABCCompiler.StringConstants.self_word, sourceCtxt),
|
||||
new ident(varName, sourceCtxt), sourceCtxt);
|
||||
|
||||
_lambdaIdReferences.Add(new LambdaReferencesSubstitutionInfo
|
||||
|
|
@ -517,7 +517,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
}
|
||||
|
||||
var dotnode1 = new dot_node(
|
||||
new ident(compiler_string_consts.self_word, sourceCtxt),
|
||||
new ident(PascalABCCompiler.StringConstants.self_word, sourceCtxt),
|
||||
new ident(varName, sourceCtxt), sourceCtxt);
|
||||
|
||||
_lambdaIdReferences.Add(new LambdaReferencesSubstitutionInfo
|
||||
|
|
@ -580,7 +580,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
cl.AssignNodeForUpperClassFieldInitialization =
|
||||
new assign(
|
||||
new dot_node(new ident(cl.GeneratedSubstitutingFieldName),new ident(cl.GeneratedUpperClassFieldName)),
|
||||
new ident(compiler_string_consts.self_word));
|
||||
new ident(PascalABCCompiler.StringConstants.self_word));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -685,7 +685,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
new ScopeClassDefinition(currentNode.CorrespondingSyntaxTreeNode,
|
||||
typeDeclaration,
|
||||
currentNode,
|
||||
compiler_string_consts.self_word));
|
||||
PascalABCCompiler.StringConstants.self_word));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -153,8 +153,8 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
var semClassField = pair.Value.Item2;
|
||||
var pn = (common_property_node)pair.Value.Item3;
|
||||
|
||||
var readFunction = _visitor.GenerateGetMethodForField(pn, compiler_string_consts.GetGetAccessorName(pn.name), semClassField, null);
|
||||
var writeFunction = _visitor.GenerateSetMethodForField(pn, compiler_string_consts.GetSetAccessorName(pn.name), semClassField, null);
|
||||
var readFunction = _visitor.GenerateGetMethodForField(pn, PascalABCCompiler.StringConstants.GetGetAccessorName(pn.name), semClassField, null);
|
||||
var writeFunction = _visitor.GenerateSetMethodForField(pn, PascalABCCompiler.StringConstants.GetSetAccessorName(pn.name), semClassField, null);
|
||||
|
||||
pn.internal_get_function = readFunction;
|
||||
pn.internal_set_function = writeFunction;
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
{
|
||||
/*if (si.sym_info.semantic_node_type == semantic_node_type.local_variable)
|
||||
{
|
||||
if (!(idName == compiler_string_consts.self_word && si.scope is SymbolTable.ClassMethodScope && _classScope != null) && InLambdaContext)
|
||||
if (!(idName == PascalABCCompiler.StringConstants.self_word && si.scope is SymbolTable.ClassMethodScope && _classScope != null) && InLambdaContext)
|
||||
{
|
||||
_visitor.AddError(new ThisTypeOfVariablesCannotBeCaptured(_visitor.get_location(id)));
|
||||
}
|
||||
|
|
@ -402,7 +402,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
_visitor.AddError(new CannotCaptureNonValueParameters(_visitor.get_location(id)));
|
||||
}
|
||||
|
||||
if (idName == compiler_string_consts.self_word && si.scope is SymbolTable.ClassMethodScope &&
|
||||
if (idName == PascalABCCompiler.StringConstants.self_word && si.scope is SymbolTable.ClassMethodScope &&
|
||||
_classScope != null)
|
||||
{
|
||||
var selfField = _classScope.VariablesDefinedInScope.Find(var => var.SymbolInfo == si);
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
{
|
||||
object[] attrs = entry_type.GetCustomAttributes(false);
|
||||
for (int j = 0; j < attrs.Length; j++)
|
||||
if (attrs[j].GetType().Name == PascalABCCompiler.TreeConverter.compiler_string_consts.global_attr_name)
|
||||
if (attrs[j].GetType().Name == StringConstants.global_attr_name)
|
||||
{
|
||||
sil = NetHelper.FindName(entry_type, name);
|
||||
if (sil != null) break;
|
||||
|
|
@ -559,7 +559,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
if (members.TryGetValue(tmp, out mht))
|
||||
{
|
||||
List<MemberInfo> mis2 = null;
|
||||
string name = compiler_string_consts.GetNETOperName(mi.Name);
|
||||
string name = StringConstants.GetNETOperName(mi.Name);
|
||||
if (name == null)
|
||||
name = mi.Name;
|
||||
if (!mht.TryGetValue(name, out mis2))
|
||||
|
|
@ -578,7 +578,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
if (members.TryGetValue(tt, out mht))
|
||||
{
|
||||
List<MemberInfo> mis2 = null;
|
||||
string name = compiler_string_consts.GetNETOperName(mi.Name);
|
||||
string name = StringConstants.GetNETOperName(mi.Name);
|
||||
if (name == null)
|
||||
name = mi.Name;
|
||||
if (!mht.TryGetValue(name, out mis2))
|
||||
|
|
@ -597,7 +597,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
if (members.TryGetValue(arr_t, out mht))
|
||||
{
|
||||
List<MemberInfo> mis2 = null;
|
||||
string name = compiler_string_consts.GetNETOperName(mi.Name);
|
||||
string name = StringConstants.GetNETOperName(mi.Name);
|
||||
if (name == null)
|
||||
name = mi.Name;
|
||||
if (!mht.TryGetValue(name, out mis2))
|
||||
|
|
@ -615,7 +615,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
if (members.TryGetValue(gen_t, out mht))
|
||||
{
|
||||
List<MemberInfo> mis2 = null;
|
||||
string name = compiler_string_consts.GetNETOperName(mi.Name);
|
||||
string name = StringConstants.GetNETOperName(mi.Name);
|
||||
if (name == null)
|
||||
name = mi.Name;
|
||||
if (!mht.TryGetValue(name, out mis2))
|
||||
|
|
@ -637,7 +637,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
object[] attrs = t.GetCustomAttributes(false);
|
||||
foreach (Attribute attr in attrs)
|
||||
{
|
||||
if (attr.GetType().Name == PascalABCCompiler.TreeConverter.compiler_string_consts.global_attr_name)
|
||||
if (attr.GetType().Name == StringConstants.global_attr_name)
|
||||
{
|
||||
entry_type = t;
|
||||
unit_types.Insert(0, t);
|
||||
|
|
@ -645,11 +645,11 @@ namespace PascalABCCompiler.NetHelper
|
|||
|
||||
break;
|
||||
}
|
||||
else if (attr.GetType().Name == PascalABCCompiler.TreeConverter.compiler_string_consts.class_unit_attr_name)
|
||||
else if (attr.GetType().Name == StringConstants.class_unit_attr_name)
|
||||
{
|
||||
if (_assembly.ManifestModule.ScopeName == compiler_string_consts.pabc_rtl_dll_name)
|
||||
if (_assembly.ManifestModule.ScopeName == StringConstants.pabc_rtl_dll_name)
|
||||
{
|
||||
if (t.Name == compiler_string_consts.pascalSystemUnitName)
|
||||
if (t.Name == StringConstants.pascalSystemUnitName)
|
||||
PABCSystemType = t;
|
||||
else if (t.Name == "PT4")
|
||||
PT4Type = t;
|
||||
|
|
@ -665,7 +665,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
if (attrs.Length == 1)
|
||||
{
|
||||
Type attr_t = attrs[0].GetType();
|
||||
if (attr_t.FullName == compiler_string_consts.file_of_attr_name)
|
||||
if (attr_t.FullName == StringConstants.file_of_attr_name)
|
||||
{
|
||||
object o = attr_t.GetField("Type", BindingFlags.Public | BindingFlags.Instance).GetValue(attrs[0]);
|
||||
if (o is Type)
|
||||
|
|
@ -686,7 +686,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
compiled_pascal_types[t.Namespace + "." + t.Name.Substring(1)] = t;
|
||||
}
|
||||
}
|
||||
else if (attr_t.FullName == compiler_string_consts.set_of_attr_name)
|
||||
else if (attr_t.FullName == StringConstants.set_of_attr_name)
|
||||
{
|
||||
object o = attr_t.GetField("Type", BindingFlags.Public | BindingFlags.Instance).GetValue(attrs[0]);
|
||||
if (o is Type)
|
||||
|
|
@ -710,7 +710,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
compiled_pascal_types[t.Namespace + "." + t.Name.Substring(1)] = t;
|
||||
}
|
||||
}
|
||||
else if (attr_t.FullName == compiler_string_consts.short_string_attr_name)
|
||||
else if (attr_t.FullName == StringConstants.short_string_attr_name)
|
||||
{
|
||||
int len = (int)attr_t.GetField("Length", BindingFlags.Public | BindingFlags.Instance).GetValue(attrs[0]);
|
||||
if (PascalABCCompiler.TreeConverter.compilation_context.instance != null && PascalABCCompiler.TreeConverter.compilation_context.instance.syntax_tree_visitor.compiled_unit != null && PascalABCCompiler.TreeConverter.compilation_context.instance.converted_namespace != null)
|
||||
|
|
@ -723,11 +723,11 @@ namespace PascalABCCompiler.NetHelper
|
|||
compiled_pascal_types[t.Namespace + "." + t.Name.Substring(1)] = t;
|
||||
}
|
||||
}
|
||||
else if (attr_t.FullName == compiler_string_consts.template_class_attr_name)
|
||||
else if (attr_t.FullName == StringConstants.template_class_attr_name)
|
||||
{
|
||||
compiled_pascal_types[t.Namespace + "." + t.Name.Substring(1)] = t;
|
||||
}
|
||||
else if (attr_t.FullName == compiler_string_consts.type_synonim_attr_name)
|
||||
else if (attr_t.FullName == StringConstants.type_synonim_attr_name)
|
||||
{
|
||||
object o = attr_t.GetField("Type", BindingFlags.Public | BindingFlags.Instance).GetValue(attrs[0]);
|
||||
if (o is Type)
|
||||
|
|
@ -775,7 +775,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
if (attrs.Length == 1)
|
||||
{
|
||||
Type attr_t = attrs[0].GetType();
|
||||
if (attr_t.FullName == compiler_string_consts.file_of_attr_name)
|
||||
if (attr_t.FullName == StringConstants.file_of_attr_name)
|
||||
{
|
||||
object o = attr_t.GetField("Type", BindingFlags.Public | BindingFlags.Instance).GetValue(attrs[0]);
|
||||
if (o is Type)
|
||||
|
|
@ -792,7 +792,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
}
|
||||
return PascalABCCompiler.TreeConverter.compilation_context.instance.create_typed_file_type(compiled_type_node.get_type_node(attr_t), null);
|
||||
}
|
||||
else if (attr_t.FullName == compiler_string_consts.set_of_attr_name)
|
||||
else if (attr_t.FullName == StringConstants.set_of_attr_name)
|
||||
{
|
||||
object o = attr_t.GetField("Type", BindingFlags.Public | BindingFlags.Instance).GetValue(attrs[0]);
|
||||
if (o is Type)
|
||||
|
|
@ -809,12 +809,12 @@ namespace PascalABCCompiler.NetHelper
|
|||
}
|
||||
return PascalABCCompiler.TreeConverter.compilation_context.instance.create_set_type(compiled_type_node.get_type_node(attr_t), null);
|
||||
}
|
||||
else if (attr_t.FullName == compiler_string_consts.short_string_attr_name)
|
||||
else if (attr_t.FullName == StringConstants.short_string_attr_name)
|
||||
{
|
||||
int len = (int)attr_t.GetField("Length", BindingFlags.Public | BindingFlags.Instance).GetValue(attrs[0]);
|
||||
return PascalABCCompiler.TreeConverter.compilation_context.instance.create_short_string_type(len, null);
|
||||
}
|
||||
else if (attr_t.FullName == compiler_string_consts.template_class_attr_name)
|
||||
else if (attr_t.FullName == StringConstants.template_class_attr_name)
|
||||
{
|
||||
return null;
|
||||
|
||||
|
|
@ -846,8 +846,8 @@ namespace PascalABCCompiler.NetHelper
|
|||
{
|
||||
object[] attrs = t.GetCustomAttributes(false);
|
||||
for (int j=0; j<attrs.Length; j++)
|
||||
if (attrs[j].GetType().Name == PascalABCCompiler.TreeConverter.compiler_string_consts.global_attr_name
|
||||
|| attrs[j].GetType().Name == PascalABCCompiler.TreeConverter.compiler_string_consts.class_unit_attr_name)
|
||||
if (attrs[j].GetType().Name == StringConstants.global_attr_name
|
||||
|| attrs[j].GetType().Name == StringConstants.class_unit_attr_name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1043,8 +1043,8 @@ namespace PascalABCCompiler.NetHelper
|
|||
get
|
||||
{
|
||||
if(SemanticRules.PoinerRealization == PoinerRealization.IntPtr)
|
||||
return FindTypeOrCreate(compiler_string_consts.pointer_net_type_name_intptr);
|
||||
return FindTypeOrCreate(compiler_string_consts.pointer_net_type_name_void);
|
||||
return FindTypeOrCreate(StringConstants.pointer_net_type_name_intptr);
|
||||
return FindTypeOrCreate(StringConstants.pointer_net_type_name_void);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1138,13 +1138,13 @@ namespace PascalABCCompiler.NetHelper
|
|||
public static function_node get_implicit_conversion(compiled_type_node in_type, compiled_type_node from,
|
||||
type_node to, NetTypeScope scope)
|
||||
{
|
||||
return get_conversion(in_type, from, to, compiler_string_consts.implicit_operator_name, scope);
|
||||
return get_conversion(in_type, from, to, StringConstants.implicit_operator_name, scope);
|
||||
}
|
||||
|
||||
public static function_node get_explicit_conversion(compiled_type_node in_type, compiled_type_node from,
|
||||
compiled_type_node to, NetTypeScope scope)
|
||||
{
|
||||
return get_conversion(in_type, from, to, compiler_string_consts.explicit_operator_name, scope);
|
||||
return get_conversion(in_type, from, to, StringConstants.explicit_operator_name, scope);
|
||||
}
|
||||
|
||||
public static compiled_type_node get_array_type(compiled_type_node element_type)
|
||||
|
|
@ -1272,7 +1272,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
if (cur_used_assemblies.ContainsKey(mi.DeclaringType.Assembly))
|
||||
{
|
||||
List<MemberInfo> al = null;
|
||||
string s = compiler_string_consts.GetNETOperName(mi.Name);
|
||||
string s = StringConstants.GetNETOperName(mi.Name);
|
||||
if (s == null)
|
||||
s = mi.Name;
|
||||
if (!ht.TryGetValue(s, out al))
|
||||
|
|
@ -1451,8 +1451,8 @@ namespace PascalABCCompiler.NetHelper
|
|||
public static List<SymbolInfo> FindNameIncludeProtected(Type t, string name)
|
||||
{
|
||||
if (name == null) return null;
|
||||
if (name == compiler_string_consts.assign_name) return null;
|
||||
string s = compiler_string_consts.GetNETOperName(name);
|
||||
if (name == StringConstants.assign_name) return null;
|
||||
string s = StringConstants.GetNETOperName(name);
|
||||
if (s != null)
|
||||
{
|
||||
if (IsStandType(t)) return null;
|
||||
|
|
@ -1516,8 +1516,8 @@ namespace PascalABCCompiler.NetHelper
|
|||
public static List<SymbolInfo> FindName(Type t, string name)
|
||||
{
|
||||
if (name == null) return null;
|
||||
if (name == compiler_string_consts.assign_name) return null;
|
||||
string s = compiler_string_consts.GetNETOperName(name);
|
||||
if (name == StringConstants.assign_name) return null;
|
||||
string s = StringConstants.GetNETOperName(name);
|
||||
string tmp_name = name;
|
||||
if (s != null)
|
||||
{
|
||||
|
|
@ -1667,7 +1667,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
for (int i=0; i<attrs.Length; i++)
|
||||
{
|
||||
Type t = attrs[i].GetType();
|
||||
if (t.FullName == compiler_string_consts.file_of_attr_name)
|
||||
if (t.FullName == StringConstants.file_of_attr_name)
|
||||
{
|
||||
object o = t.GetField("Type",BindingFlags.Public|BindingFlags.Instance).GetValue(attrs[i]);
|
||||
type_node tn = null;
|
||||
|
|
@ -1683,7 +1683,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
else
|
||||
cpn.type = PascalABCCompiler.TreeConverter.compilation_context.instance.create_typed_file_type(compiled_type_node.get_type_node(t),null);
|
||||
}
|
||||
else if (t.FullName == compiler_string_consts.set_of_attr_name)
|
||||
else if (t.FullName == StringConstants.set_of_attr_name)
|
||||
{
|
||||
object o = t.GetField("Type",BindingFlags.Public|BindingFlags.Instance).GetValue(attrs[i]);
|
||||
type_node tn = null;
|
||||
|
|
@ -1699,7 +1699,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
else
|
||||
cpn.type = PascalABCCompiler.TreeConverter.compilation_context.instance.create_set_type(compiled_type_node.get_type_node(t),null);
|
||||
}
|
||||
else if (t.FullName == compiler_string_consts.short_string_attr_name)
|
||||
else if (t.FullName == StringConstants.short_string_attr_name)
|
||||
{
|
||||
int len = (int)t.GetField("Length",BindingFlags.Public|BindingFlags.Instance).GetValue(attrs[i]);
|
||||
cpn.type = PascalABCCompiler.TreeConverter.compilation_context.instance.create_short_string_type(len,null);
|
||||
|
|
@ -2247,7 +2247,7 @@ namespace PascalABCCompiler.NetHelper
|
|||
if (t == null || !t.IsGenericTypeDefinition)
|
||||
return;
|
||||
int n;
|
||||
string s = compiler_string_consts.GetGenericTypeInformation(t.Name, out n).ToLower();
|
||||
string s = StringConstants.GetGenericTypeInformation(t.Name, out n).ToLower();
|
||||
if (n == 0)
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -2062,7 +2062,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
SyntaxTree.if_node result = new PascalABCCompiler.SyntaxTree.if_node();
|
||||
SyntaxTree.un_expr ue = new PascalABCCompiler.SyntaxTree.un_expr();
|
||||
ue.operation_type = PascalABCCompiler.SyntaxTree.Operators.LogicalNOT;
|
||||
ue.subnode = new SyntaxTree.ident(TreeConverter.compiler_string_consts.OMP_NESTED);
|
||||
ue.subnode = new SyntaxTree.ident(StringConstants.OMP_NESTED);
|
||||
result.condition = ue;
|
||||
|
||||
SyntaxTree.assign AssignInParVar = new PascalABCCompiler.SyntaxTree.assign();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -36,7 +36,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
{
|
||||
compiled_type_node ctn = compiled_type_node.get_type_node(NetHelper.NetHelper.PABCSystemType);
|
||||
_notCreatedSymbolInfo = ctn.find_in_type(name);
|
||||
/*if (name == TreeConverter.compiler_string_consts.read_procedure_name || name == TreeConverter.compiler_string_consts.readln_procedure_name)
|
||||
/*if (name == StringConstants.read_procedure_name || name == StringConstants.readln_procedure_name)
|
||||
{
|
||||
compiled_type_node ctn2 = compiled_type_node.get_type_node(NetHelper.NetHelper.PT4Type);
|
||||
TreeConverter.SymbolInfo si = ctn2.find_in_type(name);
|
||||
|
|
@ -94,7 +94,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
{
|
||||
compiled_type_node ctn = compiled_type_node.get_type_node(NetHelper.NetHelper.PABCSystemType);
|
||||
symbolInfo = ctn.find_in_type(name);
|
||||
/*if (name == TreeConverter.compiler_string_consts.read_procedure_name || name == TreeConverter.compiler_string_consts.readln_procedure_name)
|
||||
/*if (name == StringConstants.read_procedure_name || name == StringConstants.readln_procedure_name)
|
||||
{
|
||||
compiled_type_node ctn2 = compiled_type_node.get_type_node(NetHelper.NetHelper.PT4Type);
|
||||
TreeConverter.SymbolInfo si = ctn2.find_in_type(name);
|
||||
|
|
@ -114,31 +114,31 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
|
||||
common_type_node tctn = symbolInfo.FirstOrDefault().sym_info as common_type_node;
|
||||
tctn.type_special_kind = SemanticTree.type_special_kind.base_set_type;
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, SystemLibInitializer.SetUnionProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, SystemLibInitializer.SetIntersectProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.in_name, SystemLibInitializer.InSetProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, SystemLibInitializer.SetSubtractProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, SystemLibInitializer.CompareSetGreater.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, SystemLibInitializer.CompareSetGreaterEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, SystemLibInitializer.CompareSetLess.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, SystemLibInitializer.CompareSetLessEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, SystemLibInitializer.CompareSetEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, SystemLibInitializer.CompareSetInEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.plus_name, SystemLibInitializer.SetUnionProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.mul_name, SystemLibInitializer.SetIntersectProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.in_name, SystemLibInitializer.InSetProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.minus_name, SystemLibInitializer.SetSubtractProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.gr_name, SystemLibInitializer.CompareSetGreater.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.greq_name, SystemLibInitializer.CompareSetGreaterEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.sm_name, SystemLibInitializer.CompareSetLess.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.smeq_name, SystemLibInitializer.CompareSetLessEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.eq_name, SystemLibInitializer.CompareSetEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.noteq_name, SystemLibInitializer.CompareSetInEquals.SymbolInfo.FirstOrDefault());
|
||||
}
|
||||
else
|
||||
{
|
||||
compiled_type_node tctn = symbolInfo.FirstOrDefault().sym_info as compiled_type_node;
|
||||
tctn.type_special_kind = SemanticTree.type_special_kind.base_set_type;
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, SystemLibInitializer.SetUnionProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, SystemLibInitializer.SetIntersectProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.in_name, SystemLibInitializer.InSetProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, SystemLibInitializer.SetSubtractProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, SystemLibInitializer.CompareSetGreater.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, SystemLibInitializer.CompareSetGreaterEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, SystemLibInitializer.CompareSetLess.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, SystemLibInitializer.CompareSetLessEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, SystemLibInitializer.CompareSetEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name,SystemLibInitializer.CompareSetInEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.plus_name, SystemLibInitializer.SetUnionProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.mul_name, SystemLibInitializer.SetIntersectProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.in_name, SystemLibInitializer.InSetProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.minus_name, SystemLibInitializer.SetSubtractProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.gr_name, SystemLibInitializer.CompareSetGreater.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.greq_name, SystemLibInitializer.CompareSetGreaterEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.sm_name, SystemLibInitializer.CompareSetLess.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.smeq_name, SystemLibInitializer.CompareSetLessEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.eq_name, SystemLibInitializer.CompareSetEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.noteq_name,SystemLibInitializer.CompareSetInEquals.SymbolInfo.FirstOrDefault());
|
||||
}
|
||||
}
|
||||
else if (symbolInfo != null && SystemLibInitializer.TextFileType.Equal(symbolInfo))
|
||||
|
|
@ -154,7 +154,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
tctn.type_special_kind = PascalABCCompiler.SemanticTree.type_special_kind.text_file;
|
||||
}
|
||||
}
|
||||
else if (symbolInfo != null && string.Compare(name,PascalABCCompiler.TreeConverter.compiler_string_consts.ArrayCopyFunction,true)==0)
|
||||
else if (symbolInfo != null && string.Compare(name,StringConstants.ArrayCopyFunction,true)==0)
|
||||
{
|
||||
while ((symbolInfo[0].sym_info as function_node).parameters.Count != 1)
|
||||
{
|
||||
|
|
@ -413,15 +413,15 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
//SymbolTable.Scope sc = system_namespace.scope;
|
||||
SymbolTable.Scope sc = where_add;
|
||||
namespace_constant_definition _true_constant_definition = new namespace_constant_definition(
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, SystemLibrary.true_constant, system_unit_location, system_namespace);
|
||||
StringConstants.true_const_name, SystemLibrary.true_constant, system_unit_location, system_namespace);
|
||||
system_namespace.constants.AddElement(_true_constant_definition);
|
||||
|
||||
namespace_constant_definition _false_constant_definition = new namespace_constant_definition(
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, SystemLibrary.false_constant, system_unit_location, system_namespace);
|
||||
StringConstants.false_const_name, SystemLibrary.false_constant, system_unit_location, system_namespace);
|
||||
system_namespace.constants.AddElement(_false_constant_definition);
|
||||
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_true_constant_definition));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_false_constant_definition));
|
||||
sc.AddSymbol(StringConstants.true_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_true_constant_definition));
|
||||
sc.AddSymbol(StringConstants.false_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_false_constant_definition));
|
||||
|
||||
|
||||
//TODO: Сделано по быстрому. Переделать. Можно просто один раз сериализовать модуль system и не инициализировать его всякий раз подобным образом. Неплохо-бы использовать NetHelper.GetMethod.
|
||||
|
|
@ -431,7 +431,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
System.Reflection.MethodInfo mi;
|
||||
|
||||
//TODO: Сделать узел или базовый метод создания и удаления объекта.
|
||||
common_namespace_function_node cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.new_procedure_name, null, null, system_namespace, null);
|
||||
common_namespace_function_node cnfn = new common_namespace_function_node(StringConstants.new_procedure_name, null, null, system_namespace, null);
|
||||
cnfn.parameters.AddElement(new common_parameter("ptr", SystemLibrary.pointer_type, SemanticTree.parameter_type.value, cnfn,
|
||||
concrete_parameter_type.cpt_var, null, null));
|
||||
cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.New;
|
||||
|
|
@ -439,9 +439,9 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
_NewProcedure.symbol_kind = PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function;
|
||||
_NewProcedure.access_level = PascalABCCompiler.TreeConverter.access_level.al_public;
|
||||
_NewProcedureDecl = cnfn;
|
||||
sc.AddSymbol(TreeConverter.compiler_string_consts.new_procedure_name,_NewProcedure);
|
||||
sc.AddSymbol(StringConstants.new_procedure_name,_NewProcedure);
|
||||
|
||||
cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.dispose_procedure_name, null, null, system_namespace, null);
|
||||
cnfn = new common_namespace_function_node(StringConstants.dispose_procedure_name, null, null, system_namespace, null);
|
||||
cnfn.parameters.AddElement(new common_parameter("ptr", SystemLibrary.pointer_type, SemanticTree.parameter_type.value,
|
||||
cnfn, concrete_parameter_type.cpt_var, null, null));
|
||||
_DisposeProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn);
|
||||
|
|
@ -449,9 +449,9 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
_DisposeProcedure.access_level = PascalABCCompiler.TreeConverter.access_level.al_public;
|
||||
_DisposeProcedureDecl = cnfn;
|
||||
cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.Dispose;
|
||||
sc.AddSymbol(TreeConverter.compiler_string_consts.dispose_procedure_name, _DisposeProcedure);
|
||||
sc.AddSymbol(StringConstants.dispose_procedure_name, _DisposeProcedure);
|
||||
|
||||
cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.new_array_procedure_name, compiled_type_node.get_type_node(typeof(Array)), null, system_namespace, null);
|
||||
cnfn = new common_namespace_function_node(StringConstants.new_array_procedure_name, compiled_type_node.get_type_node(typeof(Array)), null, system_namespace, null);
|
||||
cnfn.parameters.AddElement(new common_parameter("t", compiled_type_node.get_type_node(typeof(Type)), SemanticTree.parameter_type.value, cnfn,
|
||||
concrete_parameter_type.cpt_none, null, null));
|
||||
cnfn.parameters.AddElement(new common_parameter("n", SystemLibrary.integer_type, SemanticTree.parameter_type.value, cnfn,
|
||||
|
|
@ -459,24 +459,24 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.NewArray;
|
||||
_NewArrayProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn);
|
||||
_NewArrayProcedureDecl = cnfn;
|
||||
//sc.AddSymbol(TreeConverter.compiler_string_consts.new_procedure_name, _NewProcedure);
|
||||
//sc.AddSymbol(StringConstants.new_procedure_name, _NewProcedure);
|
||||
|
||||
basic_function_node break_procedure = new basic_function_node(SemanticTree.basic_function_type.none,
|
||||
null, true, PascalABCCompiler.TreeConverter.compiler_string_consts.break_procedure_name);
|
||||
null, true, StringConstants.break_procedure_name);
|
||||
break_procedure.compile_time_executor = initialization_properties.break_executor;
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.break_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(break_procedure));
|
||||
sc.AddSymbol(StringConstants.break_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(break_procedure));
|
||||
|
||||
basic_function_node continue_procedure = new basic_function_node(SemanticTree.basic_function_type.none,
|
||||
null, true, PascalABCCompiler.TreeConverter.compiler_string_consts.continue_procedure_name);
|
||||
null, true, StringConstants.continue_procedure_name);
|
||||
continue_procedure.compile_time_executor = initialization_properties.continue_executor;
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.continue_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(continue_procedure));
|
||||
sc.AddSymbol(StringConstants.continue_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(continue_procedure));
|
||||
|
||||
basic_function_node exit_procedure = new basic_function_node(SemanticTree.basic_function_type.none,
|
||||
null, true, PascalABCCompiler.TreeConverter.compiler_string_consts.exit_procedure_name);
|
||||
null, true, StringConstants.exit_procedure_name);
|
||||
exit_procedure.compile_time_executor = initialization_properties.exit_executor;
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.exit_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(exit_procedure));
|
||||
sc.AddSymbol(StringConstants.exit_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(exit_procedure));
|
||||
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.set_length_procedure_name,
|
||||
sc.AddSymbol(StringConstants.set_length_procedure_name,
|
||||
new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.resize_func, PascalABCCompiler.TreeConverter.access_level.al_public, PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function));
|
||||
}
|
||||
|
||||
|
|
@ -490,34 +490,34 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
new SymbolTable.Scope[0]);
|
||||
common_unit_node _system_unit = new common_unit_node(main_scope,impl_scope,null,null);
|
||||
|
||||
common_namespace_node cnn = new common_namespace_node(null, _system_unit, PascalABCCompiler.TreeConverter.compiler_string_consts.system_unit_name,
|
||||
common_namespace_node cnn = new common_namespace_node(null, _system_unit, StringConstants.pascalSystemUnitNamespaceName,
|
||||
symbol_table.CreateScope(main_scope),system_unit_location);
|
||||
|
||||
main_scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.system_unit_name, new PascalABCCompiler.TreeConverter.SymbolInfo(cnn));
|
||||
main_scope.AddSymbol(StringConstants.pascalSystemUnitNamespaceName, new PascalABCCompiler.TreeConverter.SymbolInfo(cnn));
|
||||
|
||||
//SymbolTable.Scope sc = cnn.scope;
|
||||
SymbolTable.Scope sc = main_scope;
|
||||
|
||||
//Добавляем типы.
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.byte_type));
|
||||
//sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.decimal_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.decimal_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.sbyte_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.short_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.ushort_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.integer_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.uint_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.int64_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.uint64_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.float_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.double_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.char_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.bool_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.string_type));
|
||||
//sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.object_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.pointer_type));
|
||||
//sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.base_exception_class_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.exception_base_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.base_array_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.array_base_type));
|
||||
sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.base_delegate_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.delegate_base_type));
|
||||
sc.AddSymbol(StringConstants.byte_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.byte_type));
|
||||
//sc.AddSymbol(StringConstants.decimal_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.decimal_type));
|
||||
sc.AddSymbol(StringConstants.sbyte_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.sbyte_type));
|
||||
sc.AddSymbol(StringConstants.short_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.short_type));
|
||||
sc.AddSymbol(StringConstants.ushort_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.ushort_type));
|
||||
sc.AddSymbol(StringConstants.integer_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.integer_type));
|
||||
sc.AddSymbol(StringConstants.uint_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.uint_type));
|
||||
sc.AddSymbol(StringConstants.long_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.int64_type));
|
||||
sc.AddSymbol(StringConstants.ulong_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.uint64_type));
|
||||
sc.AddSymbol(StringConstants.float_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.float_type));
|
||||
sc.AddSymbol(StringConstants.real_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.double_type));
|
||||
sc.AddSymbol(StringConstants.char_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.char_type));
|
||||
sc.AddSymbol(StringConstants.bool_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.bool_type));
|
||||
sc.AddSymbol(StringConstants.string_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.string_type));
|
||||
//sc.AddSymbol(StringConstants.object_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.object_type));
|
||||
sc.AddSymbol(StringConstants.pointer_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.pointer_type));
|
||||
//sc.AddSymbol(StringConstants.base_exception_class_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.exception_base_type));
|
||||
sc.AddSymbol(StringConstants.base_array_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.array_base_type));
|
||||
sc.AddSymbol(StringConstants.base_delegate_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.delegate_base_type));
|
||||
|
||||
//TODO: Переделать. Пусть таблица символов создается одна. Как статическая.
|
||||
compiled_type_node comp_byte_type = ((compiled_type_node)SystemLibrary.byte_type);
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
{
|
||||
//return inline_assign_operator(SystemLibrary._byte_plusassign, SystemLibrary.byte_assign, SystemLibrary.int_add, call_location, parameters);
|
||||
if (!SemanticRules.UseExtendedAssignmentOperatorsForPrimitiveTypes)
|
||||
SystemLibrary.syn_visitor.AddError(new OperatorCanNotBeAppliedToThisType(compiler_string_consts.plusassign_name, parameters[0]));
|
||||
SystemLibrary.syn_visitor.AddError(new OperatorCanNotBeAppliedToThisType(StringConstants.plusassign_name, parameters[0]));
|
||||
//basic_function_call operationc = new basic_function_call((basic_function_node)operation, call_location);
|
||||
base_function_call cnfc = null;
|
||||
if (SystemLibInitializer.SetUnionProcedure.sym_info is common_namespace_function_node)
|
||||
|
|
@ -423,7 +423,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
cnfc.parameters.AddElement(parameters[0]);
|
||||
cnfc.parameters.AddElement(parameters[1]);
|
||||
//operationc.parameters.AddElement(SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(parameters[1], parameters[0].type));
|
||||
basic_function_call assignc = new basic_function_call(parameters[0].type.find_first_in_type(compiler_string_consts.assign_name).sym_info as basic_function_node, call_location);
|
||||
basic_function_call assignc = new basic_function_call(parameters[0].type.find_first_in_type(StringConstants.assign_name).sym_info as basic_function_node, call_location);
|
||||
assignc.parameters.AddElement(parameters[0]);
|
||||
assignc.parameters.AddElement(cnfc);
|
||||
//assignc.parameters.AddElement(SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(operationc, parameters[0].type));
|
||||
|
|
@ -433,11 +433,11 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
public static expression_node short_string_addassign_executor(location call_location, params expression_node[] parameters)
|
||||
{
|
||||
if (!SemanticRules.UseExtendedAssignmentOperatorsForPrimitiveTypes)
|
||||
SystemLibrary.syn_visitor.AddError(new OperatorCanNotBeAppliedToThisType(compiler_string_consts.plusassign_name, parameters[0]));
|
||||
SystemLibrary.syn_visitor.AddError(new OperatorCanNotBeAppliedToThisType(StringConstants.plusassign_name, parameters[0]));
|
||||
compiled_static_method_call csmc = new compiled_static_method_call(SystemLibrary.string_add as compiled_function_node, call_location);
|
||||
csmc.parameters.AddElement(parameters[0]);
|
||||
csmc.parameters.AddElement(parameters[1]);
|
||||
basic_function_call assignc = new basic_function_call(parameters[0].type.find_first_in_type(compiler_string_consts.assign_name).sym_info as basic_function_node, call_location);
|
||||
basic_function_call assignc = new basic_function_call(parameters[0].type.find_first_in_type(StringConstants.assign_name).sym_info as basic_function_node, call_location);
|
||||
assignc.parameters.AddElement(parameters[0]);
|
||||
base_function_call cnfc = null;
|
||||
if (SystemLibInitializer.ClipShortStringProcedure.sym_info is common_namespace_function_node)
|
||||
|
|
@ -454,7 +454,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
{
|
||||
//return inline_assign_operator(SystemLibrary._byte_plusassign, SystemLibrary.byte_assign, SystemLibrary.int_add, call_location, parameters);
|
||||
if (!SemanticRules.UseExtendedAssignmentOperatorsForPrimitiveTypes)
|
||||
SystemLibrary.syn_visitor.AddError(new OperatorCanNotBeAppliedToThisType(compiler_string_consts.plusassign_name, parameters[0]));
|
||||
SystemLibrary.syn_visitor.AddError(new OperatorCanNotBeAppliedToThisType(StringConstants.plusassign_name, parameters[0]));
|
||||
//basic_function_call operationc = new basic_function_call((basic_function_node)operation, call_location);
|
||||
base_function_call cnfc = null;
|
||||
if (SystemLibInitializer.SetSubtractProcedure.sym_info is common_namespace_function_node)
|
||||
|
|
@ -464,7 +464,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
cnfc.parameters.AddElement(parameters[0]);
|
||||
cnfc.parameters.AddElement(parameters[1]);
|
||||
//operationc.parameters.AddElement(SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(parameters[1], parameters[0].type));
|
||||
basic_function_call assignc = new basic_function_call(parameters[0].type.find_first_in_type(compiler_string_consts.assign_name).sym_info as basic_function_node, call_location);
|
||||
basic_function_call assignc = new basic_function_call(parameters[0].type.find_first_in_type(StringConstants.assign_name).sym_info as basic_function_node, call_location);
|
||||
assignc.parameters.AddElement(parameters[0]);
|
||||
assignc.parameters.AddElement(cnfc);
|
||||
//assignc.parameters.AddElement(SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(operationc, parameters[0].type));
|
||||
|
|
@ -475,7 +475,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
{
|
||||
//return inline_assign_operator(SystemLibrary._byte_plusassign, SystemLibrary.byte_assign, SystemLibrary.int_add, call_location, parameters);
|
||||
if (!SemanticRules.UseExtendedAssignmentOperatorsForPrimitiveTypes)
|
||||
SystemLibrary.syn_visitor.AddError(new OperatorCanNotBeAppliedToThisType(compiler_string_consts.plusassign_name, parameters[0]));
|
||||
SystemLibrary.syn_visitor.AddError(new OperatorCanNotBeAppliedToThisType(StringConstants.plusassign_name, parameters[0]));
|
||||
//basic_function_call operationc = new basic_function_call((basic_function_node)operation, call_location);
|
||||
base_function_call cnfc = null;
|
||||
if (SystemLibInitializer.SetIntersectProcedure.sym_info is common_namespace_function_node)
|
||||
|
|
@ -485,7 +485,7 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
cnfc.parameters.AddElement(parameters[0]);
|
||||
cnfc.parameters.AddElement(parameters[1]);
|
||||
//operationc.parameters.AddElement(SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(parameters[1], parameters[0].type));
|
||||
basic_function_call assignc = new basic_function_call(parameters[0].type.find_first_in_type(compiler_string_consts.assign_name).sym_info as basic_function_node, call_location);
|
||||
basic_function_call assignc = new basic_function_call(parameters[0].type.find_first_in_type(StringConstants.assign_name).sym_info as basic_function_node, call_location);
|
||||
assignc.parameters.AddElement(parameters[0]);
|
||||
assignc.parameters.AddElement(cnfc);
|
||||
//assignc.parameters.AddElement(SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(operationc, parameters[0].type));
|
||||
|
|
|
|||
|
|
@ -1907,11 +1907,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public CanNotReferenceToNonStaticMethodWithType(string meth_name, location loc)
|
||||
: base(loc)
|
||||
{
|
||||
if (meth_name.Contains(compiler_string_consts.event_add_method_prefix) ||
|
||||
meth_name.Contains(compiler_string_consts.event_remove_method_prefix))
|
||||
if (meth_name.Contains(StringConstants.event_add_method_prefix) ||
|
||||
meth_name.Contains(StringConstants.event_remove_method_prefix))
|
||||
{
|
||||
meth_name = meth_name.Replace(compiler_string_consts.event_add_method_prefix, "");
|
||||
meth_name = meth_name.Replace(compiler_string_consts.event_remove_method_prefix, "");
|
||||
meth_name = meth_name.Replace(StringConstants.event_add_method_prefix, "");
|
||||
meth_name = meth_name.Replace(StringConstants.event_remove_method_prefix, "");
|
||||
message = "CAN_NOT_REFERENCE_TO_NONSTATIC_EVENT_{0}_WITH_TYPE";
|
||||
}
|
||||
name=meth_name;
|
||||
|
|
@ -1934,11 +1934,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
case general_node_type.function_node:
|
||||
meth_name = (dn as function_node).name;
|
||||
if (meth_name.Contains(compiler_string_consts.event_add_method_prefix) ||
|
||||
meth_name.Contains(compiler_string_consts.event_remove_method_prefix))
|
||||
if (meth_name.Contains(StringConstants.event_add_method_prefix) ||
|
||||
meth_name.Contains(StringConstants.event_remove_method_prefix))
|
||||
{
|
||||
meth_name = meth_name.Replace(compiler_string_consts.event_add_method_prefix, "");
|
||||
meth_name = meth_name.Replace(compiler_string_consts.event_remove_method_prefix, "");
|
||||
meth_name = meth_name.Replace(StringConstants.event_add_method_prefix, "");
|
||||
meth_name = meth_name.Replace(StringConstants.event_remove_method_prefix, "");
|
||||
message = "CAN_NOT_REFERENCE_TO_NONSTATIC_EVENT_{0}_FROM_STATIC_METHOD";
|
||||
}
|
||||
break;
|
||||
|
|
@ -1971,11 +1971,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
case general_node_type.function_node:
|
||||
meth_name = (dn as function_node).name;
|
||||
if (meth_name.Contains(compiler_string_consts.event_add_method_prefix) ||
|
||||
meth_name.Contains(compiler_string_consts.event_remove_method_prefix))
|
||||
if (meth_name.Contains(StringConstants.event_add_method_prefix) ||
|
||||
meth_name.Contains(StringConstants.event_remove_method_prefix))
|
||||
{
|
||||
meth_name = meth_name.Replace(compiler_string_consts.event_add_method_prefix, "");
|
||||
meth_name = meth_name.Replace(compiler_string_consts.event_remove_method_prefix, "");
|
||||
meth_name = meth_name.Replace(StringConstants.event_add_method_prefix, "");
|
||||
meth_name = meth_name.Replace(StringConstants.event_remove_method_prefix, "");
|
||||
message = "CAN_NOT_REFERENCE_TO_NONSTATIC_EVENT_{0}_FROM_STATIC_INITIALIZER";
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
expr,
|
||||
ind_expr,
|
||||
new int_const_node((expr.type as short_string_type_node).Length, null), from);
|
||||
return_value(find_operator(compiler_string_consts.assign_name, expr, ind_expr, get_location(_assign)));
|
||||
return_value(find_operator(StringConstants.assign_name, expr, ind_expr, get_location(_assign)));
|
||||
return true;
|
||||
}
|
||||
if (to.type.type_special_kind == type_special_kind.short_string)
|
||||
|
|
@ -103,7 +103,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
convertion_data_and_alghoritms.convert_type(from, SystemLibrary.SystemLibrary.string_type),
|
||||
new int_const_node((to.type as short_string_type_node).Length,
|
||||
null));
|
||||
statement_node en = find_operator(compiler_string_consts.assign_name, to, clip_expr, get_location(_assign));
|
||||
statement_node en = find_operator(StringConstants.assign_name, to, clip_expr, get_location(_assign));
|
||||
return_value(en);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,14 +103,14 @@ namespace PascalABCCompiler.TreeConverter
|
|||
right = finishValue;
|
||||
if (right is typed_expression)
|
||||
right = convert_typed_expression_to_function_call(right as typed_expression);
|
||||
res = find_operator(compiler_string_consts.assign_name, left, right, finishValueLocation);
|
||||
res = find_operator(StringConstants.assign_name, left, right, finishValueLocation);
|
||||
head_stmts.statements.AddElement(res);
|
||||
|
||||
if (!early_init_loop_variable) // SSM 25/05/16 - for var i := f1() to f2() do без этой правки дважды вызывал f1()
|
||||
{
|
||||
left = create_variable_reference(vdn, loopVariableLocation);
|
||||
right = initialValue;
|
||||
res = find_operator(compiler_string_consts.assign_name, left, right, loopVariableLocation);
|
||||
res = find_operator(StringConstants.assign_name, left, right, loopVariableLocation);
|
||||
head_stmts.statements.AddElement(res);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
var parameterTypes = variableDefinitions.Select(x => x.vars_type == null ? null : convert_strong(x.vars_type)).ToArray();
|
||||
List<function_node> candidates = new List<function_node>();
|
||||
List<type_node[]> deducedParametersList = new List<type_node[]>();
|
||||
var allDeconstructs = patternInstance.type.find_in_type(compiler_string_consts.deconstruct_method_name, context.CurrentScope);
|
||||
var allDeconstructs = patternInstance.type.find_in_type(StringConstants.deconstruct_method_name, context.CurrentScope);
|
||||
if (allDeconstructs == null)
|
||||
{
|
||||
AddError(get_location(deconstruction), "NO_DECONSTRUCT_FOUND");
|
||||
|
|
@ -158,7 +158,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
type2 != null &&
|
||||
convertion_data_and_alghoritms.possible_equal_types(type1, type2);
|
||||
|
||||
private bool IsSelfParameter(parameter parameter) => parameter.name.ToLower() == compiler_string_consts.self_word;
|
||||
private bool IsSelfParameter(parameter parameter) => parameter.name.ToLower() == StringConstants.self_word;
|
||||
|
||||
private void RemoveDefaultDeconstruct(List<function_node> candidates)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -477,27 +477,27 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
if (instance.TypedSets.ContainsKey(tctn.element_type)) return instance.TypedSets[tctn.element_type];
|
||||
instance.TypedSets.Add(tctn.element_type,tctn);
|
||||
tctn.add_name(compiler_string_consts.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
|
||||
tctn.scope.AddSymbol(compiler_string_consts.plus_name, SystemLibrary.SystemLibInitializer.SetUnionProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.mul_name, SystemLibrary.SystemLibInitializer.SetIntersectProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.in_name, SystemLibrary.SystemLibInitializer.InSetProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.minus_name, SystemLibrary.SystemLibInitializer.SetSubtractProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.eq_name, SystemLibrary.SystemLibInitializer.CompareSetEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.noteq_name, SystemLibrary.SystemLibInitializer.CompareSetInEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.sm_name, SystemLibrary.SystemLibInitializer.CompareSetLess.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.smeq_name, SystemLibrary.SystemLibInitializer.CompareSetLessEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.gr_name, SystemLibrary.SystemLibInitializer.CompareSetGreater.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.greq_name, SystemLibrary.SystemLibInitializer.CompareSetGreaterEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.plusassign_name,new SymbolInfo(make_set_plus_assign(tctn)));
|
||||
tctn.scope.AddSymbol(compiler_string_consts.minusassign_name,new SymbolInfo(make_set_minus_assign(tctn)));
|
||||
tctn.scope.AddSymbol(compiler_string_consts.multassign_name,new SymbolInfo(make_set_mult_assign(tctn)));
|
||||
tctn.add_name(StringConstants.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
|
||||
tctn.scope.AddSymbol(StringConstants.plus_name, SystemLibrary.SystemLibInitializer.SetUnionProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.mul_name, SystemLibrary.SystemLibInitializer.SetIntersectProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.in_name, SystemLibrary.SystemLibInitializer.InSetProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.minus_name, SystemLibrary.SystemLibInitializer.SetSubtractProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.eq_name, SystemLibrary.SystemLibInitializer.CompareSetEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.noteq_name, SystemLibrary.SystemLibInitializer.CompareSetInEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.sm_name, SystemLibrary.SystemLibInitializer.CompareSetLess.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.smeq_name, SystemLibrary.SystemLibInitializer.CompareSetLessEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.gr_name, SystemLibrary.SystemLibInitializer.CompareSetGreater.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.greq_name, SystemLibrary.SystemLibInitializer.CompareSetGreaterEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.plusassign_name,new SymbolInfo(make_set_plus_assign(tctn)));
|
||||
tctn.scope.AddSymbol(StringConstants.minusassign_name,new SymbolInfo(make_set_minus_assign(tctn)));
|
||||
tctn.scope.AddSymbol(StringConstants.multassign_name,new SymbolInfo(make_set_mult_assign(tctn)));
|
||||
return tctn;
|
||||
}
|
||||
|
||||
public static void AddTypeToShortStringTypeList(type_node tn)
|
||||
{
|
||||
instance.ShortStringTypes.Add((tn as short_string_type_node).Length,tn as short_string_type_node);
|
||||
tn.add_name(compiler_string_consts.plus_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_add));
|
||||
tn.add_name(StringConstants.plus_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_add));
|
||||
}
|
||||
|
||||
public void pop_top_function()
|
||||
|
|
@ -926,9 +926,9 @@ namespace PascalABCCompiler.TreeConverter
|
|||
var ntr = new SyntaxTree.named_type_reference();
|
||||
for (var i = 0; i < meth_name.ln.Count; i++)
|
||||
ntr.Add(meth_name.ln[i]);
|
||||
if (num_template_args>0 && ! ntr.names[meth_name.ln.Count-1].name.Contains(compiler_string_consts.generic_params_infix))
|
||||
if (num_template_args>0 && ! ntr.names[meth_name.ln.Count-1].name.Contains(StringConstants.generic_params_infix))
|
||||
{
|
||||
ntr.names[meth_name.ln.Count-1].name += compiler_string_consts.generic_params_infix + num_template_args;
|
||||
ntr.names[meth_name.ln.Count-1].name += StringConstants.generic_params_infix + num_template_args;
|
||||
}
|
||||
sil = find_definition_node(ntr, loc);
|
||||
// если не нашли, то ошибка будет неправильной с неправильным именем - надо исправить
|
||||
|
|
@ -937,11 +937,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
if (num_template_args != 0)
|
||||
{
|
||||
string template_type_name = type_name + compiler_string_consts.generic_params_infix + num_template_args.ToString();
|
||||
string template_type_name = type_name + StringConstants.generic_params_infix + num_template_args.ToString();
|
||||
sil = find(template_type_name);
|
||||
/*if (si == null || si.sym_info.general_node_type != general_node_type.template_type)
|
||||
{
|
||||
type_name = type_name + compiler_string_consts.generic_params_infix + num_template_args.ToString();
|
||||
type_name = type_name + StringConstants.generic_params_infix + num_template_args.ToString();
|
||||
si = null;
|
||||
}*/
|
||||
}
|
||||
|
|
@ -1042,7 +1042,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
internal void add_notequal_operator_if_need(bool not_add_body= false)
|
||||
{
|
||||
List<SymbolInfo> si_list = _ctn.find_in_type(compiler_string_consts.noteq_name);
|
||||
List<SymbolInfo> si_list = _ctn.find_in_type(StringConstants.noteq_name);
|
||||
common_method_node cmn = null;
|
||||
common_parameter prm1 = null;
|
||||
common_parameter prm2 = null;
|
||||
|
|
@ -1059,7 +1059,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
SymbolTable.ClassMethodScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_ctn.scope, _cmn.scope, null, si.ToString());
|
||||
if (cmn == null)
|
||||
{
|
||||
cmn = new common_method_node(compiler_string_consts.GetNETOperName(compiler_string_consts.noteq_name), SystemLibrary.SystemLibrary.bool_type, null, _ctn,
|
||||
cmn = new common_method_node(StringConstants.GetNETOperName(StringConstants.noteq_name), SystemLibrary.SystemLibrary.bool_type, null, _ctn,
|
||||
SemanticTree.polymorphic_state.ps_static, SemanticTree.field_access_level.fal_public, scope);
|
||||
cmn.IsOperator = true;
|
||||
prm1 = new common_parameter("a", _ctn, SemanticTree.parameter_type.value, cmn, concrete_parameter_type.cpt_none, null, null);
|
||||
|
|
@ -1068,7 +1068,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
cmn.parameters.AddElement(prm2);
|
||||
cmn.is_overload = true;
|
||||
_ctn.methods.AddElement(cmn);
|
||||
_ctn.Scope.AddSymbol(compiler_string_consts.noteq_name, new SymbolInfo(cmn));
|
||||
_ctn.Scope.AddSymbol(StringConstants.noteq_name, new SymbolInfo(cmn));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1084,7 +1084,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
continue;
|
||||
expression_node left = new class_field_reference(cf,new common_parameter_reference(prm1,0,null),null);
|
||||
expression_node right = new class_field_reference(cf,new common_parameter_reference(prm2,0,null),null);
|
||||
expression_node cond = SystemLibrary.SystemLibrary.syn_visitor.find_operator(compiler_string_consts.noteq_name,
|
||||
expression_node cond = SystemLibrary.SystemLibrary.syn_visitor.find_operator(StringConstants.noteq_name,
|
||||
left,right,null);
|
||||
//basic_function_call bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_not as basic_function_node,null);
|
||||
//bfc.parameters.AddElement(cond);
|
||||
|
|
@ -1098,7 +1098,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
internal void add_equal_operator_if_need(bool not_add_body=false)
|
||||
{
|
||||
List<SymbolInfo> si_list = _ctn.find_in_type(compiler_string_consts.eq_name);
|
||||
List<SymbolInfo> si_list = _ctn.find_in_type(StringConstants.eq_name);
|
||||
common_method_node cmn = null;
|
||||
common_parameter prm1 = null;
|
||||
common_parameter prm2 = null;
|
||||
|
|
@ -1115,7 +1115,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
SymbolTable.ClassMethodScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope( _ctn.scope, _cmn.scope, null, si.ToString());
|
||||
if (cmn == null)
|
||||
{
|
||||
cmn = new common_method_node(compiler_string_consts.GetNETOperName(compiler_string_consts.eq_name), SystemLibrary.SystemLibrary.bool_type, null, _ctn,
|
||||
cmn = new common_method_node(StringConstants.GetNETOperName(StringConstants.eq_name), SystemLibrary.SystemLibrary.bool_type, null, _ctn,
|
||||
SemanticTree.polymorphic_state.ps_static, SemanticTree.field_access_level.fal_public, scope);
|
||||
cmn.IsOperator = true;
|
||||
prm1 = new common_parameter("a", _ctn, SemanticTree.parameter_type.value, cmn, concrete_parameter_type.cpt_none, null, null);
|
||||
|
|
@ -1124,7 +1124,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
cmn.parameters.AddElement(prm2);
|
||||
cmn.is_overload = true;
|
||||
_ctn.methods.AddElement(cmn);
|
||||
_ctn.Scope.AddSymbol(compiler_string_consts.eq_name, new SymbolInfo(cmn));
|
||||
_ctn.Scope.AddSymbol(StringConstants.eq_name, new SymbolInfo(cmn));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1140,7 +1140,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
continue;
|
||||
expression_node left = new class_field_reference(cf,new common_parameter_reference(prm1,0,null),null);
|
||||
expression_node right = new class_field_reference(cf,new common_parameter_reference(prm2,0,null),null);
|
||||
expression_node cond = SystemLibrary.SystemLibrary.syn_visitor.find_operator(compiler_string_consts.eq_name,
|
||||
expression_node cond = SystemLibrary.SystemLibrary.syn_visitor.find_operator(StringConstants.eq_name,
|
||||
left,right,null);
|
||||
basic_function_call bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_not as basic_function_node,null);
|
||||
bfc.parameters.AddElement(cond);
|
||||
|
|
@ -1175,7 +1175,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public SymbolInfo create_special_names()
|
||||
{
|
||||
SymbolInfo si= new SymbolInfo(top_function.return_variable);
|
||||
top_function.scope.AddSymbol(compiler_string_consts.result_variable_name, si);
|
||||
top_function.scope.AddSymbol(StringConstants.result_variable_name, si);
|
||||
return si;
|
||||
}
|
||||
|
||||
|
|
@ -1337,7 +1337,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
case block_type.compiled_type_block:
|
||||
{
|
||||
//string cname = compiler_string_consts.GetConnectedFunctionName(_compiled_tn.name, name);
|
||||
//string cname = StringConstants.GetConnectedFunctionName(_compiled_tn.name, name);
|
||||
common_namespace_function_node cnfnn;
|
||||
SymbolTable.Scope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_compiled_tn.scope, _cmn.scope, null, name);
|
||||
cnfnn = new common_namespace_function_node(name, def_loc, _cmn, scope);
|
||||
|
|
@ -1475,7 +1475,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
if (TypedFiles.ContainsKey(elem_type))
|
||||
return TypedFiles[elem_type];
|
||||
string name = compiler_string_consts.GetTypedFileTypeName(elem_type.name);
|
||||
string name = StringConstants.GetTypedFileTypeName(elem_type.name);
|
||||
type_node base_type = SystemLibrary.SystemLibInitializer.TypedFileType.sym_info as type_node;
|
||||
//check_name_free(name, def_loc);
|
||||
SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(_cmn.scope, null, name);
|
||||
|
|
@ -1499,7 +1499,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
if (TypedSets.ContainsKey(elem_type))
|
||||
return TypedSets[elem_type];
|
||||
string name = compiler_string_consts.GetSetTypeName(elem_type.name);
|
||||
string name = StringConstants.GetSetTypeName(elem_type.name);
|
||||
type_node base_type = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node;
|
||||
//check_name_free(name, def_loc);
|
||||
SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(_cmn.scope, null, "set_type " + name);
|
||||
|
|
@ -1512,21 +1512,21 @@ namespace PascalABCCompiler.TreeConverter
|
|||
tctn.internal_is_value = base_type.is_value;
|
||||
tctn.is_class = base_type.is_class;
|
||||
tctn.SetBaseType(base_type);
|
||||
tctn.add_name(compiler_string_consts.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
|
||||
tctn.ImplementingInterfaces.Add(compiled_type_node.get_type_node(NetHelper.NetHelper.FindType(compiler_string_consts.IEnumerableInterfaceName)));
|
||||
tctn.scope.AddSymbol(compiler_string_consts.plus_name, SystemLibrary.SystemLibInitializer.SetUnionProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.mul_name, SystemLibrary.SystemLibInitializer.SetIntersectProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.in_name, SystemLibrary.SystemLibInitializer.InSetProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.minus_name, SystemLibrary.SystemLibInitializer.SetSubtractProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.eq_name, SystemLibrary.SystemLibInitializer.CompareSetEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.noteq_name, SystemLibrary.SystemLibInitializer.CompareSetInEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.sm_name, SystemLibrary.SystemLibInitializer.CompareSetLess.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.smeq_name, SystemLibrary.SystemLibInitializer.CompareSetLessEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.gr_name, SystemLibrary.SystemLibInitializer.CompareSetGreater.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.greq_name, SystemLibrary.SystemLibInitializer.CompareSetGreaterEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(compiler_string_consts.plusassign_name,new SymbolInfo(make_set_plus_assign(tctn)));
|
||||
tctn.scope.AddSymbol(compiler_string_consts.minusassign_name,new SymbolInfo(make_set_minus_assign(tctn)));
|
||||
tctn.scope.AddSymbol(compiler_string_consts.multassign_name,new SymbolInfo(make_set_mult_assign(tctn)));
|
||||
tctn.add_name(StringConstants.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
|
||||
tctn.ImplementingInterfaces.Add(compiled_type_node.get_type_node(NetHelper.NetHelper.FindType(StringConstants.IEnumerableInterfaceName)));
|
||||
tctn.scope.AddSymbol(StringConstants.plus_name, SystemLibrary.SystemLibInitializer.SetUnionProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.mul_name, SystemLibrary.SystemLibInitializer.SetIntersectProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.in_name, SystemLibrary.SystemLibInitializer.InSetProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.minus_name, SystemLibrary.SystemLibInitializer.SetSubtractProcedure.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.eq_name, SystemLibrary.SystemLibInitializer.CompareSetEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.noteq_name, SystemLibrary.SystemLibInitializer.CompareSetInEquals.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.sm_name, SystemLibrary.SystemLibInitializer.CompareSetLess.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.smeq_name, SystemLibrary.SystemLibInitializer.CompareSetLessEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.gr_name, SystemLibrary.SystemLibInitializer.CompareSetGreater.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.greq_name, SystemLibrary.SystemLibInitializer.CompareSetGreaterEqual.SymbolInfo.FirstOrDefault());
|
||||
tctn.scope.AddSymbol(StringConstants.plusassign_name,new SymbolInfo(make_set_plus_assign(tctn)));
|
||||
tctn.scope.AddSymbol(StringConstants.minusassign_name,new SymbolInfo(make_set_minus_assign(tctn)));
|
||||
tctn.scope.AddSymbol(StringConstants.multassign_name,new SymbolInfo(make_set_mult_assign(tctn)));
|
||||
converted_namespace.types.AddElement(tctn);
|
||||
TypedSets.Add(elem_type, tctn);
|
||||
return tctn;
|
||||
|
|
@ -1535,7 +1535,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
private static basic_function_node make_set_plus_assign(common_type_node ctn)
|
||||
{
|
||||
//basic_function_node bfn = new basic_function_node(SemanticTree.basic_function_type.objassign,ctn,false);
|
||||
basic_function_node bfn = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.plusassign_name,ctn,SemanticTree.basic_function_type.objassign);
|
||||
basic_function_node bfn = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.plusassign_name,ctn,SemanticTree.basic_function_type.objassign);
|
||||
bfn.compile_time_executor = SystemLibrary.static_executors.set_plusassign_executor;
|
||||
return bfn;
|
||||
}
|
||||
|
|
@ -1543,7 +1543,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
private static basic_function_node make_set_minus_assign(common_type_node ctn)
|
||||
{
|
||||
//basic_function_node bfn = new basic_function_node(SemanticTree.basic_function_type.objassign,ctn,false);
|
||||
basic_function_node bfn = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.minusassign_name,ctn,SemanticTree.basic_function_type.objassign);
|
||||
basic_function_node bfn = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.minusassign_name,ctn,SemanticTree.basic_function_type.objassign);
|
||||
bfn.compile_time_executor = SystemLibrary.static_executors.set_subassign_executor;
|
||||
return bfn;
|
||||
}
|
||||
|
|
@ -1551,14 +1551,14 @@ namespace PascalABCCompiler.TreeConverter
|
|||
private static basic_function_node make_set_mult_assign(common_type_node ctn)
|
||||
{
|
||||
//basic_function_node bfn = new basic_function_node(SemanticTree.basic_function_type.objassign,ctn,false);
|
||||
basic_function_node bfn = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.multassign_name,ctn,SemanticTree.basic_function_type.objassign);
|
||||
basic_function_node bfn = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.multassign_name,ctn,SemanticTree.basic_function_type.objassign);
|
||||
bfn.compile_time_executor = SystemLibrary.static_executors.set_multassign_executor;
|
||||
return bfn;
|
||||
}
|
||||
|
||||
private static basic_function_node make_short_string_plus_assign(short_string_type_node ctn)
|
||||
{
|
||||
basic_function_node bfn = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.plusassign_name,ctn,SemanticTree.basic_function_type.objassign);
|
||||
basic_function_node bfn = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.plusassign_name,ctn,SemanticTree.basic_function_type.objassign);
|
||||
bfn.compile_time_executor = SystemLibrary.static_executors.short_string_addassign_executor;
|
||||
return bfn;
|
||||
}
|
||||
|
|
@ -1591,9 +1591,9 @@ namespace PascalABCCompiler.TreeConverter
|
|||
SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(null, SystemLibrary.SystemLibrary.string_type.Scope, "short_string_type");
|
||||
short_string_type_node tctn = new short_string_type_node(//SemanticTree.type_access_level.tal_public, _cmn,
|
||||
scope, def_loc, length);
|
||||
tctn.add_name(compiler_string_consts.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
|
||||
tctn.add_name(compiler_string_consts.plus_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_add));
|
||||
tctn.scope.AddSymbol(compiler_string_consts.plusassign_name,new SymbolInfo(make_short_string_plus_assign(tctn)));
|
||||
tctn.add_name(StringConstants.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
|
||||
tctn.add_name(StringConstants.plus_name,new SymbolInfo(SystemLibrary.SystemLibrary.string_add));
|
||||
tctn.scope.AddSymbol(StringConstants.plusassign_name,new SymbolInfo(make_short_string_plus_assign(tctn)));
|
||||
type_intersection_node inter = new type_intersection_node(type_compare.greater_type);
|
||||
inter.another_to_this = new type_conversion(SystemLibrary.SystemLibrary.char_to_string);
|
||||
tctn.add_intersection_node(SystemLibrary.SystemLibrary.char_type, inter,false);
|
||||
|
|
@ -1628,7 +1628,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public void create_generic_indicator(common_type_node generic)
|
||||
{
|
||||
generic_indicator gi = new generic_indicator(generic);
|
||||
int pos = generic.name.LastIndexOf(compiler_string_consts.generic_params_infix);
|
||||
int pos = generic.name.LastIndexOf(StringConstants.generic_params_infix);
|
||||
string name = generic.name.Substring(0, pos);
|
||||
_cmn.scope.AddSymbol(name, new SymbolInfo(gi, access_level.al_public, symbol_kind.sk_none));
|
||||
}
|
||||
|
|
@ -1698,7 +1698,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
namespace_variable nv = new namespace_variable(name + "$", tn, converted_namespace, loc);
|
||||
common_namespace_event cne = new common_namespace_event(name, tn, converted_namespace, null, null, null, loc);
|
||||
common_namespace_function_node add_func = new common_namespace_function_node(compiler_string_consts.GetAddHandler(name),
|
||||
common_namespace_function_node add_func = new common_namespace_function_node(StringConstants.GetAddHandler(name),
|
||||
null, this.converted_namespace, null);
|
||||
common_parameter cp = new common_parameter("value", tn, SemanticTree.parameter_type.value, add_func, concrete_parameter_type.cpt_none, null, null);
|
||||
add_func.parameters.AddElement(cp);
|
||||
|
|
@ -1706,18 +1706,18 @@ namespace PascalABCCompiler.TreeConverter
|
|||
fld_ref = new namespace_variable_reference(nv, null);
|
||||
expression_node en = this.syntax_tree_visitor.convertion_data_and_alghoritms.type_constructor.delegate_add_assign_compile_time_executor
|
||||
(null, new expression_node[2] { fld_ref, new common_parameter_reference(cp, 0, null) });
|
||||
//en = this.syntax_tree_visitor.convertion_data_and_alghoritms.create_simple_function_call(tn.find_in_type(compiler_string_consts.assign_name).sym_info as function_node,null,
|
||||
//en = this.syntax_tree_visitor.convertion_data_and_alghoritms.create_simple_function_call(tn.find_in_type(StringConstants.assign_name).sym_info as function_node,null,
|
||||
// fld_ref,en);
|
||||
add_func.function_code = new statements_list(null);
|
||||
(add_func.function_code as statements_list).statements.AddElement(en);
|
||||
//remove
|
||||
common_namespace_function_node remove_func = new common_namespace_function_node(compiler_string_consts.GetRemoveHandler(name), null, this.converted_namespace, null);
|
||||
common_namespace_function_node remove_func = new common_namespace_function_node(StringConstants.GetRemoveHandler(name), null, this.converted_namespace, null);
|
||||
|
||||
cp = new common_parameter("value", tn, SemanticTree.parameter_type.value, add_func, concrete_parameter_type.cpt_none, null, null);
|
||||
remove_func.parameters.AddElement(cp);
|
||||
en = this.syntax_tree_visitor.convertion_data_and_alghoritms.type_constructor.delegate_sub_assign_compile_time_executor
|
||||
(null, new expression_node[2] { fld_ref, new common_parameter_reference(cp, 0, null) });
|
||||
//en = this.syntax_tree_visitor.convertion_data_and_alghoritms.create_simple_function_call(tn.find_in_type(compiler_string_consts.assign_name).sym_info as function_node,null,
|
||||
//en = this.syntax_tree_visitor.convertion_data_and_alghoritms.create_simple_function_call(tn.find_in_type(StringConstants.assign_name).sym_info as function_node,null,
|
||||
// fld_ref,en);
|
||||
remove_func.function_code = new statements_list(null);
|
||||
(remove_func.function_code as statements_list).statements.AddElement(en);
|
||||
|
|
@ -1737,7 +1737,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
class_field cf = new class_field(name + "$", tn, converted_type, ps, _fal, loc);
|
||||
common_event ce = new common_event(name, tn, converted_type, null, null, null, _fal, ps, loc);
|
||||
//add
|
||||
common_method_node add_meth = new common_method_node(compiler_string_consts.GetAddHandler(name), null, this.converted_type,
|
||||
common_method_node add_meth = new common_method_node(StringConstants.GetAddHandler(name), null, this.converted_type,
|
||||
ps, SemanticTree.field_access_level.fal_public, null);
|
||||
common_parameter cp = new common_parameter("value", tn, SemanticTree.parameter_type.value, add_meth, concrete_parameter_type.cpt_none, null, null);
|
||||
add_meth.parameters.AddElement(cp);
|
||||
|
|
@ -1754,7 +1754,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
converted_type.scope.AddSymbol(add_meth.name, new SymbolInfo(add_meth));
|
||||
//remove
|
||||
common_method_node remove_meth = new common_method_node(compiler_string_consts.GetRemoveHandler(name), null, this.converted_type,
|
||||
common_method_node remove_meth = new common_method_node(StringConstants.GetRemoveHandler(name), null, this.converted_type,
|
||||
ps, SemanticTree.field_access_level.fal_public, null);
|
||||
|
||||
cp = new common_parameter("value", tn, SemanticTree.parameter_type.value, add_meth, concrete_parameter_type.cpt_none, null, null);
|
||||
|
|
@ -1949,13 +1949,13 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
public string get_delegate_type_name()
|
||||
{
|
||||
return (compiler_string_consts.delegate_type_name_template + _num_for_delegates++);
|
||||
return (StringConstants.delegate_type_name_template + _num_for_delegates++);
|
||||
}
|
||||
|
||||
public var_definition_node create_for_temp_variable(type_node type,location loc)
|
||||
{
|
||||
num_of_for_cycles=num_of_for_cycles+1;
|
||||
string name=compiler_string_consts.temp_for_variable_name+num_of_for_cycles.ToString();
|
||||
string name=StringConstants.temp_for_variable_name+num_of_for_cycles.ToString();
|
||||
//return create_temp_variable(name,type,loc);
|
||||
return add_var_definition(name, loc, type, SemanticTree.polymorphic_state.ps_common);
|
||||
}
|
||||
|
|
@ -2048,10 +2048,10 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
public static void add_convertions_to_enum_type(common_type_node tctn)
|
||||
{
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.gr_name,tctn,SemanticTree.basic_function_type.enumgr,SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.greq_name,tctn,SemanticTree.basic_function_type.enumgreq,SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.sm_name,tctn,SemanticTree.basic_function_type.enumsm,SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.smeq_name,tctn,SemanticTree.basic_function_type.enumsmeq,SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.gr_name,tctn,SemanticTree.basic_function_type.enumgr,SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.greq_name,tctn,SemanticTree.basic_function_type.enumgreq,SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.sm_name,tctn,SemanticTree.basic_function_type.enumsm,SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.smeq_name,tctn,SemanticTree.basic_function_type.enumsmeq,SystemLibrary.SystemLibrary.bool_type);
|
||||
|
||||
SystemLibrary.SystemLibrary.make_generated_type_conversion(tctn,SystemLibrary.SystemLibrary.byte_type,type_compare.greater_type,PascalABCCompiler.SemanticTree.basic_function_type.itob,false);
|
||||
SystemLibrary.SystemLibrary.make_generated_type_conversion(tctn,SystemLibrary.SystemLibrary.sbyte_type,type_compare.greater_type,PascalABCCompiler.SemanticTree.basic_function_type.itosb,false);
|
||||
|
|
@ -2163,12 +2163,12 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
for (int i = 0; i < arr.element_values.Count; i++)
|
||||
{
|
||||
//arr.element_values[i] = syntax_tree_visitor.find_operator(compiler_string_consts.assign_name, varref2, arr.element_values[i], null);
|
||||
//arr.element_values[i] = syntax_tree_visitor.find_operator(StringConstants.assign_name, varref2, arr.element_values[i], null);
|
||||
arr.element_values[i] = convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibInitializer.ClipShortStringProcedure.sym_info as function_node, null, convertion_data_and_alghoritms.convert_type(arr.element_values[i], SystemLibrary.SystemLibrary.string_type), new int_const_node((vdn.type.element_type as short_string_type_node).Length, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
CurrentStatementList.statements.AddElement(syntax_tree_visitor.find_operator(compiler_string_consts.assign_name, expr, userInitalValue, lid));
|
||||
CurrentStatementList.statements.AddElement(syntax_tree_visitor.find_operator(StringConstants.assign_name, expr, userInitalValue, lid));
|
||||
if (vdn.type.type_special_kind == SemanticTree.type_special_kind.set_type)
|
||||
{
|
||||
expr.type = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node;
|
||||
|
|
@ -2184,7 +2184,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if (vdn.type.type_special_kind == SemanticTree.type_special_kind.short_string)
|
||||
{
|
||||
expression_node varref2 = convertion_data_and_alghoritms.CreateVariableReference(vdn, null);
|
||||
userInitalValue = syntax_tree_visitor.find_operator(compiler_string_consts.assign_name, varref2, userInitalValue, null);
|
||||
userInitalValue = syntax_tree_visitor.find_operator(StringConstants.assign_name, varref2, userInitalValue, null);
|
||||
}
|
||||
return userInitalValue;
|
||||
}
|
||||
|
|
@ -2196,7 +2196,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
expression_node varref2 = convertion_data_and_alghoritms.CreateVariableReference(vdn, null);
|
||||
for (int i=0; i<arr.element_values.Count; i++)
|
||||
{
|
||||
//arr.element_values[i] = syntax_tree_visitor.find_operator(compiler_string_consts.assign_name, varref2, arr.element_values[i], null);
|
||||
//arr.element_values[i] = syntax_tree_visitor.find_operator(StringConstants.assign_name, varref2, arr.element_values[i], null);
|
||||
arr.element_values[i] = convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibInitializer.ClipShortStringProcedure.sym_info as function_node,null,convertion_data_and_alghoritms.convert_type(arr.element_values[i],SystemLibrary.SystemLibrary.string_type),new int_const_node((vdn.type.element_type as short_string_type_node).Length,null));
|
||||
}
|
||||
}
|
||||
|
|
@ -2213,7 +2213,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
expression_node cmc = convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibInitializer.ClipShortStringProcedure.sym_info as function_node,null,convertion_data_and_alghoritms.convert_type(userInitalValue,SystemLibrary.SystemLibrary.string_type),new int_const_node((vdn.type as short_string_type_node).Length,null));
|
||||
userInitalValue = cmc;
|
||||
}
|
||||
userInitalValue = syntax_tree_visitor.find_operator(compiler_string_consts.assign_name, varref, userInitalValue, userInitalValue.location);
|
||||
userInitalValue = syntax_tree_visitor.find_operator(StringConstants.assign_name, varref, userInitalValue, userInitalValue.location);
|
||||
if (vdn.type.type_special_kind == SemanticTree.type_special_kind.set_type)
|
||||
{
|
||||
varref.type = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node;
|
||||
|
|
@ -2221,7 +2221,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
return userInitalValue;
|
||||
}
|
||||
type_node tp = vdn.type;
|
||||
if (syntax_tree_visitor.SystemUnitAssigned && SystemLibrary.SystemLibInitializer.TextFileType.Found && tp.name == compiler_string_consts.text_file_name_type_name)
|
||||
if (syntax_tree_visitor.SystemUnitAssigned && SystemLibrary.SystemLibInitializer.TextFileType.Found && tp.name == StringConstants.text_file_name_type_name)
|
||||
if (tp == SystemLibrary.SystemLibInitializer.TextFileType.TypeNode)
|
||||
SystemLibrary.SystemLibInitializer.TextFileType.TypeNode.type_special_kind = PascalABCCompiler.SemanticTree.type_special_kind.text_file;
|
||||
//(ssyy) Вставил switch и обработку BinaryFile
|
||||
|
|
@ -2384,7 +2384,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
check_predefinition_defined();
|
||||
if (_ctn.is_generic_type_definition && !_ctn.IsInterface && _ctn.static_constr == null)
|
||||
{
|
||||
_ctn.static_constr = new common_method_node(PascalABCCompiler.TreeConverter.compiler_string_consts.static_ctor_prefix + "Create", null, _ctn, SemanticTree.polymorphic_state.ps_static, SemanticTree.field_access_level.fal_private, null);
|
||||
_ctn.static_constr = new common_method_node(StringConstants.static_ctor_prefix + "Create", null, _ctn, SemanticTree.polymorphic_state.ps_static, SemanticTree.field_access_level.fal_private, null);
|
||||
_ctn.static_constr.is_constructor = true;
|
||||
statements_list st = new statements_list(null);
|
||||
st.statements.AddElement(new return_node(new null_const_node(SystemLibrary.SystemLibrary.object_type, null), null));
|
||||
|
|
@ -2462,7 +2462,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
}
|
||||
if (stl.statements.Count == 0) return;
|
||||
string stat_ctor_name = compiler_string_consts.static_ctor_prefix + compiler_string_consts.default_constructor_name;
|
||||
string stat_ctor_name = StringConstants.static_ctor_prefix + StringConstants.default_constructor_name;
|
||||
List<SymbolInfo> sil = generic_def.scope.FindOnlyInScope(stat_ctor_name);
|
||||
common_method_node stat_ctor;
|
||||
if (sil == null)
|
||||
|
|
@ -3282,7 +3282,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
if (convertion_data_and_alghoritms.function_eq_params(fn, compar, false) && fn.is_extension_method == compar.is_extension_method)
|
||||
{
|
||||
if (fn.IsOperator && (fn.name == compiler_string_consts.explicit_operator_name || fn.name == compiler_string_consts.implicit_operator_name))
|
||||
if (fn.IsOperator && (fn.name == StringConstants.explicit_operator_name || fn.name == StringConstants.implicit_operator_name))
|
||||
{
|
||||
if (convertion_data_and_alghoritms.function_eq_params_and_result(fn, compar))
|
||||
AddError(new FunctionDuplicateDefinition(compar, fn));
|
||||
|
|
@ -3395,7 +3395,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
common_method_node cmnode = compar as common_method_node;
|
||||
if (cmnode != null)
|
||||
{
|
||||
List<SymbolInfo> si_local = cfn11.scope.FindOnlyInScope(compiler_string_consts.self_word);
|
||||
List<SymbolInfo> si_local = cfn11.scope.FindOnlyInScope(StringConstants.self_word);
|
||||
if (si_local != null)
|
||||
{
|
||||
si_local.FirstOrDefault().sym_info = cmnode.self_variable;
|
||||
|
|
@ -3577,7 +3577,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
if (convertion_data_and_alghoritms.function_eq_params(fn,compar,false))
|
||||
{
|
||||
if (fn.IsOperator && (fn.name == compiler_string_consts.explicit_operator_name || fn.name == compiler_string_consts.implicit_operator_name))
|
||||
if (fn.IsOperator && (fn.name == StringConstants.explicit_operator_name || fn.name == StringConstants.implicit_operator_name))
|
||||
{
|
||||
if (convertion_data_and_alghoritms.function_eq_params_and_result(fn,compar))
|
||||
AddError(new FunctionDuplicateDefinition(compar, fn));
|
||||
|
|
|
|||
|
|
@ -1085,7 +1085,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
internal_interface ii = cmc.obj.type.get_internal_interface(internal_interface_kind.bounded_array_interface);
|
||||
if (ii != null)
|
||||
{
|
||||
if (cmc.function_node.name == compiler_string_consts.get_val_pascal_array_name)
|
||||
if (cmc.function_node.name == StringConstants.get_val_pascal_array_name)
|
||||
{
|
||||
bounded_array_interface bai = (bounded_array_interface)ii;
|
||||
class_field cf = bai.int_array;
|
||||
|
|
@ -1160,7 +1160,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
expression_node to = new simple_array_indexing(tc.var_ref,//factparams[formalparams.Count - 1],
|
||||
new int_const_node(i - formalparams.Count + 1, factparams[i].location), aii.element_type, factparams[i].location);
|
||||
expression_node from = factparams[i];
|
||||
statement_node stat = syntax_tree_visitor.find_operator(compiler_string_consts.assign_name, to, from, factparams[i].location);
|
||||
statement_node stat = syntax_tree_visitor.find_operator(StringConstants.assign_name, to, from, factparams[i].location);
|
||||
tc.snl.AddElement(stat);
|
||||
}
|
||||
|
||||
|
|
@ -1195,7 +1195,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
expression_node to = new simple_array_indexing(tc.var_ref,//factparams[formalparams.Count - 1],
|
||||
new int_const_node(i - formalparams.Count + 1, factparams[i].location), aii.element_type, factparams[i].location);
|
||||
expression_node from = factparams[i];
|
||||
statement_node stat = syntax_tree_visitor.find_operator(compiler_string_consts.assign_name, to, from, factparams[i].location);
|
||||
statement_node stat = syntax_tree_visitor.find_operator(StringConstants.assign_name, to, from, factparams[i].location);
|
||||
tc.snl.AddElement(stat);
|
||||
}
|
||||
|
||||
|
|
@ -1270,7 +1270,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
new int_const_node(i - formalparams.Count + 1, factparams[i].location), aii.element_type, factparams[i].location);
|
||||
expression_node from = create_simple_function_call(ptc.first.convertion_method,
|
||||
factparams[i].location, factparams[i]);
|
||||
statement_node stat = syntax_tree_visitor.find_operator(compiler_string_consts.assign_name, to, from, factparams[i].location);
|
||||
statement_node stat = syntax_tree_visitor.find_operator(StringConstants.assign_name, to, from, factparams[i].location);
|
||||
tc.snl.AddElement(stat);
|
||||
}
|
||||
}
|
||||
|
|
@ -2187,8 +2187,8 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
bool is_alone_method_defined = (functions.Count() == 1);
|
||||
function_node first_function = functions.FirstOrDefault().sym_info as function_node;
|
||||
bool _is_assigment = first_function.name == compiler_string_consts.assign_name;
|
||||
bool is_op = compiler_string_consts.GetNETOperName(first_function.name) != null || first_function.name.ToLower() == "in";
|
||||
bool _is_assigment = first_function.name == StringConstants.assign_name;
|
||||
bool is_op = StringConstants.GetNETOperName(first_function.name) != null || first_function.name.ToLower() == "in";
|
||||
basic_function_node _tmp_bfn = functions.FirstOrDefault().sym_info as basic_function_node;
|
||||
|
||||
List<function_node> indefinits = new List<function_node>();
|
||||
|
|
@ -2197,7 +2197,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
if (function.sym_info is compiled_function_node cfn0 &&
|
||||
cfn0.comperehensive_type is compiled_type_node ctn0 &&
|
||||
(ctn0.compiled_type.Name == compiler_string_consts.pascalSystemUnitName + compiler_string_consts.ImplementationSectionNamespaceName || ctn0.compiled_type.Name == compiler_string_consts.pascalExtensionsUnitName + compiler_string_consts.ImplementationSectionNamespaceName)
|
||||
(ctn0.compiled_type.Name == StringConstants.pascalSystemUnitName + StringConstants.ImplementationSectionNamespaceName || ctn0.compiled_type.Name == StringConstants.pascalExtensionsUnitName + StringConstants.ImplementationSectionNamespaceName)
|
||||
&& !ctn0.compiled_type.Assembly.FullName.StartsWith("PABCRtl")) // пропустить функции (методы расширения), определенные в сборке в ПИ PABCSystem, но не в PABCRtl.dll
|
||||
continue;
|
||||
// В режиме only_from_not_extensions пропускать все extensions
|
||||
|
|
@ -3185,7 +3185,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
private string get_return_variable_name(string function_name)
|
||||
{
|
||||
return (compiler_string_consts.function_return_value_prefix+function_name);
|
||||
return (StringConstants.function_return_value_prefix+function_name);
|
||||
}
|
||||
|
||||
public void create_function_return_variable(common_function_node cfn, SymbolInfo ret_var)
|
||||
|
|
|
|||
|
|
@ -14,61 +14,61 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
static name_reflector()
|
||||
{
|
||||
ht.Add(((int)(SyntaxTree.Operators.LogicalAND)),compiler_string_consts.and_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Division)),compiler_string_consts.div_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.IntegerDivision)),compiler_string_consts.idiv_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Equal)),compiler_string_consts.eq_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Greater)),compiler_string_consts.gr_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.GreaterEqual)),compiler_string_consts.greq_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.ModulusRemainder)),compiler_string_consts.mod_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Multiplication)),compiler_string_consts.mul_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.LogicalNOT)),compiler_string_consts.not_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.NotEqual)),compiler_string_consts.noteq_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.LogicalOR)),compiler_string_consts.or_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Plus)),compiler_string_consts.plus_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.BitwiseLeftShift)),compiler_string_consts.shl_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.BitwiseRightShift)),compiler_string_consts.shr_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Less)),compiler_string_consts.sm_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.LessEqual)),compiler_string_consts.smeq_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Minus)),compiler_string_consts.minus_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.BitwiseXOR)),compiler_string_consts.xor_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.AssignmentAddition)), compiler_string_consts.plusassign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.AssignmentSubtraction)), compiler_string_consts.minusassign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.AssignmentMultiplication)), compiler_string_consts.multassign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.AssignmentDivision)), compiler_string_consts.divassign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Assignment)), compiler_string_consts.assign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.In)), compiler_string_consts.in_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Implicit)), compiler_string_consts.implicit_operator_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Explicit)), compiler_string_consts.explicit_operator_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Power)), compiler_string_consts.power_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.LogicalAND)),StringConstants.and_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Division)),StringConstants.div_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.IntegerDivision)),StringConstants.idiv_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Equal)),StringConstants.eq_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Greater)),StringConstants.gr_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.GreaterEqual)),StringConstants.greq_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.ModulusRemainder)),StringConstants.mod_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Multiplication)),StringConstants.mul_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.LogicalNOT)), StringConstants.not_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.NotEqual)),StringConstants.noteq_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.LogicalOR)),StringConstants.or_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Plus)),StringConstants.plus_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.BitwiseLeftShift)),StringConstants.shl_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.BitwiseRightShift)),StringConstants.shr_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Less)),StringConstants.sm_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.LessEqual)),StringConstants.smeq_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Minus)),StringConstants.minus_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.BitwiseXOR)),StringConstants.xor_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.AssignmentAddition)), StringConstants.plusassign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.AssignmentSubtraction)), StringConstants.minusassign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.AssignmentMultiplication)), StringConstants.multassign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.AssignmentDivision)), StringConstants.divassign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Assignment)), StringConstants.assign_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.In)), StringConstants.in_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Implicit)), StringConstants.implicit_operator_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Explicit)), StringConstants.explicit_operator_name);
|
||||
ht.Add(((int)(SyntaxTree.Operators.Power)), StringConstants.power_name);
|
||||
|
||||
pc.Add(compiler_string_consts.and_name, 2);
|
||||
pc.Add(compiler_string_consts.div_name, 2);
|
||||
pc.Add(compiler_string_consts.idiv_name, 2);
|
||||
pc.Add(compiler_string_consts.eq_name, 2);
|
||||
pc.Add(compiler_string_consts.gr_name, 2);
|
||||
pc.Add(compiler_string_consts.greq_name, 2);
|
||||
pc.Add(compiler_string_consts.mod_name, 2);
|
||||
pc.Add(compiler_string_consts.mul_name, 2);
|
||||
pc.Add(compiler_string_consts.not_name, 1);
|
||||
pc.Add(compiler_string_consts.noteq_name, 2);
|
||||
pc.Add(compiler_string_consts.or_name, 2);
|
||||
pc.Add(compiler_string_consts.plus_name, 2);
|
||||
pc.Add(compiler_string_consts.shl_name, 2);
|
||||
pc.Add(compiler_string_consts.shr_name, 2);
|
||||
pc.Add(compiler_string_consts.sm_name, 2);
|
||||
pc.Add(compiler_string_consts.smeq_name, 2);
|
||||
pc.Add(compiler_string_consts.minus_name, 2);
|
||||
pc.Add(compiler_string_consts.xor_name, 2);
|
||||
pc.Add(compiler_string_consts.plusassign_name, 2);
|
||||
pc.Add(compiler_string_consts.minusassign_name, 2);
|
||||
pc.Add(compiler_string_consts.multassign_name, 2);
|
||||
pc.Add(compiler_string_consts.divassign_name, 2);
|
||||
pc.Add(compiler_string_consts.assign_name, 2);
|
||||
pc.Add(compiler_string_consts.in_name, 2);
|
||||
pc.Add(compiler_string_consts.power_name, 2);
|
||||
pc.Add(compiler_string_consts.implicit_operator_name, 1);
|
||||
pc.Add(compiler_string_consts.explicit_operator_name, 1);
|
||||
pc.Add(StringConstants.and_name, 2);
|
||||
pc.Add(StringConstants.div_name, 2);
|
||||
pc.Add(StringConstants.idiv_name, 2);
|
||||
pc.Add(StringConstants.eq_name, 2);
|
||||
pc.Add(StringConstants.gr_name, 2);
|
||||
pc.Add(StringConstants.greq_name, 2);
|
||||
pc.Add(StringConstants.mod_name, 2);
|
||||
pc.Add(StringConstants.mul_name, 2);
|
||||
pc.Add(StringConstants.not_name, 1);
|
||||
pc.Add(StringConstants.noteq_name, 2);
|
||||
pc.Add(StringConstants.or_name, 2);
|
||||
pc.Add(StringConstants.plus_name, 2);
|
||||
pc.Add(StringConstants.shl_name, 2);
|
||||
pc.Add(StringConstants.shr_name, 2);
|
||||
pc.Add(StringConstants.sm_name, 2);
|
||||
pc.Add(StringConstants.smeq_name, 2);
|
||||
pc.Add(StringConstants.minus_name, 2);
|
||||
pc.Add(StringConstants.xor_name, 2);
|
||||
pc.Add(StringConstants.plusassign_name, 2);
|
||||
pc.Add(StringConstants.minusassign_name, 2);
|
||||
pc.Add(StringConstants.multassign_name, 2);
|
||||
pc.Add(StringConstants.divassign_name, 2);
|
||||
pc.Add(StringConstants.assign_name, 2);
|
||||
pc.Add(StringConstants.in_name, 2);
|
||||
pc.Add(StringConstants.power_name, 2);
|
||||
pc.Add(StringConstants.implicit_operator_name, 1);
|
||||
pc.Add(StringConstants.explicit_operator_name, 1);
|
||||
}
|
||||
|
||||
public static string get_name(SyntaxTree.Operators ot)
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
var semex = convert_strong(ex);
|
||||
var b = convertion_data_and_alghoritms.can_convert_type(semex, SystemLibrary.SystemLibrary.integer_type);
|
||||
var toIsIndex = (semex is common_constructor_call toCall) &&
|
||||
toCall.common_type.comprehensive_namespace.namespace_full_name.Equals(compiler_string_consts.pascalSystemUnitName) &&
|
||||
toCall.common_type.comprehensive_namespace.namespace_full_name.Equals(StringConstants.pascalSystemUnitName) &&
|
||||
toCall.common_type.PrintableName.Equals("SystemIndex");
|
||||
|
||||
var toIsIndex1 = (semex is compiled_constructor_call toCall1) &&
|
||||
|
|
@ -260,7 +260,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
var semfrom = convert_strong(from);
|
||||
var fromIsIndex = (semfrom is common_constructor_call fromCall) &&
|
||||
fromCall.common_type.comprehensive_namespace.namespace_full_name.Equals(compiler_string_consts.pascalSystemUnitName) &&
|
||||
fromCall.common_type.comprehensive_namespace.namespace_full_name.Equals(StringConstants.pascalSystemUnitName) &&
|
||||
fromCall.common_type.PrintableName.Equals("SystemIndex");
|
||||
var b = convertion_data_and_alghoritms.can_convert_type(semfrom, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b && !fromIsIndex)
|
||||
|
|
@ -268,7 +268,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
var semto = convert_strong(to);
|
||||
var toIsIndex = (semto is common_constructor_call toCall) &&
|
||||
toCall.common_type.comprehensive_namespace.namespace_full_name.Equals(compiler_string_consts.pascalSystemUnitName) &&
|
||||
toCall.common_type.comprehensive_namespace.namespace_full_name.Equals(StringConstants.pascalSystemUnitName) &&
|
||||
toCall.common_type.PrintableName.Equals("SystemIndex");
|
||||
b = convertion_data_and_alghoritms.can_convert_type(semto, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b && !toIsIndex)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -141,9 +141,6 @@
|
|||
<Compile Include="TreeConversion\CompilationErrors.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TreeConversion\compiler_string_consts.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TreeConversion\convertion_data_and_alghoritms.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
@ -253,6 +250,10 @@
|
|||
<Project>{613E0DDA-AA8A-437C-AC45-507B47429FF9}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\StringConstants\StringConstants.csproj">
|
||||
<Project>{e8aefbf9-0113-4fa4-be45-6cda555498b7}</Project>
|
||||
<Name>StringConstants</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj">
|
||||
<Name>SyntaxTree</Name>
|
||||
<Project>{C2CAC65A-B2AE-4CCC-B067-E6B8E75DF73A}</Project>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
// 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;
|
||||
|
||||
using PascalABCCompiler.Collections;
|
||||
|
||||
namespace PascalABCCompiler.TreeRealization
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ namespace PascalABCCompiler.TreeRealization
|
|||
public static void add_default_ctor(common_type_node param)
|
||||
{
|
||||
common_method_node cnode = new common_method_node(
|
||||
compiler_string_consts.default_constructor_name, param, null,
|
||||
StringConstants.default_constructor_name, param, null,
|
||||
param, SemanticTree.polymorphic_state.ps_common,
|
||||
SemanticTree.field_access_level.fal_public, null);
|
||||
cnode.is_constructor = true;
|
||||
param.methods.AddElement(cnode);
|
||||
param.add_name(compiler_string_consts.default_constructor_name, new SymbolInfo(cnode));
|
||||
param.add_name(StringConstants.default_constructor_name, new SymbolInfo(cnode));
|
||||
param.has_default_constructor = true;
|
||||
param.has_explicit_default_constructor = true;
|
||||
}
|
||||
|
|
@ -374,7 +374,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
SystemLibrary.SystemLibrary.init_reference_type(instance);
|
||||
instance.conform_basic_functions();
|
||||
//(ssyy) Нужно, чтобы добавились конструкторы
|
||||
//ctnode.find_in_type(compiler_string_consts.default_constructor_name);
|
||||
//ctnode.find_in_type(StringConstants.default_constructor_name);
|
||||
instance.instance_params = param_types;
|
||||
|
||||
property_node orig_pn = original.default_property_node;
|
||||
|
|
@ -1447,7 +1447,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
string rez;
|
||||
if (type_name)
|
||||
{
|
||||
int last = name.LastIndexOf(compiler_string_consts.generic_params_infix);
|
||||
int last = name.LastIndexOf(StringConstants.generic_params_infix);
|
||||
if (last < 0)
|
||||
{
|
||||
rez = name;
|
||||
|
|
@ -1475,7 +1475,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
if (tn.is_generic_parameter && tn.base_type != null && tn.base_type.IsAbstract && !(tn is common_type_node && (tn as common_type_node).has_default_constructor))
|
||||
return false;
|
||||
List<SymbolInfo> sil = tn.find_in_type(compiler_string_consts.default_constructor_name, tn.Scope);
|
||||
List<SymbolInfo> sil = tn.find_in_type(StringConstants.default_constructor_name, tn.Scope);
|
||||
if (sil != null)
|
||||
{
|
||||
foreach (SymbolInfo si in sil)
|
||||
|
|
@ -2227,9 +2227,9 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public void conform_basic_functions()
|
||||
{
|
||||
conform_basic_function(compiler_string_consts.assign_name, 0);
|
||||
conform_basic_function(compiler_string_consts.eq_name, 1);
|
||||
conform_basic_function(compiler_string_consts.noteq_name, 2);
|
||||
conform_basic_function(StringConstants.assign_name, 0);
|
||||
conform_basic_function(StringConstants.eq_name, 1);
|
||||
conform_basic_function(StringConstants.noteq_name, 2);
|
||||
temp_names = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
var ccnf = SystemLibrary.SystemLibInitializer.ConfigVariable.sym_info as compiled_variable_definition;
|
||||
basic_function_call bbfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_assign as basic_function_node, null);
|
||||
bbfc.parameters.AddElement(new static_compiled_variable_reference(ccnf.cont_type.find_in_type(TreeConverter.compiler_string_consts.IsConsoleApplicationVariableName)[0].sym_info as compiled_variable_definition, ccnf.cont_type, null));
|
||||
bbfc.parameters.AddElement(new static_compiled_variable_reference(ccnf.cont_type.find_in_type(StringConstants.IsConsoleApplicationVariableName)[0].sym_info as compiled_variable_definition, ccnf.cont_type, null));
|
||||
bbfc.parameters.AddElement(new bool_const_node(true, null));
|
||||
sl.statements.AddElement(bbfc);
|
||||
}
|
||||
|
|
@ -343,7 +343,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
if (units[i].main_function != null)
|
||||
{
|
||||
if (units[i].main_function.name != TreeConverter.compiler_string_consts.temp_main_function_name)
|
||||
if (units[i].main_function.name != StringConstants.temp_main_function_name)
|
||||
{
|
||||
common_namespace_function_call cnfc = new common_namespace_function_call(units[i].main_function, loc);
|
||||
sl.statements.AddElement(cnfc);
|
||||
|
|
@ -461,7 +461,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
if (!ctn.IsInterface && ctn.static_constr == null)
|
||||
{
|
||||
ctn.static_constr = new common_method_node(PascalABCCompiler.TreeConverter.compiler_string_consts.static_ctor_prefix + "Create", null, ctn, SemanticTree.polymorphic_state.ps_static, SemanticTree.field_access_level.fal_private, null);
|
||||
ctn.static_constr = new common_method_node(StringConstants.static_ctor_prefix + "Create", null, ctn, SemanticTree.polymorphic_state.ps_static, SemanticTree.field_access_level.fal_private, null);
|
||||
ctn.static_constr.is_constructor = true;
|
||||
ctn.static_constr.function_code = new statements_list(null);
|
||||
ctn.methods.AddElement(ctn.static_constr);
|
||||
|
|
@ -482,7 +482,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
if (ctn.static_constr == null)
|
||||
{
|
||||
ctn.static_constr = new common_method_node(PascalABCCompiler.TreeConverter.compiler_string_consts.static_ctor_prefix + "Create", null, ctn, SemanticTree.polymorphic_state.ps_static, SemanticTree.field_access_level.fal_private, null);
|
||||
ctn.static_constr = new common_method_node(StringConstants.static_ctor_prefix + "Create", null, ctn, SemanticTree.polymorphic_state.ps_static, SemanticTree.field_access_level.fal_private, null);
|
||||
ctn.static_constr.is_constructor = true;
|
||||
ctn.static_constr.function_code = new statements_list(null);
|
||||
ctn.methods.AddElement(ctn.static_constr);
|
||||
|
|
|
|||
|
|
@ -957,7 +957,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
null_const_node ncn = new null_const_node(_to, call_location);
|
||||
null_const_node ncn2 = new null_const_node(_to, call_location);
|
||||
|
||||
PascalABCCompiler.TreeConverter.SymbolInfo si = pr.type.find_first_in_type(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name);
|
||||
PascalABCCompiler.TreeConverter.SymbolInfo si = pr.type.find_first_in_type(StringConstants.eq_name);
|
||||
|
||||
basic_function_node fn = si.sym_info as basic_function_node;
|
||||
expression_node condition = null;
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
if (base.name != null)
|
||||
return base.name;
|
||||
if (_pointed_type != null && !check_for_circularity(_pointed_type,this))
|
||||
return PascalABCCompiler.TreeConverter.compiler_string_consts.get_pointer_type_name_by_type_name(_pointed_type.name);
|
||||
return StringConstants.get_pointer_type_name_by_type_name(_pointed_type.name);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -1705,12 +1705,12 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
if (!has_flags_attribute())
|
||||
return;
|
||||
basic_function_node _int_and = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.and_name, this, SemanticTree.basic_function_type.iand);
|
||||
basic_function_node _int_or = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.or_name, this, SemanticTree.basic_function_type.ior);
|
||||
basic_function_node _int_xor = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.xor_name, this, SemanticTree.basic_function_type.ixor);
|
||||
scope.AddSymbol(compiler_string_consts.and_name, new SymbolInfo(_int_and));
|
||||
scope.AddSymbol(compiler_string_consts.or_name, new SymbolInfo(_int_or));
|
||||
scope.AddSymbol(compiler_string_consts.xor_name, new SymbolInfo(_int_xor));
|
||||
basic_function_node _int_and = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.and_name, this, SemanticTree.basic_function_type.iand);
|
||||
basic_function_node _int_or = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.or_name, this, SemanticTree.basic_function_type.ior);
|
||||
basic_function_node _int_xor = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.xor_name, this, SemanticTree.basic_function_type.ixor);
|
||||
scope.AddSymbol(StringConstants.and_name, new SymbolInfo(_int_and));
|
||||
scope.AddSymbol(StringConstants.or_name, new SymbolInfo(_int_or));
|
||||
scope.AddSymbol(StringConstants.xor_name, new SymbolInfo(_int_xor));
|
||||
}
|
||||
|
||||
public common_property_node default_property
|
||||
|
|
@ -1904,7 +1904,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
get
|
||||
{
|
||||
//if (type_special_kind == SemanticTree.type_special_kind.typed_file)
|
||||
// return compiler_string_consts.GetTypedFileTypeName(element_type.name);
|
||||
// return StringConstants.GetTypedFileTypeName(element_type.name);
|
||||
return _name;
|
||||
}
|
||||
}
|
||||
|
|
@ -1936,7 +1936,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
}
|
||||
if (this.is_generic_type_definition)
|
||||
{
|
||||
int pos = _name.IndexOf(compiler_string_consts.generic_params_infix);
|
||||
int pos = _name.IndexOf(StringConstants.generic_params_infix);
|
||||
string rez_name = _name.Substring(0, pos) + "<";
|
||||
rez_name += _generic_params[0].name;
|
||||
for (int i = 1; i < _generic_params.Count; i++)
|
||||
|
|
@ -1967,7 +1967,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
}
|
||||
if (this.is_value_type && name.Contains("$"))
|
||||
{
|
||||
return string.Format(compiler_string_consts.recort_printable_name_template, "...");
|
||||
return string.Format(StringConstants.recort_printable_name_template, "...");
|
||||
}
|
||||
if (this.type_special_kind == SemanticTree.type_special_kind.array_wrapper)
|
||||
{
|
||||
|
|
@ -1991,15 +1991,15 @@ namespace PascalABCCompiler.TreeRealization
|
|||
UpperValue = bai.ordinal_type_interface.ordinal_type_to_int(bai.ordinal_type_interface.upper_value).ToString();
|
||||
LowerValue = bai.ordinal_type_interface.ordinal_type_to_int(bai.ordinal_type_interface.lower_value).ToString();
|
||||
}
|
||||
return string.Format(compiler_string_consts.bounded_array_printable_name_template, LowerValue, UpperValue, bai.element_type.PrintableName);
|
||||
return string.Format(StringConstants.bounded_array_printable_name_template, LowerValue, UpperValue, bai.element_type.PrintableName);
|
||||
}
|
||||
}
|
||||
if (this.type_special_kind == SemanticTree.type_special_kind.array_kind)
|
||||
{
|
||||
if (rank == 1)
|
||||
return string.Format(compiler_string_consts.array_printable_name_template, element_type.PrintableName);
|
||||
return string.Format(StringConstants.array_printable_name_template, element_type.PrintableName);
|
||||
else
|
||||
return string.Format(compiler_string_consts.multi_dim_array_printable_name_template, new string(',', rank-1), element_type.PrintableName);
|
||||
return string.Format(StringConstants.multi_dim_array_printable_name_template, new string(',', rank-1), element_type.PrintableName);
|
||||
}
|
||||
if (this.IsDelegate && this.name != null && this.name.IndexOf("$") != -1)
|
||||
{
|
||||
|
|
@ -2422,7 +2422,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public override function_node get_implicit_conversion_to(type_node ctn)
|
||||
{
|
||||
List<SymbolInfo> sil = this.find_in_type(compiler_string_consts.implicit_operator_name);
|
||||
List<SymbolInfo> sil = this.find_in_type(StringConstants.implicit_operator_name);
|
||||
if (sil != null)
|
||||
{
|
||||
function_node fn = null;
|
||||
|
|
@ -2490,7 +2490,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public override function_node get_implicit_conversion_from(type_node ctn)
|
||||
{
|
||||
List<SymbolInfo> sil = this.find_in_type(compiler_string_consts.implicit_operator_name);
|
||||
List<SymbolInfo> sil = this.find_in_type(StringConstants.implicit_operator_name);
|
||||
if (sil != null)
|
||||
{
|
||||
function_node fn = null;
|
||||
|
|
@ -2571,7 +2571,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public override function_node get_explicit_conversion_to(type_node ctn)
|
||||
{
|
||||
List<SymbolInfo> sil = this.find_in_type(compiler_string_consts.explicit_operator_name);
|
||||
List<SymbolInfo> sil = this.find_in_type(StringConstants.explicit_operator_name);
|
||||
if (sil != null)
|
||||
{
|
||||
function_node fn = null;
|
||||
|
|
@ -2589,7 +2589,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public override function_node get_explicit_conversion_from(type_node ctn)
|
||||
{
|
||||
List<SymbolInfo> sil = this.find_in_type(compiler_string_consts.explicit_operator_name);
|
||||
List<SymbolInfo> sil = this.find_in_type(StringConstants.explicit_operator_name);
|
||||
if (sil != null)
|
||||
{
|
||||
function_node fn = null;
|
||||
|
|
@ -2771,7 +2771,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
get
|
||||
{
|
||||
return compiler_string_consts.GetShortStringTypeName(length);
|
||||
return StringConstants.GetShortStringTypeName(length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2791,7 +2791,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public override SymbolInfo find_first_in_type(string name, bool no_search_in_extension_methods = false)
|
||||
{
|
||||
if (name == compiler_string_consts.assign_name || name == compiler_string_consts.plusassign_name)
|
||||
if (name == StringConstants.assign_name || name == StringConstants.plusassign_name)
|
||||
{
|
||||
var temp = _scope.FindOnlyInType(name, null);
|
||||
return temp?.FirstOrDefault();
|
||||
|
|
@ -2804,7 +2804,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
//return this.find_in_additional_names(name)
|
||||
//SymbolInfo si = _scope.FindOnlyInType(name, null);
|
||||
//if (name )
|
||||
if (name == compiler_string_consts.assign_name || name == compiler_string_consts.plusassign_name)
|
||||
if (name == StringConstants.assign_name || name == StringConstants.plusassign_name)
|
||||
return _scope.FindOnlyInType(name, null);
|
||||
return SystemLibrary.SystemLibrary.string_type.find_in_type(name);
|
||||
}
|
||||
|
|
@ -2813,7 +2813,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
//return this.find_in_additional_names(name);
|
||||
//SymbolInfo si = _scope.FindOnlyInType(name, CurrentScope);
|
||||
if (name == compiler_string_consts.assign_name || name == compiler_string_consts.plusassign_name)
|
||||
if (name == StringConstants.assign_name || name == StringConstants.plusassign_name)
|
||||
{
|
||||
return _scope.FindOnlyInType(name, null);
|
||||
}
|
||||
|
|
@ -2849,7 +2849,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
//if (ctn == base_type)
|
||||
// return TreeConverter.convertion_data_and_alghoritms.get_empty_conversion(ctn, this, false);
|
||||
//SymbolInfo si = find_in_type(compiler_string_consts.implicit_operator_name);
|
||||
//SymbolInfo si = find_in_type(StringConstants.implicit_operator_name);
|
||||
return null;//ss:=s
|
||||
}
|
||||
|
||||
|
|
@ -3198,7 +3198,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
private string MakePseudoInstanceName(List<type_node> param_types)
|
||||
{
|
||||
int last = name.LastIndexOf(compiler_string_consts.generic_params_infix);
|
||||
int last = name.LastIndexOf(StringConstants.generic_params_infix);
|
||||
string rez = name.Substring(0, last);
|
||||
bool first = true;
|
||||
foreach (type_node tnode in param_types)
|
||||
|
|
@ -3253,7 +3253,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
if (base_type == SystemLibrary.SystemLibrary.delegate_base_type)
|
||||
{
|
||||
SymbolInfo si_int = this.find_first_in_type(compiler_string_consts.invoke_method_name);
|
||||
SymbolInfo si_int = this.find_first_in_type(StringConstants.invoke_method_name);
|
||||
#if DEBUG
|
||||
if (si_int == null)
|
||||
{
|
||||
|
|
@ -3267,7 +3267,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
throw new CompilerInternalError("No invoke method in class derived from MulticastDelegate");
|
||||
}
|
||||
#endif
|
||||
SymbolInfo si_cons = this.find_first_in_type(compiler_string_consts.net_constructor_name);
|
||||
SymbolInfo si_cons = this.find_first_in_type(StringConstants.net_constructor_name);
|
||||
compiled_constructor_node ctor = si_cons.sym_info as compiled_constructor_node;
|
||||
#if DEBUG
|
||||
if (ctor == null)
|
||||
|
|
@ -3279,10 +3279,10 @@ namespace PascalABCCompiler.TreeRealization
|
|||
invoke, ctor);
|
||||
dii.parameters.AddRange(invoke.parameters);
|
||||
this.add_internal_interface(dii);
|
||||
add_delegate_operator(compiler_string_consts.plusassign_name, type_constructor.instance.delegate_add_assign_compile_time_executor);
|
||||
add_delegate_operator(compiler_string_consts.plus_name, type_constructor.instance.delegate_add_compile_time_executor);
|
||||
add_delegate_operator(compiler_string_consts.minusassign_name, type_constructor.instance.delegate_sub_assign_compile_time_executor);
|
||||
add_delegate_operator(compiler_string_consts.minus_name, type_constructor.instance.delegate_sub_compile_time_executor);
|
||||
add_delegate_operator(StringConstants.plusassign_name, type_constructor.instance.delegate_add_assign_compile_time_executor);
|
||||
add_delegate_operator(StringConstants.plus_name, type_constructor.instance.delegate_add_compile_time_executor);
|
||||
add_delegate_operator(StringConstants.minusassign_name, type_constructor.instance.delegate_sub_assign_compile_time_executor);
|
||||
add_delegate_operator(StringConstants.minus_name, type_constructor.instance.delegate_sub_compile_time_executor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3294,9 +3294,9 @@ namespace PascalABCCompiler.TreeRealization
|
|||
cnfn.ConnectedToType = this;
|
||||
cnfn.compile_time_executor = executor;
|
||||
add_name(name, new SymbolInfo(cnfn));
|
||||
common_parameter cp1 = new common_parameter(compiler_string_consts.left_param_name, this, SemanticTree.parameter_type.value,
|
||||
common_parameter cp1 = new common_parameter(StringConstants.left_param_name, this, SemanticTree.parameter_type.value,
|
||||
cnfn, concrete_parameter_type.cpt_none, null, null);
|
||||
common_parameter cp2 = new common_parameter(compiler_string_consts.right_param_name, this, SemanticTree.parameter_type.value,
|
||||
common_parameter cp2 = new common_parameter(StringConstants.right_param_name, this, SemanticTree.parameter_type.value,
|
||||
cnfn, concrete_parameter_type.cpt_none, null, null);
|
||||
cnfn.parameters.AddElement(cp1);
|
||||
cnfn.parameters.AddElement(cp2);
|
||||
|
|
@ -3324,8 +3324,8 @@ namespace PascalABCCompiler.TreeRealization
|
|||
compiled_constructor_node ccn=compiled_constructor_node.get_compiled_constructor(ci);
|
||||
SymbolInfo si=new SymbolInfo(ccn);
|
||||
NetHelper.NetHelper.AddConstructor(ci, ccn);
|
||||
//add_additional_name(compiler_string_consts.standart_constructor_name,si);
|
||||
add_name(compiler_string_consts.default_constructor_name, si);
|
||||
//add_additional_name(StringConstants.standart_constructor_name,si);
|
||||
add_name(StringConstants.default_constructor_name, si);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3348,17 +3348,17 @@ namespace PascalABCCompiler.TreeRealization
|
|||
private static void InitEnumOperations(compiled_type_node ctn)
|
||||
{
|
||||
if (ctn.compiled_type.GetCustomAttributes(typeof(FlagsAttribute), true).Length == 0) return;
|
||||
basic_function_node _int_and = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.and_name, ctn, SemanticTree.basic_function_type.iand);
|
||||
basic_function_node _int_and = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.and_name, ctn, SemanticTree.basic_function_type.iand);
|
||||
_int_and.compile_time_executor = SystemLibrary.static_executors.enum_and_executor;
|
||||
basic_function_node _int_or = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.or_name, ctn, SemanticTree.basic_function_type.ior);
|
||||
basic_function_node _int_or = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.or_name, ctn, SemanticTree.basic_function_type.ior);
|
||||
_int_or.compile_time_executor = SystemLibrary.static_executors.enum_or_executor;
|
||||
basic_function_node _int_xor = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.xor_name, ctn, SemanticTree.basic_function_type.ixor);
|
||||
basic_function_node _int_xor = SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.xor_name, ctn, SemanticTree.basic_function_type.ixor);
|
||||
_int_xor.compile_time_executor = SystemLibrary.static_executors.enum_xor_executor;
|
||||
if (ctn.scope != null)
|
||||
{
|
||||
ctn.scope.AddSymbol(compiler_string_consts.and_name, new SymbolInfo(_int_and));
|
||||
ctn.scope.AddSymbol(compiler_string_consts.or_name, new SymbolInfo(_int_or));
|
||||
ctn.scope.AddSymbol(compiler_string_consts.xor_name, new SymbolInfo(_int_xor));
|
||||
ctn.scope.AddSymbol(StringConstants.and_name, new SymbolInfo(_int_and));
|
||||
ctn.scope.AddSymbol(StringConstants.or_name, new SymbolInfo(_int_or));
|
||||
ctn.scope.AddSymbol(StringConstants.xor_name, new SymbolInfo(_int_xor));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3434,10 +3434,10 @@ namespace PascalABCCompiler.TreeRealization
|
|||
lower_value, upper_value, oti_old.value_to_int, oti_old.ordinal_type_to_int);
|
||||
|
||||
ctn.add_internal_interface(oti_new);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.gr_name, ctn, SemanticTree.basic_function_type.enumgr, SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.greq_name, ctn, SemanticTree.basic_function_type.enumgreq, SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.sm_name, ctn, SemanticTree.basic_function_type.enumsm, SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.smeq_name, ctn, SemanticTree.basic_function_type.enumsmeq, SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.gr_name, ctn, SemanticTree.basic_function_type.enumgr, SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.greq_name, ctn, SemanticTree.basic_function_type.enumgreq, SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.sm_name, ctn, SemanticTree.basic_function_type.enumsm, SystemLibrary.SystemLibrary.bool_type);
|
||||
SystemLibrary.SystemLibrary.make_binary_operator(StringConstants.smeq_name, ctn, SemanticTree.basic_function_type.enumsmeq, SystemLibrary.SystemLibrary.bool_type);
|
||||
InitEnumOperations(ctn);
|
||||
}
|
||||
//ctn.init_scope();
|
||||
|
|
@ -4146,7 +4146,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
return base.name;
|
||||
}
|
||||
return PascalABCCompiler.TreeConverter.compiler_string_consts.simple_array_name;
|
||||
return StringConstants.simple_array_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4875,7 +4875,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
private string _name=null;
|
||||
private string make_name()
|
||||
{
|
||||
if (_proper_methods.Count == 0) return compiler_string_consts.method_group_type_name;
|
||||
if (_proper_methods.Count == 0) return StringConstants.method_group_type_name;
|
||||
base_function_call bfc = _proper_methods[0];
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
if (bfc.function.return_value_type == null)
|
||||
|
|
@ -4911,7 +4911,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
if (_name == null) _name = make_name();
|
||||
return _name;
|
||||
//return compiler_string_consts.method_group_type_name;
|
||||
//return StringConstants.method_group_type_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4924,7 +4924,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public override List<SymbolInfo> find_in_type(string name, bool no_search_in_extension_methods = false)
|
||||
{
|
||||
if (name != compiler_string_consts.plusassign_name && name != compiler_string_consts.minusassign_name)
|
||||
if (name != StringConstants.plusassign_name && name != StringConstants.minusassign_name)
|
||||
foreach (base_function_call fn in _proper_methods)
|
||||
{
|
||||
if (fn.simple_function_node.parameters.Count == 0)
|
||||
|
|
@ -5001,7 +5001,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public override string name
|
||||
{
|
||||
get { return compiler_string_consts.GetTypedFileTypeName(element_type.name); }
|
||||
get { return StringConstants.GetTypedFileTypeName(element_type.name); }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -5291,7 +5291,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
private int _length;
|
||||
private type_node _element_type;
|
||||
public ArrayConstType(type_node element_type, int length, location loc)
|
||||
:base(compiler_string_consts.array_const_type_name, loc)
|
||||
:base(StringConstants.array_const_type_name, loc)
|
||||
{
|
||||
_length = length;
|
||||
_element_type = element_type;
|
||||
|
|
@ -5324,7 +5324,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
public class RecordConstType : undefined_type
|
||||
{
|
||||
public RecordConstType(location loc)
|
||||
: base(compiler_string_consts.record_const_type_name, loc)
|
||||
: base(StringConstants.record_const_type_name, loc)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -5335,7 +5335,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
//public type_node real_type = null;
|
||||
public auto_type(location loc)
|
||||
: base(compiler_string_consts.auto_type_name, loc) { }
|
||||
: base(StringConstants.auto_type_name, loc) { }
|
||||
}
|
||||
|
||||
// тип, который объявляется как ienumerable_auto и определяется при компиляции в момент первого присваивания
|
||||
|
|
@ -5344,7 +5344,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
//public type_node real_type = null;
|
||||
public ienumerable_auto_type(location loc)
|
||||
: base(compiler_string_consts.ienumerable_auto_type_name, loc) { }
|
||||
: base(StringConstants.ienumerable_auto_type_name, loc) { }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
get
|
||||
{
|
||||
TreeConverter.SymbolInfo si = namespaces[0].findFirstOnlyInNamespace(TreeConverter.compiler_string_consts.system_unit_marker);
|
||||
TreeConverter.SymbolInfo si = namespaces[0].findFirstOnlyInNamespace(StringConstants.system_unit_marker);
|
||||
if (si == null)
|
||||
return false;
|
||||
if (si.sym_info is constant_definition_node)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";");
|
||||
sf = string.Format(VECStringResources.Get("DIALOGS_FILTER_PART_{0}{1}|{1}|"), Name, sf);
|
||||
if (sf.IndexOf(compiler_string_consts.pascalSourceFileExtension) >= 0)
|
||||
if (sf.IndexOf(StringConstants.pascalSourceFileExtension) >= 0)
|
||||
return sf + Filter;
|
||||
else
|
||||
return Filter + sf;
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ namespace VisualPascalABC
|
|||
if (event_description != null)
|
||||
{
|
||||
MethodInfo mi = event_description.e.EventType.GetMethod(
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.invoke_method_name);
|
||||
PascalABCCompiler.StringConstants.invoke_method_name);
|
||||
ParameterInfo[] pinfos = mi.GetParameters();
|
||||
bool handler_found = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ namespace VisualPascalABC
|
|||
doc.Replace(offset, unitName.name.Length, new_val);
|
||||
doc.CommitUpdate();
|
||||
}
|
||||
WorkbenchServiceFactory.CodeCompletionParserController.RunParseThread();
|
||||
WorkbenchServiceFactory.CodeCompletionParserController.SwitchOnIntellisence();
|
||||
VisualPABCSingleton.MainForm.StartTimer();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,6 @@
|
|||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using ICSharpCode.TextEditor;
|
||||
using ICSharpCode.TextEditor.Gui.CompletionWindow;
|
||||
using ICSharpCode.TextEditor.Document;
|
||||
|
||||
namespace VisualPascalABC
|
||||
{
|
||||
|
|
@ -116,7 +110,10 @@ namespace VisualPascalABC
|
|||
}
|
||||
}
|
||||
|
||||
public void RunParseThread()
|
||||
/// <summary>
|
||||
/// Запуск потока с Intellisence
|
||||
/// </summary>
|
||||
public void SwitchOnIntellisence()
|
||||
{
|
||||
th = new System.Threading.Thread(InternalParsing);
|
||||
th.Priority = System.Threading.ThreadPriority.BelowNormal;
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name), "+");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.plus_name), "+");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -1026,7 +1026,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name), "-");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.minus_name), "-");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -1288,7 +1288,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name), "*");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.mul_name), "*");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -1537,7 +1537,7 @@ namespace VisualPascalABC
|
|||
left.obj_val = DebugUtils.MakeValue(left.prim_val);
|
||||
if (right.obj_val == null && right.prim_val != null)
|
||||
right.obj_val = DebugUtils.MakeValue(right.prim_val);
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.div_name), "/");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.div_name), "/");
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
}
|
||||
|
|
@ -1725,7 +1725,7 @@ namespace VisualPascalABC
|
|||
left.obj_val = DebugUtils.MakeValue(left.prim_val);
|
||||
if (right.obj_val == null && right.prim_val != null)
|
||||
right.obj_val = DebugUtils.MakeValue(right.prim_val);
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name), "div");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.idiv_name), "div");
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
}
|
||||
|
|
@ -1923,7 +1923,7 @@ namespace VisualPascalABC
|
|||
left.obj_val = DebugUtils.MakeValue(left.prim_val);
|
||||
if (right.obj_val == null && right.prim_val != null)
|
||||
right.obj_val = DebugUtils.MakeValue(right.prim_val);
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name), "and");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.and_name), "and");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2119,7 +2119,7 @@ namespace VisualPascalABC
|
|||
left.obj_val = DebugUtils.MakeValue(left.prim_val);
|
||||
if (right.obj_val == null && right.prim_val != null)
|
||||
right.obj_val = DebugUtils.MakeValue(right.prim_val);
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name), "-");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.plus_name), "-");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2970,7 +2970,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
string op = PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name);
|
||||
string op = PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.eq_name);
|
||||
if (left.obj_val.Type != right.obj_val.Type)
|
||||
{
|
||||
Type left_type = AssemblyHelper.GetType(left.obj_val.Type.FullName);
|
||||
|
|
@ -3322,7 +3322,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
string op = PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name);
|
||||
string op = PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.noteq_name);
|
||||
if (left.obj_val.Type != right.obj_val.Type)
|
||||
{
|
||||
Type left_type = AssemblyHelper.GetType(left.obj_val.Type.FullName);
|
||||
|
|
@ -3649,7 +3649,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name), "<");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.sm_name), "<");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -3931,7 +3931,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name), "<=");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.smeq_name), "<=");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -4214,7 +4214,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name), ">");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.gr_name), ">");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -4497,7 +4497,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name), ">=");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.greq_name), ">=");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -4687,7 +4687,7 @@ namespace VisualPascalABC
|
|||
left.obj_val = DebugUtils.MakeValue(left.prim_val);
|
||||
if (right.obj_val == null && right.prim_val != null)
|
||||
right.obj_val = DebugUtils.MakeValue(right.prim_val);
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name), "mod");
|
||||
res.obj_val = EvalCommonOperation(left.obj_val, right.obj_val, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.mod_name), "mod");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4844,7 +4844,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
string op = PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.not_name);
|
||||
string op = PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.not_name);
|
||||
{
|
||||
IList<MemberInfo> mems = left.obj_val.Type.GetMember(op, Debugger.BindingFlags.All);
|
||||
if (mems != null && mems.Count == 1 && mems[0] is MethodInfo)
|
||||
|
|
|
|||
|
|
@ -323,9 +323,9 @@ namespace VisualPascalABC
|
|||
List<DebugType> types = new List<DebugType>();
|
||||
try
|
||||
{
|
||||
if (val.Type.FullName.Contains(PascalABCCompiler.TreeConverter.compiler_string_consts.ImplementationSectionNamespaceName))
|
||||
if (val.Type.FullName.Contains(PascalABCCompiler.StringConstants.ImplementationSectionNamespaceName))
|
||||
{
|
||||
string interf_name = val.Type.FullName.Substring(0, val.Type.FullName.IndexOf(PascalABCCompiler.TreeConverter.compiler_string_consts.ImplementationSectionNamespaceName));
|
||||
string interf_name = val.Type.FullName.Substring(0, val.Type.FullName.IndexOf(PascalABCCompiler.StringConstants.ImplementationSectionNamespaceName));
|
||||
Type t = AssemblyHelper.GetTypeForStatic(interf_name);
|
||||
DebugType dt = DebugUtils.GetDebugType(t);
|
||||
types.Add(dt);
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ namespace VisualPascalABC
|
|||
timer.Interval = 2000;
|
||||
timer.Tick += TimerTicked;*/
|
||||
//timer.Start();
|
||||
WorkbenchServiceFactory.CodeCompletionParserController.RunParseThread();
|
||||
WorkbenchServiceFactory.CodeCompletionParserController.SwitchOnIntellisence();
|
||||
/*this.tsGotoRealization = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsGotoRealization.Enabled = false;
|
||||
//this.tsGotoRealization.Image = ((System.Drawing.Image)(resources.GetObject("tsGotoDefinition.Image")));
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ namespace VisualPascalABC
|
|||
MessageBox.Show(Form1StringResources.Get("INVALID_SOURCE_FILE_NAME"), PascalABCCompiler.StringResources.Get("!ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.Compare(Path.GetExtension(e.Label), compiler_string_consts.pascalSourceFileExtension, true) != 0)
|
||||
if (string.Compare(Path.GetExtension(e.Label), StringConstants.pascalSourceFileExtension, true) != 0)
|
||||
{
|
||||
e.CancelEdit = true;
|
||||
MessageBox.Show(Form1StringResources.Get("INVALID_SOURCE_FILE_EXTENSION"), PascalABCCompiler.StringResources.Get("!ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace VisualPascalABC
|
|||
currentProject.include_debug_info = true;
|
||||
|
||||
currentProject.project_type = projectType;
|
||||
currentProject.source_files.Add(new PascalABCCompiler.SourceCodeFileInfo(projectName + compiler_string_consts.pascalSourceFileExtension, Path.Combine(dir, projectName + compiler_string_consts.pascalSourceFileExtension)));
|
||||
currentProject.source_files.Add(new PascalABCCompiler.SourceCodeFileInfo(projectName + StringConstants.pascalSourceFileExtension, Path.Combine(dir, projectName + StringConstants.pascalSourceFileExtension)));
|
||||
currentProject.references.Add(new PascalABCCompiler.ReferenceInfo("System", "System.dll"));
|
||||
if (projectType == PascalABCCompiler.ProjectType.WindowsApp)
|
||||
{
|
||||
|
|
@ -79,7 +79,7 @@ namespace VisualPascalABC
|
|||
currentProject.references.Add(new PascalABCCompiler.ReferenceInfo("System.Xml.Linq", "System.Xml.Linq.dll"));
|
||||
//roman//
|
||||
}
|
||||
currentProject.main_file = Path.Combine(dir, projectName + compiler_string_consts.pascalSourceFileExtension);
|
||||
currentProject.main_file = Path.Combine(dir, projectName + StringConstants.pascalSourceFileExtension);
|
||||
currentProject.generate_xml_doc = false;
|
||||
currentProject.delete_exe = true;
|
||||
currentProject.delete_pdb = true;
|
||||
|
|
@ -88,7 +88,7 @@ namespace VisualPascalABC
|
|||
currentProject.build_version = 0;
|
||||
currentProject.revision_version = 0;
|
||||
currentProject.output_directory = dir;
|
||||
StreamWriter sw = File.CreateText(Path.Combine(dir, projectName + compiler_string_consts.pascalSourceFileExtension));
|
||||
StreamWriter sw = File.CreateText(Path.Combine(dir, projectName + StringConstants.pascalSourceFileExtension));
|
||||
currentProject.output_file_name = projectName + ".exe";
|
||||
if (projectType == PascalABCCompiler.ProjectType.ConsoleApp)
|
||||
{
|
||||
|
|
@ -231,7 +231,7 @@ namespace VisualPascalABC
|
|||
|
||||
public string GetUnitFileName()
|
||||
{
|
||||
return "Unit"+uid++ + compiler_string_consts.pascalSourceFileExtension;
|
||||
return "Unit"+uid++ + StringConstants.pascalSourceFileExtension;
|
||||
}
|
||||
|
||||
public string GetFullUnitFileName()
|
||||
|
|
|
|||
|
|
@ -824,6 +824,10 @@
|
|||
<Project>{cfc683f8-0165-4a9f-9c3f-bb8c5bab507f}</Project>
|
||||
<Name>PluginsSupport</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\StringConstants\StringConstants.csproj">
|
||||
<Project>{e8aefbf9-0113-4fa4-be45-6cda555498b7}</Project>
|
||||
<Name>StringConstants</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj">
|
||||
<Project>{C2CAC65A-B2AE-4CCC-B067-E6B8E75DF73A}</Project>
|
||||
<Name>SyntaxTree</Name>
|
||||
|
|
|
|||
|
|
@ -818,6 +818,10 @@
|
|||
<Project>{cfc683f8-0165-4a9f-9c3f-bb8c5bab507f}</Project>
|
||||
<Name>PluginsSupport</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\StringConstants\StringConstants.csproj">
|
||||
<Project>{e8aefbf9-0113-4fa4-be45-6cda555498b7}</Project>
|
||||
<Name>StringConstants</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj">
|
||||
<Project>{C2CAC65A-B2AE-4CCC-B067-E6B8E75DF73A}</Project>
|
||||
<Name>SyntaxTree</Name>
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ namespace VisualPascalABC
|
|||
if (event_description != null)
|
||||
{
|
||||
MethodInfo mi = event_description.e.EventType.GetMethod(
|
||||
PascalABCCompiler.TreeConverter.compiler_string_consts.invoke_method_name);
|
||||
StringConstants.invoke_method_name);
|
||||
ParameterInfo[] pinfos = mi.GetParameters();
|
||||
bool handler_found = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -730,7 +730,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name), "+");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.plus_name), "+");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -1083,7 +1083,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name), "-");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.minus_name), "-");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -1345,7 +1345,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name), "*");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.mul_name), "*");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -1594,7 +1594,7 @@ namespace VisualPascalABC
|
|||
left.monoValue = DebugUtils.MakeMonoValue(left.prim_val);
|
||||
if (right.monoValue == null && right.prim_val != null)
|
||||
right.monoValue = DebugUtils.MakeMonoValue(right.prim_val);
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.div_name), "/");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.div_name), "/");
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
}
|
||||
|
|
@ -1782,7 +1782,7 @@ namespace VisualPascalABC
|
|||
left.monoValue = DebugUtils.MakeMonoValue(left.prim_val);
|
||||
if (right.monoValue == null && right.prim_val != null)
|
||||
right.monoValue = DebugUtils.MakeMonoValue(right.prim_val);
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name), "div");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.idiv_name), "div");
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
}
|
||||
|
|
@ -1980,7 +1980,7 @@ namespace VisualPascalABC
|
|||
left.monoValue = DebugUtils.MakeMonoValue(left.prim_val);
|
||||
if (right.monoValue == null && right.prim_val != null)
|
||||
right.monoValue = DebugUtils.MakeMonoValue(right.prim_val);
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name), "and");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.and_name), "and");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2176,7 +2176,7 @@ namespace VisualPascalABC
|
|||
left.monoValue = DebugUtils.MakeMonoValue(left.prim_val);
|
||||
if (right.monoValue == null && right.prim_val != null)
|
||||
right.monoValue = DebugUtils.MakeMonoValue(right.prim_val);
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name), "-");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.plus_name), "-");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3027,7 +3027,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
string op = PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name);
|
||||
string op = PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.eq_name);
|
||||
if (left.obj_val.Type != right.obj_val.Type)
|
||||
{
|
||||
Type left_type = AssemblyHelper.GetType(left.obj_val.Type.FullName);
|
||||
|
|
@ -3379,7 +3379,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
string op = PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name);
|
||||
string op = PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.noteq_name);
|
||||
if (left.obj_val.Type != right.obj_val.Type)
|
||||
{
|
||||
Type left_type = AssemblyHelper.GetType(left.obj_val.Type.FullName);
|
||||
|
|
@ -3706,7 +3706,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name), "<");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.sm_name), "<");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -3988,7 +3988,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name), "<=");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.smeq_name), "<=");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -4271,7 +4271,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name), ">");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.gr_name), ">");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -4554,7 +4554,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name), ">=");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.greq_name), ">=");
|
||||
}
|
||||
}
|
||||
eval_stack.Push(res);
|
||||
|
|
@ -4744,7 +4744,7 @@ namespace VisualPascalABC
|
|||
left.obj_val = DebugUtils.MakeValue(left.prim_val);
|
||||
if (right.obj_val == null && right.prim_val != null)
|
||||
right.obj_val = DebugUtils.MakeValue(right.prim_val);
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name), "mod");
|
||||
res.monoValue = EvalCommonOperation(left.monoValue, right.monoValue, PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.mod_name), "mod");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4905,7 +4905,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
{
|
||||
string op = PascalABCCompiler.TreeConverter.compiler_string_consts.GetNETOperName(PascalABCCompiler.TreeConverter.compiler_string_consts.not_name);
|
||||
string op = PascalABCCompiler.StringConstants.GetNETOperName(PascalABCCompiler.StringConstants.not_name);
|
||||
{
|
||||
IList<MemberInfo> mems = left.obj_val.Type.GetMember(op, Debugger.BindingFlags.All);
|
||||
if (mems != null && mems.Count == 1 && mems[0] is MethodInfo)
|
||||
|
|
|
|||
|
|
@ -297,9 +297,9 @@ namespace VisualPascalABC
|
|||
List<Mono.Debugging.Evaluation.TypeValueReference> types = new List<Mono.Debugging.Evaluation.TypeValueReference>();
|
||||
try
|
||||
{
|
||||
if (val.TypeName.Contains(PascalABCCompiler.TreeConverter.compiler_string_consts.ImplementationSectionNamespaceName))
|
||||
if (val.TypeName.Contains(PascalABCCompiler.StringConstants.ImplementationSectionNamespaceName))
|
||||
{
|
||||
string interf_name = val.TypeName.Substring(0, val.TypeName.IndexOf(PascalABCCompiler.TreeConverter.compiler_string_consts.ImplementationSectionNamespaceName));
|
||||
string interf_name = val.TypeName.Substring(0, val.TypeName.IndexOf(PascalABCCompiler.StringConstants.ImplementationSectionNamespaceName));
|
||||
Type t = AssemblyHelper.GetTypeForStatic(interf_name);
|
||||
var tr = new Mono.Debugging.Evaluation.TypeValueReference(frame.SourceBacktrace.GetEvaluationContext(frame.Index, Mono.Debugging.Client.EvaluationOptions.DefaultOptions),
|
||||
(frame.DebuggerSession as Mono.Debugging.Soft.SoftDebuggerSession).GetType(t.FullName));
|
||||
|
|
|
|||
|
|
@ -942,6 +942,10 @@
|
|||
<Project>{e009e776-9280-4061-b5ca-7f0c3e2d3c2a}</Project>
|
||||
<Name>PluginsSupportLinux</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\StringConstants\StringConstants.csproj">
|
||||
<Project>{e8aefbf9-0113-4fa4-be45-6cda555498b7}</Project>
|
||||
<Name>StringConstants</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj">
|
||||
<Project>{C2CAC65A-B2AE-4CCC-B067-E6B8E75DF73A}</Project>
|
||||
<Name>SyntaxTree</Name>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ copy bin\mono_pabcnetc.bat Release\PascalABCNETLinux\mono_pabcnetc.bat
|
|||
copy bin\NETGenerator.dll Release\PascalABCNETLinux\NETGenerator.dll
|
||||
copy bin\OptimizerConversion.dll Release\PascalABCNETLinux\OptimizerConversion.dll
|
||||
copy bin\LanguageIntegrator.dll Release\PascalABCNETLinux\LanguageIntegrator.dll
|
||||
copy bin\StringConstants.dll Release\PascalABCNETLinux\StringConstants.dll
|
||||
|
||||
copy bin\pabcnetc.exe Release\PascalABCNETLinux\pabcnetc.exe
|
||||
copy bin\pabcnetc.exe.config Release\PascalABCNETLinux\pabcnetc.exe.config
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Files with namespaces can be compiled
|
|||
NAMESPACE_CANNOT_HAVE_IN_SECTION=Namespace cannot have 'in' section
|
||||
APPTYPE_DLL_IS_ALLOWED_ONLY_FOR_LIBRARIES= {$apptype dll} directive is allowed only for libraries
|
||||
USES_IN_WRONG_NAME=Unit name in uses-in ({0}) must be same as file name ({1})
|
||||
UNSUPPORTED_TARGETFRAMEWORK_{0}=TargetFramework '{0}' not supported
|
||||
UNSUPPORTED_TARGETFRAMEWORK_{0}=TargetFramework '{0}' is not supported
|
||||
UNSUPPORTED_TARGET_PLATFORM{0}=Platform '{0}' is not supported
|
||||
UNSUPPORTED_OUTPUT_FILE_TYPE{0}=Output file type '{0}' is not supported
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Internal compiler error in module {0} :'{1}'
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
//Parser errors in PascalABCCompiler.Errors
|
||||
// UNIVERSAL PARSER ERRORS
|
||||
%PREFIX%=PARSER_ERRORS_
|
||||
|
||||
BAD_FLOAT=Too big (small) number
|
||||
|
|
@ -11,3 +11,8 @@ BIG_CHAR_NUMBER=Too big char const
|
|||
LOAD_ERROR{0}=Parser {0} loading error
|
||||
BAD_SOURCEFILE{0}_EXT=Can not choose parser for file '{0}'
|
||||
COMPILATION_ERROR{0}{1}{2}={0}{1} Compilation error: {2}
|
||||
|
||||
EXPECTED_IDENTIFIER=Expected identifier
|
||||
AVAILABLE_PARAM_VARIANTS{0}=Possible values are: {0}
|
||||
AVAILABLE_EXT_VARIANTS{0}=Possible file extensions: {0}
|
||||
SEE_THE_HELP_FOR_VARIANTS=You can find the possible values in the language documentation
|
||||
|
|
|
|||
|
|
@ -18,9 +18,15 @@ LEFT_SIDE_ASSIGN_MUST_BE_VARIABLE=Leftside assigment must be variable
|
|||
PROCEDURE_CANNOT_HAVE_RETURNED_VALUE=Procedure cannot have returned value
|
||||
EXPECTED_{0}_BUT_FOUND_{1}=Expected '{0}' but found '{1}'
|
||||
NONTERMINALTOKEN_{0}_RETURN_NULL=Syntax rule '{0}' is not supported by the current version of the compiler
|
||||
SEMICOLON_BEFORE_ELSE=Перед else нельзя ставить точку с запятой
|
||||
SEMICOLON_BEFORE_ELSE=<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
UNEXPECTED_SYMBOL{0}=Unexpected symbol '{0}'
|
||||
UNSUPPORTED_OLD_DIRECTIVES=Compiler directives began with # are not supported. Use directives {$ }
|
||||
UNKNOWN_DIRECTIVE{0}=Unknown directive '{0}'
|
||||
MISSING_DIRECTIVE_PARAM{0}=Directive '{0}' requires a parameter
|
||||
UNNECESSARY_DIRECTIVE_PARAM{0}=Directive '{0}' is used without parameters
|
||||
INCORRECT_DIRECTIVE_PARAM{0}{1}{2}=Invalid parameter '{0}' passed to directive '{1}'. {2}
|
||||
EMPTY_DIRECTIVE=Empty directive is not allowed
|
||||
DIRECTIVE_WRONG_NUMBER_OF_PARAMS{0}{1}=Directive '{0}' must have {1}
|
||||
INCLUDE_COULDNT_OPEN_FILE{0}=Compiler directive $include: can't open file '{0}'
|
||||
INCLUDE_EMPTY_FILE=Compiler directive $include: file name is absent
|
||||
RECUR_INCLUDE=Compiler directive $include: recursive include
|
||||
|
|
@ -31,6 +37,12 @@ TYPE_NAME_EXPECTED=Type expected
|
|||
MULTILINE_STRING_CONTAINS_INCONSISTENT_INDENTS=Multiline string contains inconsistent indents
|
||||
NON_WHITESPACE_CHARACTERS_BEFORE_CLOSING_QUOTES_OF_MULTILINE_STRING=There should be no non-whitespace characters before the closing quotes of the multiline string
|
||||
|
||||
PARAM_SINGLE1=parameter
|
||||
PARAM_SINGLE2=parameter
|
||||
PARAM_MULTIPLE1=parameters
|
||||
PARAM_MULTIPLE2=parameters
|
||||
NOT_MORE_THAN=no more than
|
||||
EXACTLY=exactly
|
||||
|
||||
EOF1=end of file
|
||||
EOF=(end of file)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ NAMESPACE_CANNOT_HAVE_IN_SECTION=Для пространства имен не
|
|||
APPTYPE_DLL_IS_ALLOWED_ONLY_FOR_LIBRARIES=Директива {$apptype dll} возможна только для библиотек
|
||||
USES_IN_WRONG_NAME=Имя модуля в uses-in ({0}) должно совпадать с именем файла ({1})
|
||||
UNSUPPORTED_TARGETFRAMEWORK_{0}=TargetFramework '{0}' не поддерживается
|
||||
UNSUPPORTED_TARGET_PLATFORM{0}=Платформа '{0}' не поддерживается
|
||||
UNSUPPORTED_OUTPUT_FILE_TYPE{0}=Тип выходного файла '{0}' не поддерживается
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутренняя ошибка компилятора в модуле {0} :'{1}'
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
//Parser errors in PascalABCCompiler.Errors
|
||||
// UNIVERSAL PARSER ERRORS
|
||||
%PREFIX%=PARSER_ERRORS_
|
||||
|
||||
BAD_FLOAT=Слишком большое вещественное
|
||||
|
|
@ -11,4 +11,9 @@ EXPECTED{0}=Ожидалось {0}
|
|||
BIG_CHAR_NUMBER=Слишком большая константа
|
||||
LOAD_ERROR{0}=Ошибка загрузки парсера {0}
|
||||
BAD_SOURCEFILE{0}_EXT=Не могу выбрать подходящий парсер для файла '{0}'
|
||||
COMPILATION_ERROR{0}{1}{2}={0}{1} Ошибка компиляции: {2}
|
||||
COMPILATION_ERROR{0}{1}{2}={0}{1} Ошибка компиляции: {2}
|
||||
|
||||
EXPECTED_IDENTIFIER=Ожидался идентификатор
|
||||
AVAILABLE_PARAM_VARIANTS{0}=Допустимые значения: {0}
|
||||
AVAILABLE_EXT_VARIANTS{0}=Допустимые расширения файла: {0}
|
||||
SEE_THE_HELP_FOR_VARIANTS=Уточните допустимые значения в документации языка
|
||||
|
|
@ -20,6 +20,12 @@ NONTERMINALTOKEN_{0}_RETURN_NULL=Cинтаксическая конструкц
|
|||
SEMICOLON_BEFORE_ELSE=Перед else нельзя ставить точку с запятой
|
||||
UNEXPECTED_SYMBOL{0}=Неожиданный символ '{0}'
|
||||
UNSUPPORTED_OLD_DIRECTIVES=Директивы компилятора в стиле # более не поддерживаются. Используйте директивы в стиле {$ }
|
||||
UNKNOWN_DIRECTIVE{0}=Неизвестная директива '{0}'
|
||||
MISSING_DIRECTIVE_PARAM{0}=Директива '{0}' должна иметь параметр
|
||||
UNNECESSARY_DIRECTIVE_PARAM{0}=Директива '{0}' не допускает параметров
|
||||
INCORRECT_DIRECTIVE_PARAM{0}{1}{2}=Недопустимый параметр '{1}' для директивы '{0}'. {2}
|
||||
EMPTY_DIRECTIVE=Пустая директива недопустима
|
||||
DIRECTIVE_WRONG_NUMBER_OF_PARAMS{0}{1}=Директива '{0}' должна иметь {1}
|
||||
INCLUDE_COULDNT_OPEN_FILE{0}=Директива компилятора $include: нельзя открыть файл '{0}'
|
||||
INCLUDE_EMPTY_FILE=Директива компилятора $include: не указано имя файла
|
||||
RECUR_INCLUDE=Директива компилятора $include: рекурсивное включение файла
|
||||
|
|
@ -30,6 +36,13 @@ TYPE_NAME_EXPECTED=Ожидался тип
|
|||
MULTILINE_STRING_CONTAINS_INCONSISTENT_INDENTS=Мультистрочная строка содержит несовместимые отступы
|
||||
NON_WHITESPACE_CHARACTERS_BEFORE_CLOSING_QUOTES_OF_MULTILINE_STRING=Перед закрывающими кавычками многострочной строки не должно быть непробельных символов
|
||||
|
||||
PARAM_SINGLE1=параметр
|
||||
PARAM_SINGLE2=параметра
|
||||
PARAM_MULTIPLE1=параметров
|
||||
PARAM_MULTIPLE2=параметра
|
||||
NOT_MORE_THAN=не более
|
||||
EXACTLY=ровно
|
||||
|
||||
EOF1=конец файла
|
||||
EOF=(конец файла)
|
||||
TKIDENTIFIER=идентификатор
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ NONTERMINALTOKEN_{0}_RETURN_NULL=Синтаксична конструкція
|
|||
SEMICOLON_BEFORE_ELSE=Перед else крапка з комою не ставиться
|
||||
UNEXPECTED_SYMBOL{0}=Несподіваний символ '{0}'
|
||||
UNSUPPORTED_OLD_DIRECTIVES=Директиви компілятора в стилі # більше не підтримуються. Використовуйте директиви в стилі {$ }
|
||||
UNKNOWN_DIRECTIVE{0}=Невідома директива '{0}'
|
||||
MISSING_DIRECTIVE_PARAM{0}=Директива '{0}' не допускає використання без параметра
|
||||
UNNECESSARY_DIRECTIVE_PARAM{0}=Директива '{0}' не допускає параметрів
|
||||
INCORRECT_DIRECTIVE_PARAM{0}{1}=Директиві '{0}' передано непримустимий параметр: '{1}'
|
||||
EMPTY_DIRECTIVE=Порожня директива
|
||||
DIRECTIVE_WRONG_NUMBER_OF_PARAMS{0}{1}=Директива '{0}' повинна мати таку кількість параметрів: {1}
|
||||
INCLUDE_COULDNT_OPEN_FILE{0}=Директива компілятора $include: не можна відкрити файл '{0}'
|
||||
INCLUDE_EMPTY_FILE=Директива компілятора $include: не вказано ім'я файлу
|
||||
UNNECESSARY $endif=Зайвий $endif
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ NONTERMINALTOKEN_{0}_RETURN_NULL=当前版本的编译器不支持语法规则 '
|
|||
SEMICOLON_BEFORE_ELSE=不要在 else 之前加分号
|
||||
UNEXPECTED_SYMBOL{0}=意外的符号 '{0}'
|
||||
UNSUPPORTED_OLD_DIRECTIVES=不支持以 # 开头的编译器指令。 使用指令 {$ }
|
||||
UNKNOWN_DIRECTIVE{0}=未知指令 '{0}'
|
||||
MISSING_DIRECTIVE_PARAM{0}='{0}' 指令需要一个参数
|
||||
UNNECESSARY_DIRECTIVE_PARAM{0}='{0}' 该指令的使用不带参数
|
||||
INCORRECT_DIRECTIVE_PARAM{0}{1}=向 '{0}' 指令传递了一个无效参数 '{1}'
|
||||
EMPTY_DIRECTIVE=空指令
|
||||
DIRECTIVE_WRONG_NUMBER_OF_PARAMS{0}{1}='{0}' 指令必须有以下参数数:{1}
|
||||
INCLUDE_COULDNT_OPEN_FILE{0}=编译器指令 $include:无法打开文件 '{0}'
|
||||
INCLUDE_EMPTY_FILE=编译器指令 $include: 文件名不存在
|
||||
RECUR_INCLUDE=编译器指令 $include: 递归包含
|
||||
|
|
|
|||
Loading…
Reference in a new issue