Skip to content
Snippets Groups Projects
Commit a9276127 authored by Serafim Simonov's avatar Serafim Simonov
Browse files

fix faulty array detection

parent bf63190c
No related branches found
No related tags found
No related merge requests found
...@@ -458,7 +458,7 @@ public class XPathParser { ...@@ -458,7 +458,7 @@ public class XPathParser {
public static List<String> getArraysDecl(List<List<Node>> bodies){ /*public static List<String> getArraysDecl(List<List<Node>> bodies){
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<String>();
for(List<Node> body : bodies) { for(List<Node> body : bodies) {
for(Node node : body) { for(Node node : body) {
...@@ -477,6 +477,30 @@ public class XPathParser { ...@@ -477,6 +477,30 @@ public class XPathParser {
} }
} }
return result; return result;
}*/
public static List<String> getArraysDecl(List<List<Node>> bodies){
List<String> result = new ArrayList<String>();
for(List<Node> body : bodies) { //iterate throgh bodiees
for(Node node : body) { //get a body
if(node.getNodeName().equals("T-decl-stmt")) {//find decl stmt
if(node.getNodeType()==Node.ELEMENT_NODE) {
Element elem = (Element) node;
NodeList elems = elem.getElementsByTagName("EN-decl"); //get entity decl
for(int i = 0;i<elems.getLength();i++) {//iterate
Element endecl =(Element)elems.item(i);
NodeList a_specs = endecl.getElementsByTagName("array-spec"); // is array?
if(a_specs.getLength()>0) {
result.add(endecl.getElementsByTagName("n").item(0).getTextContent()); //blacklist!!
}
}
}
}
}
}
return result;
} }
//----------------------- //-----------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment