Skip to content

Commit

Permalink
Bugfixes for SOAL
Browse files Browse the repository at this point in the history
  • Loading branch information
balazssimon committed Jul 27, 2019
1 parent b967cd9 commit f075916
Show file tree
Hide file tree
Showing 250 changed files with 20,255 additions and 6,345 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ private void CollectHasAnnotationFlags()
private bool CollectHasAnnotationFlags(Antlr4ParserRule rule)
{
bool foundElemFlag = false;
foreach (var elem in rule.AllElements)
foreach (var elem in rule.Elements)
{
bool oldContainsAnnotations = elem.ContainsAnnotations;
bool oldContainsBinderAnnotations = elem.ContainsBinderAnnotations;
Expand All @@ -653,7 +653,7 @@ private bool CollectHasAnnotationFlags(Antlr4ParserRule rule)
this.SetAnnotationFlags(item);
if (item.ContainsAnnotations)
{
this.Grammar.ParserRuleElemUses.Add(elem.RedName());
this.Grammar.ParserRuleElemUses.Add(item.RedName());
}
Antlr4ParserRule itemTypeRule = this.Grammar.FindParserRule(item.Type);
if (itemTypeRule != null)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3281,19 +3281,6 @@ template GenerateDetailedSyntaxVisitorVisit(Antlr4ParserRule rule)
^
public virtual void Visit[rule.PlainName()]([rule.RedName()] node)
{
[if (rule.IsSimpleAlt)]
[loop(elem:rule.Elements)]
[if (elem.IsList)]
this.VisitList(node.[elem.RedName()]);
[else]
[if (elem.IsToken || elem.IsFixedTokenAltBlock)]
this.Visit(node.[elem.RedName()]);
[else]
this.Visit(node.[elem.RedName()]);
[end if]
[end if]
[end loop]
[else]
[loop(elem:rule.AllElements)]
[if (elem.IsList)]
this.VisitList(node.[elem.RedName()]);
Expand All @@ -3305,7 +3292,6 @@ public virtual void Visit[rule.PlainName()]([rule.RedName()] node)
[end if]
[end if]
[end loop]
[end if]
}
end template

Expand Down Expand Up @@ -4547,16 +4533,10 @@ end template

template GenerateDeclarationTreeBuilderVisitBody(Antlr4ParserRule rule)
[if (rule.ContainsAnnotations)]
[if (rule.IsSimpleAlt)]
[loop(elem:rule.Elements where elem.ContainsAnnotations)]
[GenerateDeclarationTreeBuilderVisitElement(rule, elem)]
[end loop]
[else]
[loop(elem:rule.AllElements where elem.ContainsAnnotations)]
[GenerateDeclarationTreeBuilderVisitElement(rule, elem)]
[end loop]
[end if]
[end if]
end template

template GenerateDeclarationTreeBuilderVisitElementBody(Antlr4ParserRuleElement elem)
Expand Down Expand Up @@ -4824,17 +4804,11 @@ end template


template GenerateBinderFactoryVisitBody(Antlr4ParserRule rule)
[if (rule.ContainsBinderAnnotations && hasloop(elem:rule.Elements where elem.HasBinderAnnotations))]
[if (rule.IsSimpleAlt)]
[loop(elem:rule.Elements where elem.ContainsBinderAnnotations)]
[GenerateBinderFactoryVisitElement(rule, elem)]
[end loop]
[else]
[if (rule.ContainsBinderAnnotations && hasloop(elem:rule.AllElements where elem.HasBinderAnnotations))]
[loop(elem:rule.AllElements where elem.ContainsBinderAnnotations)]
[GenerateBinderFactoryVisitElement(rule, elem)]
[end loop]
[end if]
[end if]
end template

template GenerateBinderFactoryVisitElementBody(Antlr4ParserRule rule, Antlr4ParserRuleElement elem)
Expand Down Expand Up @@ -4875,26 +4849,16 @@ if (use == Use[elem.RedName()])
end template

template GenerateBinderFactoryVisitElemUses(Antlr4ParserRule rule)
[if (rule.ContainsBinderAnnotations && hasloop(elem:rule.Elements where elem.HasBinderAnnotations))]
[if (rule.ContainsBinderAnnotations && hasloop(elem:rule.AllElements where elem.HasBinderAnnotations))]
if (this.ForChild)
{
[if (rule.IsSimpleAlt)]
[loop(elem:rule.Elements where elem.HasBinderAnnotations)]
[if (elem.IsList)]
if (LookupPosition.IsInNode(this.Position, parent.[elem.RedName()].Node)) use = Use[elem.RedName()];
[else]
if (LookupPosition.IsInNode(this.Position, parent.[elem.RedName()])) use = Use[elem.RedName()];
[end if]
[end loop]
[else]
[loop(elem:rule.AllElements where elem.HasBinderAnnotations)]
[if (elem.IsList)]
if (LookupPosition.IsInNode(this.Position, parent.[elem.RedName()].Node)) use = Use[elem.RedName()];
[else]
if (LookupPosition.IsInNode(this.Position, parent.[elem.RedName()])) use = Use[elem.RedName()];
[end if]
[end loop]
[end if]
}
[end if]
end template
Expand Down Expand Up @@ -5084,15 +5048,9 @@ end template

template GenerateBoundNodeFactoryVisitChildren(Antlr4ParserRule rule)
[string childBoundNodesName = rule.HasBoundNodeAnnotations ? "childBoundNodes" : "childBoundNodesForParent"]
[if (rule.IsSimpleAlt)]
[loop(elem:rule.Elements)]
[loop(elem:rule.AllElements)]
[GenerateBoundNodeFactoryVisitChildrenElementWithNullCheck(elem, childBoundNodesName)]
[end loop]
[else]
[loop(elem:rule.AllElements)]
[GenerateBoundNodeFactoryVisitChildrenElementWithNullCheck(elem, childBoundNodesName)]
[end loop]
[end if]
[end loop]
end template

template GenerateBoundNodeFactoryVisitChildrenElementWithNullCheck(Antlr4ParserRuleElement elem, string childBoundNodesName)
Expand Down Expand Up @@ -5282,15 +5240,9 @@ public bool Visit[rule.PlainName()]([rule.RedName()] node)
end template

template GenerateIsBindableNodeVisitChildren(Antlr4ParserRule rule)
[if (rule.IsSimpleAlt)]
[loop(elem:rule.Elements where elem.ContainsBoundNodeAnnotations)]
[GenerateIsBindableNodeVisitChildrenElementWithNullCheck(elem)]
[end loop]
[else]
[loop(elem:rule.AllElements where elem.ContainsBoundNodeAnnotations)]
[loop(elem:rule.AllElements where elem.ContainsBoundNodeAnnotations)]
[GenerateIsBindableNodeVisitChildrenElementWithNullCheck(elem)]
[end loop]
[end if]
[end loop]
end template

template GenerateIsBindableNodeVisitChildrenElementWithNullCheck(Antlr4ParserRuleElement elem)
Expand Down
Loading

0 comments on commit f075916

Please sign in to comment.