Removed ShiftReduceParser and UniversalParserHelper

This commit is contained in:
Владислав Крылов 2023-12-19 17:07:20 +03:00
parent 41304c2e36
commit 04adcb8962
18 changed files with 6 additions and 614 deletions

2
.gitignore vendored
View file

@ -37,7 +37,6 @@
**/CompilerController.dll
**/CompilerTools.dll
**/Errors.dll
**/ShiftReduceParser.dll
**/HelpBuilder.dll
**/InternalErrorReport.dll
**/LambdaAnySynToSemConverter.dll
@ -71,7 +70,6 @@
**/PascalABCNET.exe.config
**/PascalABCNETLinux.exe
**/PascalABCNETLinux.exe.config
**/UniversalParserHelper.dll

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "9";
public const string Build = "0";
public const string Revision = "3393";
public const string Revision = "3398";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%MINOR%=9
%REVISION%=3393
%COREVERSION%=0
%REVISION%=3398
%MINOR%=9
%MAJOR%=3

View file

@ -111,6 +111,7 @@
<Compile Include="Preprocessor3Yacc.cs" />
<Compile Include="PreprocessorTools.cs" />
<Compile Include="SemanticRules.cs" />
<Compile Include="ShiftReduceParserCode.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Errors\Errors.csproj">
@ -125,10 +126,6 @@
<Project>{AF2EFD7B-69DD-4B43-AF65-B59B29349C23}</Project>
<Name>ParserTools</Name>
</ProjectReference>
<ProjectReference Include="..\..\ShiftReduceParser\ShiftReduceParser.csproj">
<Project>{ad4e1292-2537-467a-934d-e9fda3f18d87}</Project>
<Name>ShiftReduceParser</Name>
</ProjectReference>
<ProjectReference Include="..\..\SyntaxTree\SyntaxTree.csproj">
<Project>{C2CAC65A-B2AE-4CCC-B067-E6B8E75DF73A}</Project>
<Name>SyntaxTree</Name>

View file

@ -8,10 +8,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsSupport", "PluginsSupport\PluginsSupport.csproj", "{CFC683F8-0165-4A9F-9C3F-BB8C5BAB507F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualPascalABCNET", "VisualPascalABCNET\VisualPascalABCNET.csproj", "{BC35F816-54EE-47E0-89FC-1C66EAC155A9}"
ProjectSection(ProjectDependencies) = postProject
{AD4E1292-2537-467A-934D-E9FDA3F18D87} = {AD4E1292-2537-467A-934D-E9FDA3F18D87}
{E862A9EF-836B-414B-AAC4-9D207CABDC82} = {E862A9EF-836B-414B-AAC4-9D207CABDC82}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}"
EndProject
@ -109,12 +105,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeacherControlPlugin", "Vis
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LambdaAnySynToSemConverter", "LambdaAnySynToSemConverter\LambdaAnySynToSemConverter.csproj", "{27D9800E-2689-4AA1-A2D6-128E4A9BAE98}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftReduceParser", "ShiftReduceParser\ShiftReduceParser.csproj", "{AD4E1292-2537-467A-934D-E9FDA3F18D87}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PascalABCSaushkinParser", "Parsers\PascalABCParserNewSaushkin\PascalABCSaushkinParser.csproj", "{1443F539-DCC7-4491-B4FD-B716C739DB3C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalParserHelper", "UniversalParserHelper\UniversalParserHelper.csproj", "{E862A9EF-836B-414B-AAC4-9D207CABDC82}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -499,18 +491,6 @@ Global
{27D9800E-2689-4AA1-A2D6-128E4A9BAE98}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{27D9800E-2689-4AA1-A2D6-128E4A9BAE98}.Release|x86.ActiveCfg = Release|Any CPU
{27D9800E-2689-4AA1-A2D6-128E4A9BAE98}.Release|x86.Build.0 = Release|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Debug|x86.ActiveCfg = Debug|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Debug|x86.Build.0 = Debug|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Release|Any CPU.Build.0 = Release|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Release|x86.ActiveCfg = Release|Any CPU
{AD4E1292-2537-467A-934D-E9FDA3F18D87}.Release|x86.Build.0 = Release|Any CPU
{1443F539-DCC7-4491-B4FD-B716C739DB3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1443F539-DCC7-4491-B4FD-B716C739DB3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1443F539-DCC7-4491-B4FD-B716C739DB3C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@ -523,18 +503,6 @@ Global
{1443F539-DCC7-4491-B4FD-B716C739DB3C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1443F539-DCC7-4491-B4FD-B716C739DB3C}.Release|x86.ActiveCfg = Release|Any CPU
{1443F539-DCC7-4491-B4FD-B716C739DB3C}.Release|x86.Build.0 = Release|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Debug|x86.ActiveCfg = Debug|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Debug|x86.Build.0 = Debug|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Release|Any CPU.Build.0 = Release|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Release|x86.ActiveCfg = Release|Any CPU
{E862A9EF-836B-414B-AAC4-9D207CABDC82}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -579,9 +547,7 @@ Global
{E009E776-9280-4061-B5CA-7F0C3E2D3C2A} = {26843C5D-9D7E-4C2C-AC14-2D227FA5592E}
{536CC813-7C4E-42BC-AE3A-BA1427F38756} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7}
{27D9800E-2689-4AA1-A2D6-128E4A9BAE98} = {F8CE2712-826B-450B-A72F-D32D80C99858}
{AD4E1292-2537-467A-934D-E9FDA3F18D87} = {F8CE2712-826B-450B-A72F-D32D80C99858}
{1443F539-DCC7-4491-B4FD-B716C739DB3C} = {BB6973BA-B3A2-4B31-A986-7CB008F22C4F}
{E862A9EF-836B-414B-AAC4-9D207CABDC82} = {F8CE2712-826B-450B-A72F-D32D80C99858}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {68E993E6-EE86-4DDF-B0A1-4FE884F8AC39}

View file

@ -1 +1 @@
3.9.0.3393
3.9.0.3398

View file

@ -1 +1 @@
!define VERSION '3.9.0.3393'
!define VERSION '3.9.0.3398'

View file

@ -56,7 +56,6 @@
;dobavljaem fajly v uninst.log
${AddFile} "Compiler.dll"
${AddFile} "CompilerTools.dll"
${AddFile} "ShiftReduceParser.dll"
${AddFile} "Errors.dll"
${AddFile} "Localization.dll"
${AddFile} "NETGenerator.dll"
@ -72,7 +71,6 @@
${AddFile} "Mono.Cecil.dll"
${AddFile} "TeacherControlPlugin.dll"
${AddFile} "LambdaAnySynToSemConverter.dll"
${AddFile} "UniversalParserHelper.dll"
${AddFile} "License.txt"
${AddFile} "copyright.txt"
${AddFile} "pabcnetc.exe.config"

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

View file

@ -1,52 +0,0 @@
<?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>{AD4E1292-2537-467A-934D-E9FDA3F18D87}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>GPPG</RootNamespace>
<AssemblyName>ShiftReduceParser</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="ShiftReduceParserCode.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj">
<Project>{c2cac65a-b2ae-4ccc-b067-e6b8e75df73a}</Project>
<Name>SyntaxTree</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанные со сборкой.
[assembly: AssemblyTitle("UniversalParserHelper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UniversalParserHelper")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("e862a9ef-836b-414b-aac4-9d207cabdc82")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Редакция
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -1,385 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QUT.Gppg;
using PascalABCCompiler.SyntaxTree;
using PascalABCCompiler.Errors;
namespace UniversalParserHelper
{
public static class StringResources
{
private static string prefix = "PASCALABCPARSER_";
public static string Get(string Id)
{
string ret = PascalABCCompiler.StringResources.Get(prefix + Id);
if (ret == prefix + Id)
return Id;
else
return ret;
}
}
public abstract class UniversalParserHelper
{
private const int max_char_const = 0xFFFF;
// SSM: Errors инициализируется в другом месте - сюда только передается!
public List<Error> errors;
public List<CompilerWarning> warnings;
public System.Collections.Stack NodesStack; // SSM: для каких-то вспомогательных целей в двух правилах
public bool build_tree_for_formatter = false;
public bool build_tree_for_format_strings = false;
public string CurrentFileName;
public List<compiler_directive> compilerDirectives;
public List<var_def_statement> pascalABC_var_statements;
public List<type_declaration> pascalABC_type_declarations;
public UniversalParserHelper()
{
NodesStack = new System.Collections.Stack();
pascalABC_var_statements = new List<var_def_statement>();
pascalABC_type_declarations = new List<type_declaration>();
}
public string directive_parameter(string s)
{
var ind = s.IndexOf(" ");
if (ind < 0)
return "";
else
{
s = s.Substring(ind + 1);
s = s.TrimEnd('}');
return s;
}
}
public ident create_directive_name(string text, SourceContext sc)
{
ident dn = new ident(new string(text.ToCharArray(1, text.Length - 1)));
dn.source_context = sc;
return dn;
}
public string RemoveThousandsDelimiter(string s, SourceContext sc)
{
if (s.EndsWith("_") || s.Contains("__"))
{
var errstr = ParserErrorsStringResources.Get("BAD_FORMED_NUM_CONST");
errors.Add(new SyntaxError(errstr, CurrentFileName, sc, null));
}
return s.Replace("_", "");
}
private const_node create_int_const(string text, SourceContext sc, System.Globalization.NumberStyles NumberStyles)
{
//таблица целых констант на уровне синтаксиса
// не может быть - 0 +
// 32--------16----8----|----8----16--------32----------------64(bits)
// [ int64 )[ int32 ]( int64 ]( uint64 ]
text = RemoveThousandsDelimiter(text, sc);
if (NumberStyles == System.Globalization.NumberStyles.HexNumber)
text = text.Substring(1);
const_node cn = new int32_const();
if (text.Length < 8)
(cn as int32_const).val = Int32.Parse(text, NumberStyles);
else
{
try
{
UInt64 uint64 = UInt64.Parse(text, NumberStyles);
if (uint64 <= Int32.MaxValue)
(cn as int32_const).val = (Int32)uint64;
else
if (uint64 <= Int64.MaxValue)
cn = new int64_const((Int64)uint64);
else
cn = new uint64_const(uint64);
}
catch (Exception)
{
if (NumberStyles == System.Globalization.NumberStyles.HexNumber)
errors.Add(new BadHex(CurrentFileName, sc, null));
else
errors.Add(new BadInt(CurrentFileName, sc, null));
}
}
cn.source_context = sc;
return cn;
}
public const_node create_int_const(string text, SourceContext sc)
{
return create_int_const(text, sc, System.Globalization.NumberStyles.Integer);
}
public const_node create_double_const(string text, SourceContext sc)
{
const_node cn = null;
try
{
System.Globalization.NumberFormatInfo sgnfi = new System.Globalization.NumberFormatInfo();
sgnfi.NumberDecimalSeparator = ".";
text = RemoveThousandsDelimiter(text, sc);
double val = double.Parse(text, sgnfi);
cn = new double_const(val);
cn.source_context = sc;
}
catch (Exception)
{
errors.Add(new BadFloat(CurrentFileName, sc, null));
}
return cn;
}
public const_node create_bigint_const(string text, SourceContext sc)
{
text = RemoveThousandsDelimiter(text, sc);
var txt = text.Substring(0, text.Length - 2);
var cn = new bigint_const();
try
{
cn.val = System.UInt64.Parse(txt);
}
catch (Exception)
{
errors.Add(new BadInt(CurrentFileName, sc, null));
}
cn.source_context = sc;
return cn;
}
public ident create_ident(string text, SourceContext sc)
{
if (text[0] == '&')
text = text.Substring(1);
ident id = new ident(text);
id.source_context = sc;
return id;
}
public string ReplaceSpecialSymbols(string text)
{
text = text.Replace("''", "'");
return text;
}
public char_const create_char_const(string text, SourceContext sc)
{
string char_text = new string(text.ToCharArray(1, text.Length - 2));
char_text = ReplaceSpecialSymbols(char_text);
char_const ct = new char_const();
ct.source_context = sc;
if (char_text.Length == 1)
{
ct.cconst = char_text[0];
return ct;
}
return null;
}
public sharp_char_const create_sharp_char_const(string text, SourceContext sc)
{
string int_text = new string(text.ToCharArray(1, text.Length - 1));
sharp_char_const scc = null;
int val = 0;
if (int.TryParse(int_text, out val))
{
if (val > max_char_const)
{
scc = new sharp_char_const(0);
errors.Add(new TooBigCharNumberInSharpCharConstant(CurrentFileName, sc, scc));
}
else
scc = new sharp_char_const(val);
scc.source_context = sc;
}
else
{
errors.Add(new TooBigCharNumberInSharpCharConstant(CurrentFileName, sc, scc));
}
return scc;
}
public literal create_string_const(string text, SourceContext sc)
{
literal lt;
if (text.Length == 3 && text[0] == '\'' && text[2] == '\'')
{
lt = new char_const(text[1]);
lt.source_context = sc;
return lt;
}
text = ReplaceSpecialSymbols(text.Substring(1, text.Length - 2));
lt = new string_const(text);
lt.source_context = sc;
return lt;
}
public literal create_format_string_const(string text, SourceContext sc)
{
literal lt;
text = ReplaceSpecialSymbols(text.Substring(2, text.Length - 3));
lt = new string_const(text);
(lt as string_const).IsInterpolated = true;
lt.source_context = sc;
return lt;
}
public void AddError(string message, LexLocation loc)
{
errors.Add(new SyntaxError(message, CurrentFileName, loc, null));
}
public string CreateErrorString(string yytext, LexLocation yyloc, params object[] args)
{
string prefix = "";
if (yytext != "")
prefix = StringResources.Get("FOUND{0}");
else
prefix = StringResources.Get("FOUNDEOF");
if (this.build_tree_for_format_strings && prefix == StringResources.Get("FOUNDEOF"))
{
yytext = "}";
prefix = StringResources.Get("FOUND{0}");
}
// Преобразовали в список строк - хорошо
string expected = String.Join(", ", args.Skip(1).Select(x => x.ToString()));
var ExpectedString = StringResources.Get("EXPECTED{1}");
// string w = string.Join(" или ", tokens.Select(s => ConvertToHumanName((string)s)));
return string.Format(prefix + ExpectedString, "'" + yytext + "'", expected);
}
/* public string CreateErrorString(string yytext, LexLocation yyloc, params object[] args)
{
string expected = String.Join(", ", args.Skip(1).Select(x => x.ToString()));
string err = $"PARSER ERROR \"{yytext}\" AT LINE #{yyloc.StartLine}: EXPECTED {expected}, FOUND {args[0]}";
return err;
}*/
public List<object> ident_list11(object lr1, object lr3)
{
List<object> ar = (List<object>)lr3;
ar.Insert(0, lr1);
return ar;
}
public List<object> ident_list12(object lr0)
{
List<object> ar = new List<object>();
ar.Add(lr0);
return ar;
}
public List<object> ident_list21(object lr0, object lr2)
{
List<object> ar = (List<object>)lr0;
ar.Add(lr2);
return ar;
}
public List<object> ident_list13(object lr1, object lr3, object lr5)
{
List<object> ar = (List<object>)lr5;
//named_type_reference n_t_r = (named_type_reference)lr3;
var_def_statement vds = new var_def_statement();
vds.vars = new ident_list();
vds.vars.idents.Add((ident)lr1);
vds.vars_type = (type_definition)lr3;//n_t_r;
ar.Insert(0, vds);
return ar;
}
public List<object> ident_list14(object lr1, object lr3)
{
List<object> ar = new List<object>();
//named_type_reference n_t_r = (named_type_reference)lr3;
var_def_statement vds = new var_def_statement();
vds.vars = new ident_list();
vds.vars.idents.Add((ident)lr1);
vds.vars_type = (type_definition)lr3;
ar.Add(vds);
return ar;
}
public void create_source_context(object to, object left, object right)
{
if (to != null)
((syntax_tree_node)to).source_context = get_source_context(left, right);
}
public SourceContext get_source_context(object left, object right)
{
//debug
/*if (left == null && right!=null)
{
Console.WriteLine("\n\rerror: left is null(create_source_context)!\n\r");
Console.WriteLine(((syntax_tree_node)right).source_context.ToString());
}
if (right == null && left!=null)
{
Console.WriteLine("\n\rerror: right is null(create_source_context)!\n\r");
Console.WriteLine(((syntax_tree_node)left).source_context.ToString());
}
if (((syntax_tree_node)left).source_context == null)
{
Console.WriteLine("\n\rerror: source_context is null!(left)\n\r");
return null;
}
if (((syntax_tree_node)right).source_context == null)
{
Console.WriteLine("\n\rerror: source_context is null!(right)\n\r");
return null;
}
*/
if ((left == null) || (right == null) || (((syntax_tree_node)left).source_context == null) || (((syntax_tree_node)right).source_context == null))
return null;
return new SourceContext(((syntax_tree_node)left).source_context, ((syntax_tree_node)right).source_context);
}
public void create_source_context_left(object to, object left)
{
file_position fp = ((syntax_tree_node)left).source_context.begin_position;
((syntax_tree_node)to).source_context = new SourceContext(fp.line_num, fp.column_num, fp.line_num, fp.column_num, 0, 0);
}
public void create_source_context_right(object to, object right)
{
file_position fp = ((syntax_tree_node)right).source_context.end_position;
((syntax_tree_node)to).source_context = new SourceContext(fp.line_num, fp.column_num, fp.line_num, fp.column_num, 0, 0);
}
public object sc_not_null(object o1, object o2)
{
if (o1 != null)
if (((syntax_tree_node)o1).source_context != null) return o1;
return o2;
}
public object sc_not_null(object o1, object o2, object o3)
{
if (o1 != null)
if (((syntax_tree_node)o1).source_context != null) return o1;
if (o2 != null)
if (((syntax_tree_node)o2).source_context != null) return o2;
return o3;
}
public object sc_not_null(params object[] arr)
{
foreach (object o in arr)
if (o != null)
if (((syntax_tree_node)o).source_context != null) return o;
return null;
}
public void assign_source_context(object to, object from)
{
//debug
//if (((tree_node)from).source_context==null) Console.WriteLine("\n\rerror: from sc is null(assign_source_context)!\n\r");
if (to != null && from != null)
((syntax_tree_node)to).source_context = ((syntax_tree_node)from).source_context;
}
}
}

View file

@ -1,76 +0,0 @@
<?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>{E862A9EF-836B-414B-AAC4-9D207CABDC82}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UniversalParserHelper</RootNamespace>
<AssemblyName>UniversalParserHelper</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\</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>
<PropertyGroup>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="UniversalParserHelper.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Errors\Errors.csproj">
<Project>{44a01f9e-dce7-470c-aae5-c3de0ccbee3b}</Project>
<Name>Errors</Name>
</ProjectReference>
<ProjectReference Include="..\Localization\Localization.csproj">
<Project>{2de2842f-0912-4251-bc0f-480854c44a13}</Project>
<Name>Localization</Name>
</ProjectReference>
<ProjectReference Include="..\ParserTools\ParserTools.csproj">
<Project>{af2efd7b-69dd-4b43-af65-b59b29349c23}</Project>
<Name>ParserTools</Name>
</ProjectReference>
<ProjectReference Include="..\ShiftReduceParser\ShiftReduceParser.csproj">
<Project>{ad4e1292-2537-467a-934d-e9fda3f18d87}</Project>
<Name>ShiftReduceParser</Name>
</ProjectReference>
<ProjectReference Include="..\SyntaxTree\SyntaxTree.csproj">
<Project>{c2cac65a-b2ae-4ccc-b067-e6b8e75df73a}</Project>
<Name>SyntaxTree</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

BIN
bin/ShiftReduceParser.dll Normal file

Binary file not shown.

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

Binary file not shown.