diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java index feb32081f..6925fc8eb 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java @@ -112,7 +112,7 @@ public class ParseTreesDescriptors { @Override public boolean ignore(String targetName) { - return !targetName.matches("Java|Python2|Python3|Node"); + return !targetName.matches("Java|Python2|Python3|Node|Swift"); } } diff --git a/runtime/Swift/Antlr4/org/antlr/v4/runtime/ParserRuleContext.swift b/runtime/Swift/Antlr4/org/antlr/v4/runtime/ParserRuleContext.swift index 1e36ac7a1..13c91d6ef 100644 --- a/runtime/Swift/Antlr4/org/antlr/v4/runtime/ParserRuleContext.swift +++ b/runtime/Swift/Antlr4/org/antlr/v4/runtime/ParserRuleContext.swift @@ -79,6 +79,18 @@ open class ParserRuleContext: RuleContext { self.start = ctx.start self.stop = ctx.stop + + // copy any error nodes to alt label node + if ctx.children != nil{ + self.children = Array() + // reset parent pointer for any error nodes + for child: ParseTree in ctx.children! { + if child is ErrorNode{ + self.children?.append(child) + ( (child as! ErrorNode)).parent = self + } + } + } } public init(_ parent: ParserRuleContext?, _ invokingStateNumber: Int) {