Skip to content
Snippets Groups Projects
Commit 446d889b authored by Edward Sabinus's avatar Edward Sabinus
Browse files

Implemented ExitFTreeleaf for building TreeLeafs for function Trees

parent 232268bc
No related branches found
No related tags found
No related merge requests found
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.30413.136 VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaumtransformationBewerter", "BaumtransformationBewerter.csproj", "{92368058-E4B1-446D-8CCD-DC95512F9CA6}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BewerterStrukturellerInduktion", "BewerterStrukturellerInduktion.csproj", "{2DF4D10C-09B1-46FD-B0FA-FE10C08199C4}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
...@@ -11,15 +11,15 @@ Global ...@@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{92368058-E4B1-446D-8CCD-DC95512F9CA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DF4D10C-09B1-46FD-B0FA-FE10C08199C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92368058-E4B1-446D-8CCD-DC95512F9CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DF4D10C-09B1-46FD-B0FA-FE10C08199C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92368058-E4B1-446D-8CCD-DC95512F9CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DF4D10C-09B1-46FD-B0FA-FE10C08199C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92368058-E4B1-446D-8CCD-DC95512F9CA6}.Release|Any CPU.Build.0 = Release|Any CPU {2DF4D10C-09B1-46FD-B0FA-FE10C08199C4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CC6FE5A7-3FC6-4A91-858E-CF70F4CFCB8F} SolutionGuid = {F701E637-8DE3-434E-B944-AAB6E73E4DA4}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal
...@@ -141,25 +141,27 @@ namespace Eingabeverwaltung.Parser ...@@ -141,25 +141,27 @@ namespace Eingabeverwaltung.Parser
public void EnterTreeLeaf([NotNull] ADTParser.TreeLeafContext context) { } public void EnterTreeLeaf([NotNull] ADTParser.TreeLeafContext context) { }
public void ExitTreeLeaf([NotNull] ADTParser.TreeLeafContext context) public void ExitTreeLeaf([NotNull] ADTParser.TreeLeafContext context)
=> LH.ExitTreeLeaf(context.BEZ().GetText()); => LH.ExitTreeLeaf(context.BEZ().GetText(),new Listener_Helper.Coords(context.Start.Line,context.Start.Column));
public void EnterTreeNode([NotNull] ADTParser.TreeNodeContext context) { } public void EnterTreeNode([NotNull] ADTParser.TreeNodeContext context) { }
public void ExitTreeNode([NotNull] ADTParser.TreeNodeContext context) public void ExitTreeNode([NotNull] ADTParser.TreeNodeContext context)
=> LH.ExitTreeNode(context.BEZ().GetText(), context.ChildCount, context.GetText()); => LH.ExitTreeNode(context.BEZ().GetText(), context.ChildCount, context.GetText(), new Listener_Helper.Coords(context.Start.Line, context.Start.Column));
// function Trees // function Trees
public void EnterFTree([NotNull] ADTParser.FTreeContext context) => throw new NotImplementedException(); public void EnterFTree([NotNull] ADTParser.FTreeContext context) { }
public void ExitFTree([NotNull] ADTParser.FTreeContext context) => throw new NotImplementedException(); public void ExitFTree([NotNull] ADTParser.FTreeContext context)
=> LH.ExitFTreeNode(context.BEZ().GetText(), context.ChildCount, context.GetText(), new Listener_Helper.Coords(context.Start.Line, context.Start.Column));
public void EnterFTreeBracketFree([NotNull] ADTParser.FTreeBracketFreeContext context) { }
public void ExitFTreeBracketFree([NotNull] ADTParser.FTreeBracketFreeContext context)
=> LH.ExitFTreeNode(context.BEZ().GetText(), context.ChildCount, context.GetText(), new Listener_Helper.Coords(context.Start.Line, context.Start.Column));
public void EnterFTreeBracketFree([NotNull] ADTParser.FTreeBracketFreeContext context) => throw new NotImplementedException(); public void EnterTreeBracket([NotNull] ADTParser.TreeBracketContext context) { }
public void ExitFTreeBracketFree([NotNull] ADTParser.FTreeBracketFreeContext context) => throw new NotImplementedException(); public void ExitTreeBracket([NotNull] ADTParser.TreeBracketContext context) { }
public void EnterTreeBracket([NotNull] ADTParser.TreeBracketContext context) => throw new NotImplementedException(); public void EnterTreeBez([NotNull] ADTParser.TreeBezContext context) { }
public void ExitTreeBracket([NotNull] ADTParser.TreeBracketContext context) => throw new NotImplementedException();
public void EnterTreeBez([NotNull] ADTParser.TreeBezContext context) => throw new NotImplementedException(); public void ExitTreeBez([NotNull] ADTParser.TreeBezContext context)
=> LH.ExitFTreeLeaf(context.BEZ().GetText(), new Listener_Helper.Coords(context.Start.Line, context.Start.Column));
public void ExitTreeBez([NotNull] ADTParser.TreeBezContext context) => throw new NotImplementedException();
// useless Interface requirements // useless Interface requirements
public void EnterEveryRule(ParserRuleContext ctx) { } public void EnterEveryRule(ParserRuleContext ctx) { }
......
...@@ -79,8 +79,8 @@ namespace Eingabeverwaltung.Parser ...@@ -79,8 +79,8 @@ namespace Eingabeverwaltung.Parser
adt_vars.Add(new Variable(variableName, sort)); adt_vars.Add(new Variable(variableName, sort));
} }
public void ExitTreeLeaf(string treeName) => ExitTreeLeaf(treeName,new Coords(-1,-1)); // classic Trees
// Trees public void ExitTreeLeaf(string treeName) => ExitTreeLeaf(treeName, new Coords(-1, -1));
/// <summary> /// <summary>
/// TreeLeaf is whether a Variable or a constant (ComposedTree without children) /// TreeLeaf is whether a Variable or a constant (ComposedTree without children)
/// </summary> /// </summary>
...@@ -128,6 +128,24 @@ namespace Eingabeverwaltung.Parser ...@@ -128,6 +128,24 @@ namespace Eingabeverwaltung.Parser
} }
} }
// function Trees
public void ExitFTreeLeaf(string treeName, Coords coords)
{
Tree result = null;
Variable variable = findVariableInADT_Vars(treeName);
if (variable != null)
result = new TreeVariable(variable);
else
{
Operation operation = findOperationInADT_Ops(treeName, -1, false, coords); // can't test it here because of structure of fTrees
if (operation != null)
result = new ComposedTree(operation, new List<Tree>());
}
if (result == null) throw new ParsingException(coords,"The Tree " + treeName + " could not be found in Vars or Operations of the ADT!");
trees.Add(result);
}
// Helping functions // Helping functions
/// <summary> /// <summary>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment