From a3bc940cd77e4b68d3a807914df5af807ecb2790 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 7 Jul 2024 17:33:40 +0200 Subject: [PATCH] Fix https://github.com/antlr/antlr4/issues/4656 Remove duplicated element to math python3 runtime --- runtime/Cpp/runtime/src/tree/xpath/XPath.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp index c0398962ec..1c4907199b 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp @@ -147,7 +147,13 @@ std::vector XPath::evaluate(ParseTree *t) { } } i++; - work = next; + // remove duplicated element + work.clear(); + for (unsigned int i=0; i < next.size(); i++ ){ + if (std::find(work.begin(),work.end(),next[i]) == std::end(work)) { + work.push_back(next[i]); + } + } } return work;